Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 8583

returning and referencing remote powershell variable results

$
0
0

Hi,  I'm very new to powershell so looking some assistance.  I am trying to run remote powershell script to check health of or VDI enviroment using Citrix Commandlets.  (I am implementing the script on Microsoft orchestrator .Net Activity).  So I have the following code:
#2012 VDI Desktop check

$vdims = "MyCitrixPowershellSDKServer"
function vdidesktopcheck
{

                asnp Citrix*
                $result = Get-BrokerDesktop -InMaintenanceMode $True -DesktopGroupName Unidesk
 $result
}


$output = invoke-command -computer $vdims -scriptblock ${function:vdidesktopcheck}
$machinename = $output.machinename
$machinename
$state = $output.RegistrationState
$state

So when I use orchestrator to expose the variables $machinename, $state - I get the 'last' result from the involked Get-BrokerDesktop query.  However Get-Brokerdesktop query may have multiple machines returned so I am hoping to be able to reference each of the machines that match the query output.  Thats the basic requirement - what I am hoping to be able to do is further refine the basic Get-BrokerDesktop query to be able to count the number on machines output to say > 3 (ie more than 3 machines in MaintMode is unacceptable) and also check that the MachineName property is not equal to a particular value, ie the 3 test machine names in the environment which may be expected to be in MaintenanceMode.

Hope this makes sense, if not I'll try and elaborate.  Any help much appreciated!!


Viewing all articles
Browse latest Browse all 8583

Trending Articles