I am trying to run below code to add machines to my Citrix catalog but getting error , any help appreciated
PS Code-
Machine = Get-Content “C:\temp\machine.txt”
$HostID = Get-Content “C:\Temp\HostID.txt”
for ($i=0;$i-le $Machine.length-1;$i++)
{
$x = $Machine
$y = $HostID
New-BrokerMachine -MachineName $x -HostedMachineId $y -CatalogUid 18 -HypervisorConnectionUid 2
}
Output error-
New-BrokerMachine : Cannot convert ‘System.Object’ to the type ‘System.String’ required by parameter ‘MachineName’. Specified method is not supported.
At line:6 char:32
- New-BrokerMachine -MachineName $Machine -HostedMachineId $HostID -Cat …
-
~~~~~~~~
- CategoryInfo : InvalidArgument: ( [New-BrokerMachine], ParameterBindingException
- FullyQualifiedErrorId : CannotConvertArgument,Citrix.Broker.Admin.SDK.NewBrokerMachineCommand