Hi Everyone,
I am trying to get the culture info of the Remote machine with poweshel on UiPath. Here is my PSScript:
“$password
$usernma
$hostname
$pw = convertto-securestring -AsPlainText -Force -String $password
$cred = New-Object -typename System.Management.Automation.PSCredential -argumentlist $usernma,$pw
$session = New-pssession -computername $hostname -credential $cred
Invoke-Command -Session $session -ScriptBlock {Get-Culture} -ArgumentList $localIpAddress
Remove-PSSession $session”
I get the following error: Invoke Power Shell: Unable to cast object of type ‘System.String’ to type ‘System.Globalization.CultureInfo’.
And when i change the TyoeArgument to String i get this error: Invoke Power Shell: Unable to cast object of type ‘System.Globalization.CultureInfo’ to type ‘System.String’ .
The code works perfectly fine on PS Console.
Can anyone help me please?