Closed mirovasilev closed 1 year ago
Example, VMware Cloud Director version: 10.1.3 will return those supported versions. Major Minor Build Revision
36 2 -1 -1 36 1 -1 -1 36 0 -1 -1 35 2 -1 -1 35 0 -1 -1 34 0 -1 -1
Code bellow will return newest version and convert it to string.
Could you consider update your Get-APIVersion function?
[xml]$Versions = Invoke-RestMethod @APICheckParams $version = ($Versions.SupportedVersions.VersionInfo.Where{ $.deprecated -eq $false }).version.foreach{[version]$} | Sort-Object -Descending | Select-Object -First 1
$APIVersion = $version.ToString(2) return $APIVersion
@jondwaite Not sure if this project is still active but here I go
When connected to a vCD with powershell 7.3 and running following command:
Get-CIVMDisk -VM TEST13
I get
Write-Error: Could not match supplied VM to a connected VCD instance, exiting.
If I pipe it with Get-CIVM that on its own results in the vm details
Get-CIVM -OrgVdc $vmOrgVdc -Name TEST13 | Get-CIVMDisk
I get the same error
Write-Error: Could not match supplied VM to a connected VCD instance, exiting.
I assume the API's have changed and the module is not updated. Is there any change this module will be reviewed?
@jondwaite Not sure if this project is still active but here I go
When connected to a vCD with powershell 7.3 and running following command:
Get-CIVMDisk -VM TEST13
I get
Write-Error: Could not match supplied VM to a connected VCD instance, exiting.
If I pipe it with Get-CIVM that on its own results in the vm details
Get-CIVM -OrgVdc $vmOrgVdc -Name TEST13 | Get-CIVMDisk
I get the same error
Write-Error: Could not match supplied VM to a connected VCD instance, exiting.
I assume the API's have changed and the module is not updated. Is there any change this module will be reviewed?
Get-CIVM expects a VM object to be passed to it to work correctly (as returned by Get-CIVM), so in the first case (-VM parameter) that's expected behaviour - you're passing a VM name and not a VM object.
Your 2nd example works fine for me testing against the 37.1 (VCD 10.4.1) release though, so not sure what's going on there - have you set $vmOrgVdc correctly and it's pointing to a (single) VDC object?
I've just uploaded a patched version to Github and will try and update in PSGallery that should fix the API version issue too.
Hi Jon,
How cool to hear that this project is still maintained. My colleagues are pushing me to declaritice Terraform but I like the procedural way of powercli 🙂
Now indeed I passed on a working variable
PS C:\Users\JurgenVerhelst-ezNet\OneDrive - ez Networking\GIT\ezMSP_ProjectAutomation> Get-CIVM -OrgVdc $vmOrgVdc -Name TEST13-CL-SRV01
WARNING: PowerCLI scripts should not use the 'Uid' property. The property will be removed in a future release. Name Status GuestOSFullName CpuCount MemoryGB
TEST13-CL-SRV01 PoweredOn Microsoft Windows Server 2022 (64-bit) 1 4,000
So I get only one object back. I assume that would sufice for CIVMDisk?
PS C:\Users\JurgenVerhelst-ezNet\OneDrive - ez Networking\GIT\ezMSP_ProjectAutomation> Get-CIVM -OrgVdc $vmOrgVdc -Name TEST13-CL-SRV01 | Get-CIVMDisk Write-Error: Error retrieving VM properties from VCD API, exiting.
Thanks for updating github Now, I am not a developer, I can import modules and dable with some powershell code. how would I use your updated github files? 🙂 when I download your dsm and try to paste in in the location of your previous version it says 'Nah, not going to happen'. so I thats not the way
Met vriendelijke groet, J u r g e n V e r h e l s t Network consultant MCSA/M - CSC - STS ez Networking Broekdam Noord 24 9150 Kruibeke E: @.**@.> M: +32 478 88 18 11 T: +32 3 775 75 38 F: +32 3 775 28 91 @.?anonymous&ep=signature> Book time to meet with @.?anonymous&ep=signature>
From: Jon Waite @.> Sent: 02 February 2023 09:48 To: jondwaite/CIVMDisks @.> Cc: Jurgen Verhelst | ez Networking @.>; Comment @.> Subject: Re: [jondwaite/CIVMDisks] Issue with incorrect API format (Issue #2)
@jondwaitehttps://github.com/jondwaite Not sure if this project is still active but here I go
When connected to a vCD with powershell 7.3 and running following command:
Get-CIVMDisk -VM TEST13
I get
Write-Error: Could not match supplied VM to a connected VCD instance, exiting.
If I pipe it with Get-CIVM that on its own results in the vm details
Get-CIVM -OrgVdc $vmOrgVdc -Name TEST13 | Get-CIVMDisk
I get the same error
Write-Error: Could not match supplied VM to a connected VCD instance, exiting.
I assume the API's have changed and the module is not updated. Is there any change this module will be reviewed?
Get-CIVM expects a VM object to be passed to it to work correctly (as returned by Get-CIVM), so in the first case (-VM parameter) that's expected behaviour - you're passing a VM name and not a VM object.
Your 2nd example works fine for me testing against the 37.1 (VCD 10.4.1) release though, so not sure what's going on there - have you set $vmOrgVdc correctly and it's pointing to a (single) VDC object?
I've just uploaded a patched version to Github and will try and update in PSGallery that should fix the API version issue too.
— Reply to this email directly, view it on GitHubhttps://github.com/jondwaite/CIVMDisks/issues/2#issuecomment-1413353223, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AO7LEUSD32PQKVPT2Z6D25LWVNYHVANCNFSM5OHITNMA. You are receiving this because you commented.Message ID: @.***>
Thank you
in function - Get-APIVersion there is operation: Measure-Object -Property Version -Maximum).Maximum.ToString() + ".0" it returns 36.2.0 for API. Which is not accepted by vCloud resulting in error : Error retrieving VM properties from VCD API, exiting. Real reason is: Response status code does not indicate success: 406 (Not Acceptable).
vCloud Director expects API version 36.2 By placing comment of + ".0" everything works fine. Measure-Object -Property Version -Maximum).Maximum.ToString() #+ ".0"