UiPath / orchestrator-powershell

UiPath Orchestrator PowerShell cmdlet library
MIT License
106 stars 56 forks source link

Edit-UiPathRobot : LicenseKey cannot be null #66

Closed loicmitton closed 4 years ago

loicmitton commented 4 years ago

Hello,

Orchestrator Version 2018.4.1, Powershell version 19.4.0.18 (tested on 19.1.0.17 too)

When we try to edit a robot password we get the following message : Edit-UiPathRobot -Id $robot.Id -Password "123456" Edit-UiPathRobot : 'LicenseKey' cannot be null. At line:1 char:1

We checked with api call GET on https://orchestratorurl/odata/Robots return the following :

 {
      "LicenseKey": null,
      "MachineName": "Machinename",
      "MachineId": 32,
      "Name": "POC robot",
      "Username": "global\\pocrobot",
      "Description": null,
      "Version": "18.4.1.0",
      "Type": "Development",
      "HostingType": "Standard",
      "Password": null,
      "CredentialType": null,
      "RobotEnvironments": "DEV",
      "Id": 82,
      "ExecutionSettings": null
    }

We found https://orchestratorurl/odata/Robots/UiPath.Server.Configuration.OData.GetMachineNameToLicenseKeyMappings() to extract Machine/License key pair then was able to execute the following :

PUT https://orchestratorurl/odata/Robots(82)

{
   "LicenseKey":"LicenseKeyFoundInPreviousQuery",
"Name": "POC robot",
      "Username": "global\\pocrobot",
 "MachineName": "Machinename",
"Type": "Development",
  "Password": "1234",
  "Id": 82
}

I think that the Get-UiPathRobot should query GetMachineNameToLicenseKeyMapping to fill the licenskey or the Edit-UiPathRobot should do it on edition.

loicmitton commented 4 years ago

After giving Admin right to the account, Get-UIPathRobot -Id 82 return the LicenseKey