Posts RSS Comments RSS 117 Posts and 170 Comments till now

Set-CitrixServerLogon.ps1 (Citrix Top 10)

Here is a useful little script. This Creates a MFCom Server Object and disables or Enables Logons for that Server.

  1. # Set-CitrixServerLogon.ps1
  2. # Brandon Shell [MVP]
  3. # www.bsonposh.com
  4. # Sets the Server to Enable or Disable Logons
  5. Param($Server,[switch]$enable,[switch]$disable,[switch]$help)
  6. function HelpMe{
  7.     Write-Host
  8.     Write-Host " Set-CitrixServerLogon.ps1:" -fore Green
  9.     Write-Host "   Sets the Server to Enable or Disable Logons"
  10.     Write-Host
  11.     Write-Host " Parameters:" -fore Green
  12.     Write-Host "   -Server                  : Optional. Server to Set Logon"
  13.     Write-Host "   -Enable                  : Optional. Checks Hours of Idle Time (Default)"
  14.     Write-Host "   -Disable                 : Optional. Checks Minutes of Idle Time"
  15.     Write-Host "   -Help                    : Optional. Displays This"
  16.     Write-Host
  17.     Write-Host " Examples:" -fore Green
  18.     Write-Host "   To disable the Logon for a Server" -fore White
  19.     Write-Host "     Set-CitrixServerLogon.ps1 -server <serverName> -Disable" -fore Yellow
  20.     Write-Host
  21. }
  22.  
  23. if(!$Server -or $help){helpme;Write-Host;return}
  24.  
  25. Write-Host
  26.  
  27. Write-Host " Getting Server [$Server]"
  28. $mfsrv = New-Object -ComObject MetaFrameCOM.MetaFrameServer
  29.  
  30. Write-Host " - Initializing Server"
  31. $mfsrv.Initialize(6,$Server)
  32.  
  33. if($enable)
  34. {
  35.     Write-Host " - Setting to EnableLogon = 1"
  36.     $mfSrv.WinServerObject.EnableLogon = 1
  37. }
  38. if($disable)
  39. {
  40.     Write-Host " - Setting to EnableLogon = 0"
  41.     $mfSrv.WinServerObject.EnableLogon = 0
  42. }
  43.  
  44. Write-Host " - Server [$($mfSrv.ServerName)] is set to [$($mfSrv.WinServerObject.EnableLogon)] for EnableLogon"
  45.  
  46. Write-Host

Another option would be to remove the Apps from the Server all together.

  1. # Unpublish-CitrixServer.ps1
  2. # Brandon Shell [MVP]
  3. # www.bsonposh.com
  4. # Removes all App from Server
  5. Param($Server)
  6. $mfsrv = New-Object -ComObject MetaFrameCOM.MetaFrameServer
  7. $mfsrv.Initialize(6,$Server.ToUpper())
  8. $mfsrv | foreach{$_.Applications} | foreach{$_.LoadData(1);$_.RemoveServer($Server.ToUpper());$_.SaveData()}

Get-CitrixServerLoad (The power of objects in Citrix)

I watch the forums at BrianMadden.com because I use Powershell a lot for Citrix. This question was brought up.

Q: How could one:
- query “server load” on all servers part of the farm
- extract all server under a minimum server load
- apply an “Offline” load evaluator on the extracted servers (in order to make them unavailable on the farm)

I posted a script to do what they wanted, but then I got to thinking… while it did achieve the goal it wasn’t very Powershellish.

As I have said over and over. The glory of Powershell is the objects. So I decided to Post this entry showing what I would consider the Powershell way :)
Ideally you should just do this at the prompt

PS> Get-CitrixServers | where{$_.WinServerObject.Serverload -lt $load} | Set-CitrixLoadEvalutor “OffLine”

This is easy to achieve with the following scripts or even better make them functions!

Get-CitrixServers

  1. param($Server)
  2. $type = [System.Type]::GetTypeFromProgID("MetaframeCOM.MetaframeFarm",$Server)
  3. $mfarm = [system.Activator]::CreateInstance($type)
  4. $mfarm.Initialize(1)
  5. $mfarm.zones | foreach-Object{$_.OnlineServers}

