llarava
asked on
Get-XASession - Citrix commands must be executed at the Citrix server or using remoting. Make sure that your user accou
Running the following PS script on a Citrix server and getting the following message can someone help?
Citrix SDK cmdlet has been installed locally on the Citrix server.
Get-XASession : Citrix commands must be executed at the Citrix server or using remoting. Make sure that your user accou
nt is a Citrix administrator and that the IMA service is started.
At line:2 char:43
+ [array]$ActiveSessions = Get-XASession <<<< | Where-Object { $_.Protocol -eq "ICA" -and $_.State -eq "Active"}
+ CategoryInfo : InvalidOperation: (:) [Get-XASession], InvalidOperationException
+ FullyQualifiedErrorId : ImaInteropError,Citrix.Xen App.Comman ds.GetSess ionCmdlet
Citrix SDK cmdlet has been installed locally on the Citrix server.
Get-XASession : Citrix commands must be executed at the Citrix server or using remoting. Make sure that your user accou
nt is a Citrix administrator and that the IMA service is started.
At line:2 char:43
+ [array]$ActiveSessions = Get-XASession <<<< | Where-Object { $_.Protocol -eq "ICA" -and $_.State -eq "Active"}
+ CategoryInfo : InvalidOperation: (:) [Get-XASession], InvalidOperationException
+ FullyQualifiedErrorId : ImaInteropError,Citrix.Xen
Add-PSSnapin Citrix* -ErrorAction SilentlyContinue
Function ApplyPatchesAndReboot
{
[string]$StartExe = "c:\windows\syswow64\ApplyPatchesAndreboot.exe"
[string]$StartExeArgs = "/noreboot"
start-process $StartExe $StartExeArgs -Wait
}
do {
[array]$ActiveSessions = Get-XASession | Where-Object { $_.Protocol -eq "ICA" -and $_.State -eq "Active"}
If ($ActiveSessions.length -gt 0)
{
Start-Sleep -Seconds 1800
}
} while ($ActiveSessions.Count -gt 0 )
"Started installation" | add-content c:\temp\results.log
ApplyPatchesAndReboot
"Finished installation" | add-content c:\temp\results.log
if you dont login with citrix administrator login credentials, then you can do the following:
replace the following line :
[array]$ActiveSessions = Get-XASession | Where-Object { $_.Protocol -eq "ICA" -and $_.State -eq "Active"}
with this:
[array]$ActiveSessions = Get-XASession -Account domain\user | Where-Object { $_.Protocol -eq "ICA" -and $_.State -eq "Active"}
replace domain\userA with actual domain and username above
replace the following line :
[array]$ActiveSessions = Get-XASession | Where-Object { $_.Protocol -eq "ICA" -and $_.State -eq "Active"}
with this:
[array]$ActiveSessions = Get-XASession -Account domain\user | Where-Object { $_.Protocol -eq "ICA" -and $_.State -eq "Active"}
replace domain\userA with actual domain and username above
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
the account has to be the farm admin to execute the session data either remoting or from citrix server
find the service name "IMA Service" and right click -> start
hope you are using citrix administrator account (your login)