Code of Conduct
VMware Cloud Foundation
v5.0
PowerShell Version
5.1
PowerCLI Version
13.0.0
Module Version
2.1.0
PowerValidatedSolutions Version
2.3.0
PowerVCF Version
Guest Operating System
Windows Server 2019
Environment Details
No response
Description
Command is failing with VCF 5.0
Error or Debug Output
PS C:\Users\Administrator> Publish-StorageCapacityHealth -server sfo-vcf01.sfo.rainpole.io -user administrator@vsphere.local -pass VMw@re1! -allDomains -outputJson C:\Users\Administrator\Desktop\vmware\hrm\logs\send-data_2023-06-13_21-04-28 -localUser vcf -localPass VMw@re1!
[06-13-2023_21:29:02] Error at Script Line 3736
Write-LogMessage : Cannot bind argument to parameter 'Path' because it is null.
At C:\Program Files\WindowsPowerShell\Modules\PowerVCF\2.3.0.1004\PowerVCF.psm1:5507 char:5
+ Write-LogMessage -message " Error at Script Line $lineNumber" -co ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Write-LogMessage], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Write-LogMessage
Expected Behavior
Command should work.
Actual Behavior
Command should work without errors.
Upon debugging -
PS C:\Users\Administrator> $server = "sfo-vcf01.sfo.rainpole.io"
PS C:\Users\Administrator> $user = "administrator@vsphere.local"
PS C:\Users\Administrator> $pass = "VMw@re1!"
PS C:\Users\Administrator> $localUser = "vcf"
PS C:\Users\Administrator> $localpass = "VMw@re1!"
PS C:\Users\Administrator>
PS C:\Users\Administrator>
PS C:\Users\Administrator> Request-VCFToken -fqdn sfo-vcf01.sfo.rainpole.io -username administrator@vsphere.local -password VMw@re1!
Successfully Requested New API Token From SDDC Manager: sfo-vcf01.sfo.rainpole.io
PS C:\Users\Administrator>
PS C:\Users\Administrator> Test-VCFConnection -server $server
True
PS C:\Users\Administrator> Test-VCFAuthentication -server $server -user $user -pass $pass
True
PS C:\Users\Administrator>
PS C:\Users\Administrator>
PS C:\Users\Administrator> $allWorkloadDomains = Get-VCFWorkloadDomain
PS C:\Users\Administrator> $allStorageCapacityHealth = New-Object System.Collections.ArrayList
PS C:\Users\Administrator>
PS C:\Users\Administrator> foreach ($domain in $allWorkloadDomains ) {
>> Write-Output "domain = $domain"
>> $vCenterStorageHealth = Request-VcenterStorageHealth -server $server -user $user -pass $pass -domain $domain.name; $allVcenterStorageHealth += $vCenterStorageHealth
>> $esxiStorageCapacity = Request-EsxiStorageCapacity -server $server -user $user -pass $pass -domain $domain.name; $allEsxiStorageCapacity += $esxiStorageCapacity
>> $datastoreStorageCapacity = Request-DatastoreStorageCapacity -server $server -user $user -pass $pass -domain $domain.name; $allDatastoreStorageCapacity += $datastoreStorageCapacity
>> }
domain = @{id=186b5e3a-fc15-4a4d-8631-e869e5d216c0; name=sfo-w01; status=ACTIVE; type=VI; vcenters=System.Object[]; ssoId=0f82dfa6-3e73-4532-89b4-9c0faedf2b34; ssoName=sfo-w01.local; isManagementSsoDomain=False; clusters=System.Object[]; nsxtCluster=; capacity=}
domain = @{id=390d4eed-2fcd-4c8e-9782-0710e4c691ec; name=sfo-m01; status=ACTIVE; type=MANAGEMENT; vcenters=System.Object[]; ssoId=825474a0-f453-4422-a556-114436e918fb; ssoName=vsphere.local; isManagementSsoDomain=True; clusters=System.Object[]; nsxtCluster=; capacity=}
Method invocation failed because [System.Management.Automation.PSObject] does not contain a method named 'op_Addition'.
At line:5 char:128
+ ... omain.name; $allDatastoreStorageCapacity += $datastoreStorageCapacity ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (op_Addition:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
The code needs to be fixed to explicitly define $allDatastoreStorageCapacity, $allEsxiStorageCapacity, $allVcenterStorageHealth as Arrays.
Steps to Reproduce
NA
Log Fragments and Files
No response
Screenshots
No response
References
No response
Code of Conduct
VMware Cloud Foundation
v5.0
PowerShell Version
5.1
PowerCLI Version
13.0.0
Module Version
2.1.0
PowerValidatedSolutions Version
2.3.0
PowerVCF Version
Guest Operating System
Windows Server 2019
Environment Details
No response
Description
Command is failing with VCF 5.0
Error or Debug Output
Expected Behavior
Command should work.
Actual Behavior
Command should work without errors.
Upon debugging -
The code needs to be fixed to explicitly define $allDatastoreStorageCapacity, $allEsxiStorageCapacity, $allVcenterStorageHealth as Arrays.
Steps to Reproduce
NA
Log Fragments and Files
No response
Screenshots
No response
References
No response