Save output of a command
hi all,
i trying save output of command can read , decide weather completed or not. i having trouble running command though. it's working switches aren't.
$servers = get-content servers.txt | sort-object foreach ( $server in $servers ) { & psexec.exe \\$server 'c:\program files (x86)\progfolder\program.exe' option -t=$duration -e=$email -c=$comment -q=110 }
when ran complains not specifying options/switches. ideas?
thanks.
you don't need = options...try this. $results collective output running command on each of servers.
$results = @() $servers = get-content servers.txt | sort-object foreach ( $server in $servers ) { $result = & psexec.exe \\$server 'c:\program files (x86)\progfolder\program.exe' option -t $duration -e $email -c $comment -q 110 $results += new-object psobject -property @{computer=$server;result=$result} }
Windows Server > Windows PowerShell
Comments
Post a Comment