Remote Session
1 TopicRunning an exe install remotely
I want to have a script run through an OU and install an exe on each server but I'm having difficulty putting everything together. What am I doing wrong? Is there a better way to script this? This is what I currently have. $cmd = '\\server\share\install.exe' $parm1 = '/S /Token=' $parm2 = 'Test$' foreach($server in Get-ADComputer -Filter * -SearchBase "OU=Servers,DC=Domain,DC=Local") { Invoke-Command -ComputerName $server $cmd $parm1"'"$parm2"'" } This is the error I'm currently getting. Invoke-Command : A positional parameter cannot be found that accepts argument '/S /TOKEN='Test$''. At C:\Scripts\Nagios-Push.ps1:7 char:9 + Invoke-Command -ComputerName $server $cmd $parm1"'"$parm2"'" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Invoke-Command], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.InvokeCommandCommand10KViews0likes1Comment