Set-CitrixLoadEvalutor

  1. Param($server,$LoadEvaluator = "MFDefaultLE",[switch]$Verbose)
  2. #NOTE: This only work for 4.0 and 4.5
  3. if($verbose){$verbosepreference = "Continue"}
  4.  
  5. function Set-LE{
  6.     Param($mySrv)
  7.     # Getting Current LE
  8.     write-Verbose "   + Set-LE called : $($mySrv.ServerName)"
  9.     $le = $mfServer.AttachedLE
  10.     $le.LoadData(1)
  11.     Write-Verbose "     - Old Evaluator: $($le.LEName)"
  12.     Write-Verbose "     - Setting to $LoadEvaluator"
  13.  
  14.     # Assigning New LE
  15.     $mySrv.AttachLEByName($LoadEvaluator)
  16.  
  17.     # Checking LE
  18.     $le = $mySrv.AttachedLE
  19.     $le.LoadData(1)
  20.     Write-Verbose "     - Load Evaluator Set to $($le.LEName)"
  21.  
  22. }
  23.  
  24. if($Server)
  25. {
  26.     # Loading Server Object
  27.     Write-Verbose " + Processing $Server"
  28.     $type = [System.Type]::GetTypeFromProgID("MetaframeCOM.MetaframeServer",$Server)
  29.     $mfServer = [system.Activator]::CreateInstance($type)
  30.     $mfServer.Initialize(6,$Server)
  31.     Write-Verbose "   - Calling Set-LE"
  32.     Set-LE $mfServer
  33. }
  34.  
  35. if($list)
  36. {
  37.     foreach($Srv in (Get-Content $list))
  38.     {
  39.         Write-Verbose " + Processing $Srv"
  40.         # Loading Server Object
  41.         Write-Verbose "   - Getting Citrix Object"
  42.         $type = [System.Type]::GetTypeFromProgID("MetaframeCOM.MetaframeServer",$Srv)
  43.         $mfServer = [system.Activator]::CreateInstance($type)
  44.         $mfServer.Initialize(6,$Srv)
  45.         Write-Verbose "   - Calling Set-LE"
  46.         Set-LE $mfServer
  47.     }
  48. }
  49.  
  50. if($input)
  51. {
  52.     foreach($Srv in $input)
  53.     {
  54.         Write-Verbose     " + Processing $Srv"
  55.         if($Srv.ServerName)
  56.         {
  57.             Write-Verbose "   - Input is a Citrix Server: $Srv"
  58.             Write-Verbose "   - Calling Set-LE"
  59.             Set-LE $Srv
  60.         }
  61.         else
  62.         {
  63.             Write-Verbose "   - Input: $Srv"
  64.             # Loading Server Object
  65.             Write-Verbose "   - Getting Citrix Object"
  66.             $type = [System.Type]::GetTypeFromProgID("MetaframeCOM.MetaframeServer",$Srv)
  67.             $mfServer = [system.Activator]::CreateInstance($type)
  68.             $mfServer.Initialize(6,$Srv)
  69.             Write-Verbose "   - Calling Set-LE"
  70.             Set-LE $mfServer
  71.         }
  72.     }
  73. }

This was the all in one that I posted

  1. Param($Server,$minLoad = 1000,$LoadEval,[switch]$verbose)
  2. if($verbose){$verbosepreference = "continue"}
  3. function Get-CitrixFarm{
  4.     param($Srv)
  5.     $type = [System.Type]::GetTypeFromProgID("MetaframeCOM.MetaframeFarm",$Srv)
  6.     $mfarm = [system.Activator]::CreateInstance($type)
  7.     $mfarm.Initialize(1)
  8.     Write-Verbose "Loading Farm $($mFarm.FarmName)"
  9.     return $mFarm
  10. }
  11. function Set-CitrixLoadEvalutor{
  12.     Param($server,$LoadEvaluator = "MFDefaultLE")
  13.  
  14.     # Loading Server Object
  15.     $type = [System.Type]::GetTypeFromProgID("MetaframeCOM.MetaframeServer",$Server)
  16.     $mfServer = [system.Activator]::CreateInstance($type)
  17.     $mfServer.Initialize(6,$Server)
  18.  
  19.     # Getting Current LE
  20.     $le = $mfServer.AttachedLE
  21.     $le.LoadData(1)
  22.     Write-Verbose "Old Evaluator: $($le.LEName)"
  23.     Write-Verbose "Setting Load Evaluator on $server to $LoadEvaluator"
  24.  
  25.     # Assigning New LE
  26.     $mfServer.AttachLEByName($LoadEvaluator)
  27.  
  28.     # Checking LE
  29.     $le = $mfServer.AttachedLE
  30.     $le.LoadData(1)
  31.     Write-Verbose "Load Evaluator Set to $($le.LEName)"
  32. }
  33.  
  34. $farm = Get-CitrixFarm $Server
  35. foreach($ctxServer in $farm.Servers)
  36. {
  37.     $load = $ctxServer.WinServerObject.Serverload
  38.     Write-Host ("{0,-15} :: {1}" -f $ctxServer.ServerName,$load)
  39.     if($load -lt $minLoad)
  40.     {
  41.         Write-Verbose "Setting Offline Load Eval"
  42.         if($LoadEval){Set-CitrixLoadEvalutor $ctxServer.ServerName $LoadEval}
  43.     }
  44. }

