Hello,
I obtain a ParserError when I execute the PS script below:
$computernames = (get-content “C:\computersList.txt”)
cd "C:\WINDOWS\System32"
foreach ($computer in $computernames){
"c:\Users\toto\Downloads\psexec.exe" \\$computer /u "domain\user name" /p "pass" -c Cscript script.vbs
}
The error concerns the argument of psexec: \\$computer
What is the correct syntax to use a variable ?
Thanks in advance