Unable to login to orchestrator CE via powershell command

I am unable to Login to Orchestrator CE via powershell command.

Get-UiPathAuthToken -Session

As mentioned in this thread , I am using the above command. But I am not able to login. I am getting below error.

Sudden thing that i notice is that it used to work fine till yesterday but from today I am getting this error consistently. Is something changed in Orchestrator CE ?

1 Like

@Remus_Rusanu , @loginerror Any idea on this ??

Typically an error like that indicates that some cmdlet loads an older version of Newtonsoft.Json into the powershell process before the UiPath cmdlet runs. Did you make any change in your scripts, load some other library?

I have made no changes at all to the script. Also to my surprise the same script is running today. But I definitely need to figure out what could be the reason behind this. So I was thinking of the changes that I did and noting them as under. Please point out if these factors could be responsible or not for this behavior.

I am running a standalone powershell script that firsts installs UiPath.powershell module if not present and then creates many assets. The strip down generalized version would be as below.

installation of UiPath powershell…

install nuget

Install-PackageProvider -Name NuGet -Force

register UiPath repository

$uipathrepository = Get-PSRepository -Name “UiPath”
if(!$uipathrepository) {
Register-PSRepository -Name UiPath -SourceLocation https://www.myget.org/F/uipath-dev/api/v2
}

install UiPath powershell module

$uipathmodule = Get-Module -Name “UiPath.Powershell”
if(!$uipathmodule) {
Install-Module -Repository UiPath -Name UiPath.Powershell -Force
}

import module

Import-Module UiPath.PowerShell

connect to orchestrator in case of public cloud orchestrator

Get-UiPathAuthToken -Session

Add-UiPathAsset GlobalAsset -IntValue 1

Here when i try to connect to orchestrator, window to ask for credentials popped up but now it does not, so does it pick username and password from chrome’s saved passwords ? If yes then, yesterday i did clear my browsing history and cache.

I did restart my machine today and it seems to run smoothly.

The gist of the issue is that your PowerShell session is the problem, not the script. If you have a session open today and run some cmdlet that loads the old library, leave the session open, come back tomorrow and run the script, it will fail.
Simply recycling the PowerShell session (close the window) should fix the problem

3 Likes

Yup you are right may be it was power-shell session that was causing issue. Thanks a lot for your help :slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.