orchestrator-powershell icon indicating copy to clipboard operation
orchestrator-powershell copied to clipboard

Add-UiPath Robot Error machine already Taken

Open Xyclade opened this issue 4 years ago • 2 comments

I am adding a UiPath Robots using powershell, but it is giving me an error that the machine name is already taken. Is there a way to create UiPath Robots using the scripts where it in this case picks the already created machine?

Error:

powershell : Add-UiPathRobot : The operation returned an error: 1001: The machine name ROBOT01 is already taken

I used below command:

Add-UiPathRobot -Name $robotName -Username $username -MachineName $machineName -Password $password -Type  $robotLicenseType -LicenseKey $licenseKey

Xyclade avatar Mar 26 '20 10:03 Xyclade

The way it worked for me was to add the LicenseKey from the Machine I was adding the robot to. However even that is not straightforward, as you can get the licenseKey only if you Get the machine by Id:


$existingMachine = Get-UiPathMachine -Name $robot.MachineName
$existingMachine = Get-UiPathMachine -Id $existingMachine.Id

Add-UiPathRobot -Name $robot.Name -MachineName $robot.MachineName -Username $robot.Username -Type $robot.Type -HostingType $robot.HostingType -Description $robot.Description -CredentialType "Default" -LicenseKey $existingMachine.LicenseKey > $null
           

sorincalin avatar Apr 09 '20 06:04 sorincalin

Thank you @sorincalin - I didn't pick up on that as the the errors are very generic and Get-Help is lacking in description and examples.

Is there a reason not to return the LicenseKey when requesting by Name rather than Id?

Seems silly to have to do it twice or not be able to pipe the i/o

(Get-UiPathMachine -Id ((Get-UiPathMachine -Name $machine).Id)).LicenseKey

codemonkee avatar Jun 24 '20 23:06 codemonkee