Hello to all, some time ago I wrote this post below:
and now I have the exact same error again. The box where I used to run my scripts died (Window 2012 R2) and it was replaced with a 2016 (PS 5.1.14393.2248 - PowerCLI 11(latest)). I just set the usual script below and I got again that error:
Import-Module "C:\Scripts\Pro\VCSA-Backup\Backup-VCSA.psm1" -Force
$vcenter = 'xxxxxxxxxx'
$Creds = Import-Clixml -Path "C:\Scripts\Pro\VCSA-Backup\config.xml"
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $Creds.UserName,$Creds.Password
Connect-CisServer -Server $vcenter -User $cred.GetNetworkCredential().UserName -Password $cred.GetNetworkCredential().Password
Connect-VIServer -Server $vcenter -User $cred.GetNetworkCredential().UserName -Password $cred.GetNetworkCredential().Password
$Comment = "Full Backup $vcenter-$(Get-Date).ToString('yyyy-MM-dd')"
$LocationType = "FTPS"
$location = "xxxxxxxxx/backup/$vcenter-$((Get-Date).ToString('yyyy-MM-dd'))"
$LocationUser = "vcsa-backup-user"
[VMware.VimAutomation.Cis.Core.Types.V1.Secret]$locationPassword = "xxxxxxxxxx"
Backup-VCSAToFile -LocationType $LocationType -Location $location -LocationUser $LocationUser -LocationPassword $locationPassword -Comment $Comment -FullBackup
Error:
The property 'parts' cannot be found on this object. Verify that the property exists and can be set.
At C:\Scripts\Pro\VCSA-Backup\Backup-VCSA.psm1:62 char:9
+ $CreateSpec.parts = $parts
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
The property 'backup_password' cannot be found on this object. Verify that the property exists and can be set.
At C:\Scripts\Pro\VCSA-Backup\Backup-VCSA.psm1:63 char:9
+ $CreateSpec.backup_password = $BackupPassword
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
The property 'location_type' cannot be found on this object. Verify that the property exists and can be set.
At C:\Scripts\Pro\VCSA-Backup\Backup-VCSA.psm1:64 char:9
+ $CreateSpec.location_type = $LocationType
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
etc...
This time the module is exactly as it is published on the Github. What could it be? After the logins are done if I run
Get-CisService com.vmware.appliance.recovery.backup.job
I get a proper response!
Can it be the PowerCli or the PS version?
And does this only show 1 object?
$global:DefaultCisServers
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
What does it show when you run this?
Update with your VCSA FQDN
Connect-CisServer -Server <your-vcsa>
$api = Get-CisService com.vmware.appliance.recovery.backup.job
$api.Help.create.piece.CreateExample()
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I get this below and I also tried on another Win 2012 R2 with PowerCLI 6.5.1 and PS 5.1.14409.1005 with same result:
Help : @{Documentation={@name BackupRequest} {@term structure} Structure representing requested backup piece; parts=; backup_password=; location_type=; location=; location_user=; location_password=; comment=}
parts : {}
backup_password : <secret>
location_type : The valid values for this variable are: FTPS, HTTP, SCP, HTTPS, FTP.
location :
location_user :
location_password : <secret>
comment :
Help : @{Documentation={@name BackupRequest} {@term structure} Structure representing requested backup piece; parts=; backup_password=; location_type=; location=; location_user=; location_password=; comment=}
parts : {}
backup_password : <secret>
location_type : The valid values for this variable are: FTPS, HTTP, SCP, HTTPS, FTP.
location :
location_user :
location_password : <secret>
comment :
Help : @{Documentation={@name BackupRequest} {@term structure} Structure representing requested backup piece; parts=; backup_password=; location_type=; location=; location_user=; location_password=; comment=}
parts : {}
backup_password : <secret>
location_type : The valid values for this variable are: FTPS, HTTP, SCP, HTTPS, FTP.
location :
location_user :
location_password : <secret>
comment :
Help : @{Documentation={@name BackupRequest} {@term structure} Structure representing requested backup piece; parts=; backup_password=; location_type=; location=; location_user=; location_password=; comment=}
parts : {}
backup_password : <secret>
location_type : The valid values for this variable are: FTPS, HTTP, SCP, HTTPS, FTP.
location :
location_user :
location_password : <secret>
comment :
And does this only show 1 object?
$global:DefaultCisServers
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
:smileyblush: