2
Powershell скрипт выполняет script.ps1 на remote_machinePsExec в Powershell не принимает зашифрованные пароли
read-host -assecurestring | convertfrom-securestring | out-file D:\Script\cred.txt
$password = get-content D:\Script\cred.txt | convertto-securestring
$pwd = "plaintext_password"
$j = "remote_computer"
$comp = "\\"+$j
$command = "D:\PSTools\PsExec.exe $comp -u Administrator -p $pwd -accepteula powershell.exe c:\share\script.ps1"
Invoke-Expression $command
Однако, если я заменю $ PWD с $ паролем, то есть
$command = "D:\PSTools\PsExec.exe $comp -u Administrator -p $password -accepteula powershell.exe c:\share\script.ps1"
Я получаю
The user name or password is incorrect.
Я правильно ввел пароль несколько раз