Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 180329

View PowerCLI Send-SessionLogOff Failing, but Send-SessionDisconnect Works?

$
0
0

I have a developer trying to create a utility to manage desktop sessions that are brokered by Horizon View, but is having some trouble with some PowerShell commands.

 

This line works:

 

Send-SessionDisconnect -Session_id (Get-RemoteSession -Username "{domain}\{username}").session_id

 

This one doesn't:

 

Send-SessionLogoff -Session_id (Get-RemoteSession -Username "{domain}\{username}").session_id

 

The latter results in an error as follows:

 

Send-SessionLogoff : PowershellService::SendSessionLogoff FAILED, error-Unable to log off session

({domain}\{username}()/2@....{snipped}...,ou=servers,dc=vdi,dc=vmware,dc=int.cn=ccds,ou=server

groups,dc=vdi,dc=int:CONSOLE:3389:DESKTOP):com.vmware.vdi.sessionclientapi.SessionNotActiveException

At line1:1 char:1

+ Send-SessionLogoff -Session_id (Get-RemoteSession -Username "{domain} ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo          : InvalidResult: (vmware.view.pow...ndSessionLogoff:SendSessionLogoff) [Send-SessionLogoff], Exception

+ FullyQualifiedErrorId : PowershellService::SendSessionLogoff FAILED,vmware.view.powershell.cmdlets.SendSessionLogoff

 

The test script is as follows (some detail redacted):

 

$password = ConvertTo-SecureString '{password}' -AsPLainText -Force

$cred = New-Object System.Management.Automation.PSCredential('{domain}\{domainadmin}' , $password)

$s = enter-PSSession -Computername '{ipaddress}' -Credential $cred

 

cd 'C:\Program Files\VMware\VMware View\Server\extras\PowerShell\'

.\add-snapin.ps1

 

Send-SessionLogoff -Session_id (Get-RemoteSession -Username "{domain}\{username}").session_id

 

Exit-PSSession

 

Any ideas what is going wrong?


Viewing all articles
Browse latest Browse all 180329

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>