VMware Cloud Community
zenivox
Hot Shot
Hot Shot
Jump to solution

Backup-VCSA module error

Hello, I'm getting a weird error when using the Backup-VCSA module created by Brian Graaf. I have successfully used that module over 4 vCenter servers already for months, but on this Windows jump box dedicated to a different vCenter appliance I'm getting this error (I don't avail of another jump box), I am wondering whether it could be related to the .net framework which I just upgraded to 5.1?

This is the script:

$user = 'xxxxxxx@vsphere.local'

      $vcenter = 'xxxxxxxx'

      $password = get-content "C:\Scripts\Pro\VCSA-Backup\creds.txt" | convertto-securestring -key (1..16)

      $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $user,$password

     

      Connect-CisServer -Server $vcenter -User $user -Password $cred.GetNetworkCredential().Password

      Connect-VIServer -Server $vcenter -User $user -Password $cred.GetNetworkCredential().Password

       

        $Comment = "Full Backup $vcenter-$(Get-Date).ToString('yyyy-MM-dd')"

        $LocationType = "FTPS"

        $location = "xxxxxx/backup/$vcenter-$((Get-Date).ToString('yyyy-MM-dd'))"

        $LocationUser = "xxxxxxxx"

        [VMware.VimAutomation.Cis.Core.Types.V1.Secret]$locationPassword = "xxxxxxxxx"

        Backup-VCSAToFile -LocationType $LocationType -Location $location -LocationUser $LocationUser -LocationPassword $locationPassword -Comment $Comment -FullBackup

I broke the execution bit by bit and the error is thrown when last line is executed. So something inside the Backup-VCSAToFile module, however it runs fine on other jump boxes for otehr vCenter servers, here's the error:

Method invocation failed because [System.Management.Automation.PSCustomObject] does not contain a method named 'Create'.

At C:\Scripts\Pro\VCSA-Backup\Backup-VCSA.psm1:60 char:9

+         $CreateSpec = $BackupAPI.Help.create.piece.Create()

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

    + CategoryInfo          : InvalidOperation: (Create:String) [], RuntimeException

    + FullyQualifiedErrorId : MethodNotFound

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:61 char:9

+         $CreateSpec.parts = $parts

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

    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException

    + FullyQualifiedErrorId : PropertyNotFound

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:62 char:9

+         $CreateSpec.backup_password = $BackupPassword

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

    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException

    + FullyQualifiedErrorId : PropertyNotFound

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:63 char:9

+         $CreateSpec.location_type = $LocationType

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

    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException

    + FullyQualifiedErrorId : PropertyNotFound

The property 'location' 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 = $Location

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

    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException

    + FullyQualifiedErrorId : PropertyNotFound

The property 'location_user' cannot be found on this object. Verify that the property exists and can be set.

At C:\Scripts\Pro\VCSA-Backup\Backup-VCSA.psm1:65 char:9

+         $CreateSpec.location_user = $LocationUser

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

    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException

    + FullyQualifiedErrorId : PropertyNotFound

The property 'location_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:66 char:9

+         $CreateSpec.location_password = $LocationPassword

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

    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException

    + FullyQualifiedErrorId : PropertyNotFound

The property 'comment' cannot be found on this object. Verify that the property exists and can be set.

At C:\Scripts\Pro\VCSA-Backup\Backup-VCSA.psm1:67 char:9

+         $CreateSpec.comment = $Comment

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

    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException

    + FullyQualifiedErrorId : PropertyNotFound

A server error occurred: 'com.vmware.vapi.std.errors.invalid_argument': Structure operation-input is missing a field piece (Server error id: 'vapi.data.structure.field.missing'). Check

$Error[0].Exception.ServerError for more details.

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

+             throw $_.Exception.Message

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

    + CategoryInfo          : OperationStopped: (A server error ...r more details.:String) [], RuntimeException

    + FullyQualifiedErrorId : A server error occurred: 'com.vmware.vapi.std.errors.invalid_argument': Structure operation-input is missing a field piece (Server error id: 'vapi.data.structure.field.m

   issing'). Check $Error[0].Exception.ServerError for more details.

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Not sure where you got your copy of the Backup-VCSA module from, but the one on the PowerCLI examples repo is different.

There it says (CreateExample instead of Create)

$CreateSpec = $BackupAPI.Help.create.piece.CreateExample()


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

View solution in original post

Reply
0 Kudos
7 Replies
LucD
Leadership
Leadership
Jump to solution

Not sure where you got your copy of the Backup-VCSA module from, but the one on the PowerCLI examples repo is different.

There it says (CreateExample instead of Create)

$CreateSpec = $BackupAPI.Help.create.piece.CreateExample()


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

Reply
0 Kudos
dtaliafe
Hot Shot
Hot Shot
Jump to solution

Are you using the same version of PowerCLI on this server?  I'd check that the PowerCLI versions are the same and that "Connect-CisServer $vcenter" works with the credentials you're using.  Also make sure that all of the services are running on the VCSA (compare to one that's working if needed).  I haven't seen this error specifically, but I've had backups fail because a service wasn't running.

Reply
0 Kudos
zenivox
Hot Shot
Hot Shot
Jump to solution

that is weird, I copied the same module I'm using elsewhere that works. I'll download the version suggested and revert!

Reply
0 Kudos
zenivox
Hot Shot
Hot Shot
Jump to solution

Thanks! PowerCLI the same version. The error is thrown when the module is invoked. As Luc suggested I'll download a more recent version

Reply
0 Kudos
zenivox
Hot Shot
Hot Shot
Jump to solution

swapped the module with the one suggested and it works. However I checked the module I'm using elsewhere and it uses Create instead of CreateExample and it works!?

PowerCLI is 6.5 everywhere... the only different is .net framework which is 5.0 where it works and 5.1 where it didn't... could it be?

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

That's indeed very strange.
Could it be that you have the module installed twice on some of the stations?

Do a

Get-Module -Name Backup-VCSA -ListAvailable

It could be the .Net version, since PowerShell does not list .Net 5.x explicitly in its list of supported platforms.

But it does state .Net 4.5.2 or above.

PowerCLI does only state .NET 4.5, 4.5.x, 4.6, or 4.6.x, but no mention of "above".


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

Reply
0 Kudos
zenivox
Hot Shot
Hot Shot
Jump to solution

Thanks Luc, the module is only imported in the script. So your suggested line does not show any output. Thanks for the explanation too, I guess that is the only reason. As I was getting the errors mentioned at the beginning I upgraded .net from 3.0 to 5.1, while the rest of the jump stations are all on 5.0, but I neglected to look into the module version.

I hope to see you at the vmworld to at least shake your hand and thank you for all the help provided so far!!

Reply
0 Kudos