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

Popular posts from this blog

Generating Event ID 91, 44 with CA (In Event Viewer with source as Certsvc)

Group policy default policy cannot be edited because network name not found

Problem when changing update source