Citrix Load Evaluators

I have had a few request for how to deal with Citrix Load Evaluators. There are few gotchas, but it is fairly strait forward.

There are two Built-in Citrix Load Evaluators Default and Advanced.. the problem is that from MFCom, this is not what they are called. This is what you should use.
- Default = MFDefaultLE
- Advanced = LMSDefaultLE

  1. function Set-CitrixLoadEvaluator{
  2.     Param($server = $(throw ‘$Server is Required’),$LoadEvaluator = "MFDefaultLE")
  3.  
  4.     # Loading Server Object
  5.     $type = [System.Type]::GetTypeFromProgID("MetaframeCOM.MetaframeServer",$Server)
  6.     $mfServer = [system.Activator]::CreateInstance($type)
  7.     $mfServer.Initialize(6,$Server)
  8.  
  9.     # Getting Current LE
  10.     $le = $mfServer.AttachedLE
  11.     $le.LoadData(1)
  12.     Write-Host "Old Evaluator: $($le.LEName)"
  13.     Write-Host "Setting Load Evaluator on $server to $LoadEvaluator"
  14.  
  15.     # Assigning New LE
  16.     $mfServer.AttachLEByName($LoadEvaluator)
  17.  
  18.     # Checking LE
  19.     $le = $mfServer.AttachedLE
  20.     $le.LoadData(1)
  21.     Write-Host "Load Evaluator Set to $($le.LEName)"
  22. }

Citrix functions Updated!

I didn’t have time last post to additional “Farm” functionality to some the functions. The following are updated to work against multiple farms.

