Cannot convert 'System.Object[]' to the type 'System.Guid' required by parameter 'ID'
version 14.0.5.0 64-bit
I've got a script that starts an AWS instance and then updates the RDM Session with the new Host IP address and starts the remote desktop session.
The script was working fine but after the recent update the script fails.
When the script calls:
# Get the RDM session object and apply the retrieved IP as the Host
$session = Get-RDMSession -Name $RDMSessionName
# Update the RDM Host value with the Current IP
Set-RDMSessionProperty -ID $session.ID -Property 'Host' -Value $PublicIpAddress
I'm getting the error:
Set-RDMSessionProperty : Cannot convert 'System.Object[]' to the type 'System.Guid' required by parameter 'ID'. Specified method is not supported.
Should I be obtaining the session ID differently?
Hello,
I have moved your topic into the PowerShell section on our forum.
One of our technician will have a look at your post and reply to you later regarding this.
Best regards,
Jeff Dagenais
Hello,
You can try to Type-Cast the ID like this :
Set-RDMSessionProperty -ID ([GUID]$session.ID) -Property 'Host' -Value "sess123"
You could also work directly on the session object in this fashion, i do realize however that this adds a few lines :
$session.Host = $PublicIpAddress
Set-RDMSession $session -refresh
Both should work fine.
I hope this helps.
Best regards,
Alex Belisle
Alex,
Type-Casting of the ID worked just fine. I'll keep both of your suggestions in mind.
Thanks for the assistance!
Jamie
Hello,
Sorry for the delay, thanks a lot for the feedback, glad i could help!
Best regards,
Alex Belisle