How to Upload Packages to Orchestrator using Powershell Command

How to upload packages to Orchestrator using Powershell command?

Orchestrator API can be used to upload a package with Invoke Powershell , please follow below steps:

  • Open PowerShell with administrator rights
  • Run the following commands one by one to install a Powershell library to interact with the Orchestrator

PS C:\>Install-PackageProvider -Name NuGet -Force

PS C:\>Register-PSRepository -Name UiPath -SourceLocation https://www.myget.org/F/uipath-dev/api/v2

PS C:\>Install-Module -Repository UiPath -Name UiPath.Powershell -Force

PS C:\>Install-PackageProvider -Name NuGet -Force

PS C:\>Register-PSRepository -Name UiPath -SourceLocation https://www.myget.org/F/uipath-dev/api/v2

PS C:\>Install-Module -Repository UiPath -Name UiPath.Powershell -Force

PS C:\>Import-Module UiPath.PowerShell

  • Authenticate the request. Please find below script to authenticate the request. Replace the Orchestrator URL, Username and Password

PS C:\>Get-UiPathAuthToken -URL -Username -Password -Session

NOTE - This Authentication session is valid for 30 minutes(i.e Once successfully authenticated, You can call any request for next 30 mins.)

  • Post this, package can be added by running the following command

Add-UiPathPackage "C:\PackageLocation"

Attached a script that can upload all packages from a folder to Orchestrator

1.png

Import-Module UiPath.PowerShell

Get-UiPathAuthToken -URL -Username -Password -Session

$files = Get-ChildItem "C:\PathToPackagesFolder"

foreach ($file in $files){Add-UiPathPackage $file.FullName}

1 Like

A post was split to a new topic: Upload packages to Orchestrator using Powershell script

@Anil_G
1.when I install above packages through the powershell script, I was able to connect to the orchestrator.
2.I have created a custom AMI from the windows server in which I have installed above packages.

  1. I cant connect to the orchestrator from the windows server which I have launched using the custom AMI created in the step 2, can anybody help with this, and I cant find the powershell packages installed previously.

  2. I have included powershell scripts in the user data(aws) but no use.

Thanks in advance.