VMware Cloud Community
zenivox
Hot Shot
Hot Shot
Jump to solution

BACKUP-VCSATOFILE error

Hello, I'm running Brian Graf's function backup-vcsatofile but I'm running into errors I can't understand. Below the script:

$LocationType = "FTP"

        $location = "xxxxxxxxx/vcsa-backup/current-$((Get-Date).ToString('yyyy-MM-dd-hh-mm'))"

        $LocationUser = "vcsa-backup-user" #ftp user

        [VMware.VimAutomation.Cis.Core.Types.V1.Secret]$locationPassword = "xxxxxxx" #ftp user password

        Backup-VCSAToFile -LocationType FTP -Location $location -LocationUser $LocationUser -LocationPassword $locationPassword -Comment “This is a demo” -FullBackup

connect-viserver and cisserver are done with the administrator@vsphere.local (I hope I can use another ad-hoc user with less privs) and vcenter is 6.5 build 8815520. The error is:

Backup-VCSAToFile : Exception of type 'Microsoft.PowerShell.Commands.WriteErrorException' was thrown.

At line:11 char:9

+         Backup-VCSAToFile -LocationType FTP -Location $location -Loca ...

+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException

    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Backup-VCSAToFile

and if I choose to -Showprogress I get:

Backup-VCSAToFile : Exception of type 'Microsoft.PowerShell.Commands.WriteErrorException' was thrown.

At line:11 char:9

+         Backup-VCSAToFile -LocationType FTP -Location $location -Loca ...

+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException

    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Backup-VCSAToFile

A server error occurred: 'com.vmware.vapi.std.errors.error': Status for '' does not exist. (Server error id: 'com.vmware.applmgmt.err_status_does_not_exist'). Check $Error[0].Exception.ServerError for more details.

At C:\Scripts\Pro\Backup-VCSA.psm1:81 char:35

+                 $BackupAPI.get("$($BackupJob.ID)") | select id, progr ...

+                                   ~~~~~~~~~~~~~

    + CategoryInfo          : OperationStopped: (:) [], CisServerException

    + FullyQualifiedErrorId : VMware.VimAutomation.Cis.Core.Types.V1.CisServerException

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Did you import the module with the Force option?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
8 Replies
LucD
Leadership
Leadership
Jump to solution

Looks like you might be using an older version of Backup-VCSA.psm1 without fixes #96 and #97.

Which would explain the cryptic error message.

Can you check if you have the latest version?

Line 75 should say throw $_.Exception.Message


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
zenivox
Hot Shot
Hot Shot
Jump to solution

no it does not, it says Write-Error $Error[0].exception.Message. Thanks for the URL, I downloaded the latest and imported the module again, but it throws exactly the same error messages I attached above.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Did you import the module with the Force option?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
zenivox
Hot Shot
Hot Shot
Jump to solution

ops no I didn't! Now errors have gone... Many thanks indeed as usual!

If I may ask you if you have had the same situation I'm getting now (which is not directly related to what sorted above)... The error now is different and related to ftp, it says "ftp location is invalid". However the location is perfectly accessible via a ftp client with the same user and password. On a different site (twin site) with the same config it goes through without issues. This happens with the VCSA management interface. I tried with PowerCLI to see any difference and I encountered the issues above, but now that are sorted I get the same error even in the PowerCLI console:

A server error occurred: 'com.vmware.vapi.std.errors.error': FTP location is invalid. (Server error id: 'com.vmware.applmgmt.err_invalid_remote_loc'). Check $Error[0].Exception.ServerError for more details.

At C:\Scripts\Pro\Backup-VCSA.psm1:72 char:13

+             throw $_.Exception.Message

I can't understand what could be different from the other site, as VCSA are twins, installed on same day and ftp server on repository VM also. Folders structure... ever happened to you?

0 Kudos
zenivox
Hot Shot
Hot Shot
Jump to solution

also, do you think it's possible to run that script with a different user than the administrator@vsphere.loca? I tried with my domain account which is administrator and it didn't work

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Not really, but invalid FTP location can have many possible causes.

Since it's in essence an URI, it could be that hostname (the xxxxxxx part in your location string), can not be resolved on the VCSA.
Or perhaps the FTP port is blocked (FW ?).

I would test the backup in the VAMI client - Backup page, and see if that works with your FTP server.

Afaik it has to be an account that is know to SSO, and has the correct permissions.
You can also test that in the VAMI client


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
zenivox
Hot Shot
Hot Shot
Jump to solution

Thanks Luc, I'm using IP and I actually suspect something with the VAMI interface as yesterday it went through and today again the "invalid ftp" error again .. I will revert with my findings. Thanks again

0 Kudos
zenivox
Hot Shot
Hot Shot
Jump to solution

0 Kudos