VRO 7.2 and Powershell 5 Secure String Issues Installing Horizon Agent

Trying to install horizon agent on non-domain joined parent image





$userPassword = ConvertTo-SecureString -String $password -AsPlainText -Force

$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList ($username, $userPassword)

Connect-VIServer -Server

Start-VM -VM vmvdi1

sleep 120

Invoke-Command -ComputerName -Credential $cred -ScriptBlock { & 'C:\Users\Admin\Desktop\VMware-viewagent-x86_64-6.2.4-5327555.exe' /s /v"/qn" }

Get the error:

item: 'Invoke an external script/item0', state: 'failed', business state: 'null', exception: 'PowerShellInvocationError: Errors found while executing script

System.Management.Automation.ParameterBindingValidationException: Cannot bind argument to parameter 'String' because it is null.

If I don't use secure string and just punch my password into the VRO workflow prompt in plain text, why doesn't this work?

I tried it without the convertto-securestring and the parameter password it also fails with a different error about

System.Management.Automation.MethodInvocationException: Exception calling ".ctor" with "2" argument(s): "Cannot process argument because the value of argument "password" is null. Change the value of argument "password" to a non-null value."

0 Kudos
0 Replies