How To Remotely Administer A Citrix Farm From The PowerShell Prompt?
Author: Frank-Peter (77 Articles)
If you’re using Windows PowerShell to administrer and automate Citrix Farms the day will dawn when you ask yourself (or someone else) if it is possible to fire up the locally installed Windows PowerShell Console in order to perform a task against a Citrix Farm remotely. Yes, it is possible
In case of XenApp 6 you make use of PowerShell 2.0′s Remoting feature as follows:
# # Remote XenApp 6 w/ PowerShell 2.0 Remoting # $CitrixServer = 'ctx001' $session = New-PSSession -ComputerName $CitrixServer Enter-PSSession -Session $session Add-PSSnapin Citrix*
In case of MFCOM-based Legacy Farm Server you can either create a PowerShell Remoting Session like above or – if you still use PowerShell 1.0 you have no other choice – create a remote COM object:
#
# Remote MFCOM w/ PowerShell 2.0 Remoting
#
$CitrixServer = 'ctx001'
$session = New-PSSession -ComputerName $CitrixServer[activator]::CreateInstance($type, $null)
Enter-PSSession -Session $session
$farm = New-Object -ComObject 'MetaFrameCOM.MetaFrameFarm'
#
# Remote MFCOM w/ PowerShell 1.0 and .NET
#
$CitrixServer = 'ctx001'
$type = [type]::GetTypeFromProgID('MetaFrameCOM.MetaFrameFarm', $CitrixServer)
$farm = [activator]::CreateInstance($type, $null)