Updated Server functions

  • Publish-CitrixApplication
  • UnPublish-CitrixServer
  • Remove-CitrixApplication
  • Updated Application functions

  • Get-CitrixApp
  • Get-CitrixAppUsers
  • Get-CitrixAppServers
  • Find-CitrixUser
  • Citrix Server Functions

    1. ##########################################
    2. ####     Citrix Server Functions      ####
    3. ##########################################
    4.  
    5. ## Publish Application to Server(s)
    6. ## -app: Name of Application to remove. This is required
    7. ## -Server: Name of Server
    8. ## PIPED: It will take Servers via Pipe. It expects a list or Citrix Server Object
    9. ## NOTE: App Name must include subfolders of the app.
    10. ##       If the app in in Applications\Test then app would be Test\MyApp
    11. ##       Example: Publish-CitrixApplication -server myserver -app Test\MyApp
    12. function Publish-CitrixApplication{
    13.     Param([string]$server,[string]$app)
    14.     Begin{
    15.         Write-Host
    16.         function gcs{
    17.             Param($srv)
    18.             $type = [System.Type]::GetTypeFromProgID("MetaframeCOM.MetaframeServer",$Server)
    19.             $mfServer = [system.Activator]::CreateInstance($type)
    20.             $mfServer.Initialize(6,$Server)
    21.             $mfServer
    22.         }
    23.         function gca{
    24.             Param($srv,$ma)
    25.             $type = [System.Type]::GetTypeFromProgID("MetaFrameCOM.MetaFrameApplication",$Server)
    26.             $mfApp = [system.Activator]::CreateInstance($type)
    27.             $mfApp.Initialize(3,"Applications\$ma")
    28.             $mfApp.LoadData($true)
    29.             $mfApp
    30.         }
    31.         function cPublish {
    32.             Param([string]$Srv,[string]$myapp)
    33.             $Srv = $Srv.toUpper()
    34.             $mfSrv = gcs $srv
    35.             $mfApp = gca $srv $myapp
    36.             $mfAppBinding = New-Object -ComObject MetaFrameCOM.MetaFrameAppSrvBinding
    37.             $mfAppBinding.Initialize(6,$Srv,"Applications\$app")
    38.             if($mfAppBinding)
    39.             {
    40.                 Write-Host "Publishing App[$myapp] on Server [$Srv]" -ForegroundColor Green
    41.                 $mfApp.AddServer($mfAppBinding)
    42.                 $mfApp.SaveData()
    43.             }
    44.             else
    45.             {
    46.                 Write-Host "Unable To Create App Binding" -ForegroundColor Red
    47.             }
    48.         }
    49.         $process = @()
    50.     }
    51.     Process{
    52.         if($_){
    53.             if($_.ServerName){
    54.                 $process += $_.ServerName
    55.             }
    56.             else{
    57.                 $process += $_
    58.             }
    59.         }
    60.     }
    61.     End{
    62.         if($Server){$Process += $Server}
    63.         foreach($s in $process){
    64.             cPublish -srv $s -myapp $app
    65.             Write-Host
    66.         }
    67.     }
    68. }
    69.  
    70. ## UnPublishes ALL Application from Server(s)
    71. ## -Server: Name of Server
    72. ## PIPED: It will take Servers via Pipe. It expects a list or Citrix Server Object
    73. function UnPublish-CitrixServer{
    74.     Param([string]$server)
    75.     Begin{
    76.         function gcs{
    77.             Param($srv)
    78.             $type = [System.Type]::GetTypeFromProgID("MetaframeCOM.MetaframeServer",$Server)
    79.             $mfServer = [system.Activator]::CreateInstance($type)
    80.             $mfServer.Initialize(6,$Server)
    81.             $mfServer
    82.         }
    83.         function cUnPublish {
    84.             Param([string]$Srv)
    85.             $Srv = $Srv.toUpper()
    86.             $mfSrv = gcs $srv
    87.             If($mfSrv.Applications.Count -gt 0)
    88.             {
    89.                 Write-Host "Removing All Published Applications from $Srv" -ForegroundColor Red
    90.                 Write-Host "===================================================" -ForegroundColor Green
    91.                 ForEach($a in $mfSrv.Applications)
    92.                 {
    93.                     $myApp = $a.AppName
    94.                     Write-Host "Removing App [$myApp] from Server [$Srv]" -ForegroundColor White
    95.                     $a.RemoveServer($Srv)
    96.                     $a.SaveData()
    97.                 }
    98.             }
    99.             else
    100.             {
    101.                 Write-Host "No Published Applications for $Srv" -ForegroundColor Red
    102.             }
    103.         }
    104.         Write-Host
    105.         $process = @()
    106.     }
    107.     Process{
    108.         if($_){
    109.             if($_.ServerName)
    110.             {
    111.                 $process += $_.ServerName
    112.             }
    113.             else
    114.             {
    115.                 $process += $_
    116.             }
    117.         }
    118.     }
    119.     End{
    120.         if($Server){$Process += $Server}
    121.         foreach($s in $process){
    122.             cUnPublish $s
    123.             Write-Host
    124.         }
    125.     }
    126. }
    127.  
    128. ## Remove Specific Application from Server(s)
    129. ## -app: Name of Application to remove. This is required
    130. ## -Server: Name Server.
    131. ## PIPED: It will take Servers via Pipe. It expects a list or Citrix Server Object
    132. function Remove-CitrixApplication {
    133.     Param([string]$server,[string]$app)
    134.     Begin{
    135.         function gcs{
    136.             Param($srv)
    137.             $type = [System.Type]::GetTypeFromProgID("MetaframeCOM.MetaframeServer",$Server)
    138.             $mfServer = [system.Activator]::CreateInstance($type)
    139.             $mfServer.Initialize(6,$Server)
    140.             $mfServer
    141.         }
    142.         function RemoveApp {
    143.             Param([string]$Srv,[string]$myapp)
    144.             $AppRemoved = $false
    145.             $Srv = $Srv.toUpper()
    146.             $mfSrv = gcs $srv
    147.             If($mfSrv.Applications.Count -gt 0)
    148.             {
    149.                 ForEach($a in $mfSrv.Applications)
    150.                 {
    151.                     If(($a.AppName -eq "$myapp") -or ($a.BrowserName -eq "$myapp"))
    152.                     {
    153.                         Write-Host "Removing App [$myApp] from Server [$Srv]" -ForegroundColor Green
    154.                         $a.RemoveServer($Srv)
    155.                         $a.SaveData()
    156.                         $AppRemoved = $true
    157.                     }
    158.                 }
    159.             }
    160.             else
    161.             {
    162.                 Write-Host "No Applications Published for $Srv" -ForegroundColor Red
    163.                 $AppRemoved = $true
    164.             }
    165.             If($AppRemoved -eq $false)
    166.             {
    167.                 Write-Host "This Application not Published for $Srv" -ForegroundColor Red
    168.             }
    169.         }
    170.         Write-Host
    171.         $process = @()
    172.     }
    173.     Process{
    174.         if($_)
    175.         {
    176.             if($_.ServerName){
    177.  
    178.                 $process += $_.ServerName
    179.             }
    180.             else
    181.             {
    182.                 $process += $_
    183.             }
    184.         }
    185.     }
    186.     End{
    187.         if($Server){$Process += $Server}
    188.         if($process.Length -eq 0){$Process += get-content env:COMPUTERNAME}
    189.         foreach($s in $process)
    190.         {
    191.             RemoveApp -Srv $s -myapp $app
    192.             Write-Host
    193.         }
    194.     }
    195. }

    Citrix App Functions

    1. #########################################
    2. ####     Citrix App Functions        ####
    3. #########################################
    4. ## Returns Citrix Application for Farm
    5. ## -Server: Name of Farm Server. This is required
    6. ## -App: Name of Application to remove. This is required
    7. function Get-CitrixApp{
    8.     Param($Server =$(throw ‘$Server is Required’),$App= $(throw ‘$FarmServer is Required’))
    9.     $type = [System.Type]::GetTypeFromProgID("MetaFrameCOM.MetaFrameApplication",$Server)
    10.     $mfApp = [system.Activator]::CreateInstance($type)
    11.     $mfApp.Initialize(3,"Applications\$myapp")
    12.     $mfApp.LoadData($true)
    13.     $mfApp
    14. }
    15.  
    16. ## Returns Users currently using APP
    17. ## -app: Name of Application. This is required
    18. ## -Server: Name of Farm Server. Defaults to local if not passed
    19. ## -count: Switch… if set just returns count of servers
    20. function Get-CitrixAppUsers {
    21.     Param($app = $(throw ‘$app is required’),$server,[switch]$count)
    22.     function gcf{
    23.         param($srv)
    24.         $type = [System.Type]::GetTypeFromProgID("MetaframeCOM.MetaframeFarm",$Server)
    25.         $mfarm = [system.Activator]::CreateInstance($type)
    26.         $mfarm.Initialize(1)
    27.         return $mFarm
    28.     }
    29.     $ErrorActionPreference = "SilentlyContinue"
    30.     Write-host
    31.     if($server){$mfm = gcf $server}
    32.     else{$mfm = New-Object -com MetaFrameCOM.MetaFrameFarm;$mfm.Initialize(1)}
    33.     $users = $mfm.Applications | ?{($_.AppName -eq $app) -or ($_.BrowserName -eq $app)}
    34.     $Users = $users.Sessions | sort -Property UserName
    35.     if($count){
    36.         Write-Host "Found [$($Users.Count)] Users for Application [$app]" -ForegroundColor White
    37.         Write-Host
    38.     }
    39.     else{
    40.         Write-Host ""
    41.         Write-Host "Found [$($Users.Count)] Users for Application [$app]" -ForegroundColor White
    42.         Write-Host "—————————————————–" -ForegroundColor gray
    43.         foreach($user in $Users){
    44.             If($User.SessionState -eq 1){
    45.                 Write-Host ($User.UserName).PadRight(10) -ForegroundColor Green -NoNewline
    46.             }
    47.             else{
    48.                 Write-Host ($User.UserName).PadRight(10) -ForegroundColor yellow -NoNewline
    49.             }
    50.         }
    51.         Write-Host
    52.         Write-Host "—————————————————–" -ForegroundColor gray
    53.         Write-Host "Found [$($Users.Count)] Users for Application [$app]" -ForegroundColor White
    54.         Write-Host
    55.     }
    56. }
    57.  
    58. ## Returns Servers currently published APP
    59. ## -app: Name of Application. This is required
    60. ## -Server: Name of Farm Server. Defaults to local if not passed
    61. ## -count: Switch… if set just returns count of servers
    62. function Get-CitrixAppServers {
    63.     Param($app = $(throw ‘$app is required’),$Server,[switch]$count)
    64.     function gcf{
    65.         param($srv)
    66.         $type = [System.Type]::GetTypeFromProgID("MetaframeCOM.MetaframeFarm",$Server)
    67.         $mfarm = [system.Activator]::CreateInstance($type)
    68.         $mfarm.Initialize(1)
    69.         return $mFarm
    70.     }
    71.     if($server){$mfm = gcf $server}
    72.     else{$mfm = New-Object -com MetaFrameCOM.MetaFrameFarm;$mfm.Initialize(1)}
    73.     $Apps = $mfm.Applications | ?{($_.AppName -eq $app) -or ($_.BrowserName -eq $app)}
    74.     # for XP farms
    75.     $servers = $apps | %{$_.Servers} | sort -Property ServerName | Select-Object ServerName
    76.     if(!$servers){
    77.         # for 40/45 farms
    78.         $servers = $Apps.Sessions | Select-Object ServerName | Sort-Object -unique ServerName
    79.     }
    80.     if($count)
    81.     {
    82.         Write-Host
    83.         Write-Host "Found [$($Servers.Count)] Servers for Application [$app]" -ForegroundColor White
    84.         Write-Host
    85.     }
    86.     else
    87.     {
    88.         Write-Host ""
    89.         Write-Host "Found [$($Servers.Count)] Servers for Application [$app]" -ForegroundColor White
    90.         Write-Host "———————————————–" -ForegroundColor gray
    91.         foreach($server in $servers){Write-Host "$($server.ServerName)" -ForegroundColor Green}
    92.         Write-Host "———————————————–" -ForegroundColor gray
    93.         Write-Host "Found [$($Servers.Count)] Servers for Application [$app]" -ForegroundColor White
    94.         Write-Host ""
    95.     }
    96. }
    97.  
    98. ## Returns Server(s) user is logged into via Citrix
    99. ## -LoginName: Login Name of user (Domain\User). This is Required
    100. ## -Server: Name of Farm Server. Defaults to local if not passed
    101. ## -Verbose: Details about User
    102. function Find-CitrixUser {
    103.     Param([string]$LoginName,$Server,[switch]$verbose)
    104.     $user = $LoginName.Split("\")[1]
    105.     $Domain = $LoginName.Split("\")[0]
    106.     if($server)
    107.     {
    108.         $type = [System.Type]::GetTypeFromProgID("MetaframeCOM.MetaframeUser",$Server)
    109.         $mfuser = [system.Activator]::CreateInstance($type)
    110.         $mfuser.Initialize(1,$Domain,1,$user)
    111.     }
    112.     else
    113.     {
    114.         $mfuser = New-Object -ComObject MetaframeCOM.MetaframeUser
    115.         $mfuser.Initialize(1,$Domain,1,$user)
    116.     }
    117.     Write-Host
    118.     Write-Host "User: $($mfuser.UserName) found on the Following:"
    119.     foreach ($s in $mfuser.Sessions)
    120.     {
    121.         if($verbose)
    122.         {
    123.             Write-Host
    124.             Write-Host "$($s.ServerName)"
    125.             Write-Host "-=-=-=-=-=-"
    126.             Write-Host "AppName          : $($s.AppName)" -foregroundcolor yellow
    127.             Write-Host "SessionName      : $($s.SessionName)" -foregroundcolor yellow
    128.             Write-Host "SessionID        : $($s.SessionID)" -foregroundcolor yellow
    129.             Write-Host "ClientAddress    : $($s.ClientAddress)" -foregroundcolor yellow
    130.             Write-Host "ClientEncryption : $($s.ClientEncryption)" -foregroundcolor yellow
    131.             Write-Host
    132.             Write-Host "Processes"
    133.             Write-Host "========="
    134.             foreach ($proc in $s.Processes)
    135.             {
    136.                 Write-Host $proc.ProcessName -foregroundcolor Green
    137.             }
    138.             Write-host
    139.         }
    140.         else
    141.         {
    142.             write-Host "   -> $($s.ServerName)"
    143.         }
    144.     }
    145. }