I am trying to run a powershell script from a computer (name: Builds) on a remote computer (name: Test), both machine are running Windows 10. The script is as follows:
01.
param ([Parameter(Mandatory=$
true
)][
string
]$buildPath)
02.
03.
$strScriptUser =
"Test"
04.
$strPass =
"hld@1234"
05.
$PSS = ConvertTo-SecureString $strPass -AsPlainText -Force
06.
$Credential =
new
-
object
system.management.automation.PSCredential $strScriptUser,$PSS
07.
08.
Write $Credential.UserName
09.
10.
Start-Process powershell.exe
"C:\Users\Test\Documents\PowerShellForContinua\Core.ps1 '$buildPath'"
-Credential $Credential -Wait
When I run the above script on Test computer, locally it works fine. But when I try to execute this script from Builds computer it giving following error:
Although username and password are correct. Only things is that password contains special character. This is how I am calling the script