remoting - Powershell invoking remote script to get farmload (XenApp 4.5) -


qfarm /loadi have problem remote executing script.

the script invokes command cmd qfarm /load , converts result psobjects.

function new-qlast() {     param ([string] $qname, [string] $qload)     $qlast = new-object psobject      $qlast | add-member -membertype noteproperty -name servername -value $qname     $qlast | add-member -membertype noteproperty -name serverlast -value $qload      return $qlast }  write-host "start"   $b = @() foreach ($a in $(qfarm /load)) {     $b += $a.split(" ") | where-object { $_ -ne "" } } $b  $table = @() ($i = 5; $i -lt $b.length; $i += 2) #for xa 4.5 $i = 5 $i += 2; xa 6.5 $i += 5 , $i = 8 {     $table += new-qlast $b[$i] $b[$i+1] } $table 

as get's invoking qfarm /load nothing happening anymore.

when execute script directly on terminal server works fine.

i tried run invoke-command -computername server01 {qfarm /load} works first 22 servers of farm it's not returning still running till manually turn off.

has idea why get's stuck?

thanks in advance.

first of bob , sorry late reply.

unfortunately method doesn't work, found way around.

i found vbs , used powershellscript.

it looks this:

$server = import-csv c:\server_on.txt | where-object { $_.serverstatus -eq $true }  $load = get-wmiobject -computername $server.servername -namespace "root\citrix" -class metaframe_server_loadlevel | select-object servername, loadlevel 

the difference qfarm /load have address every single server.


Comments