Azure / RDS-Templates

ARM Templates for Remote Desktop Services deployments
MIT License
479 stars 607 forks source link

AutoScale Script - Failed to force log off user: 'DOMAIN\MYUSER', session ID: 19 #570

Closed desmphil closed 3 years ago

desmphil commented 3 years ago

Im having exception in the Runbook on the automation account in the TryForceLogoff on all users. When I do the same command through powershell it does logoff correctly.

Results: The VM Host is shutdown, and RDSBroken has user still connected, user cannot re-connect on the next day.

Remove-AzWvdUserSession -ResourceGroupName $ResourceGroupName -HostPoolName $HostPoolName -SessionHostName $SessionHostName -Id $SessionID -Force } } catch { Write-Log -Warn "Failed to force log off user: '$($Session.ActiveDirectoryUserName)', session ID: $SessionID $($PSItem | Format-List -Force | Out-String)" }

2020-11-03 20:42:16 [290] Failed to force log off user: 'DOMAIN\MYUSER', session ID: 19 Exception : System.Exception: [404] : Error: User session ID not found TargetObject : { SubscriptionId = , ResourceGroupName = Prod-VirtualDesktop, HostPoolName = APPS, SessionHostName = SERVER.COM, Id = 19, Force = True } CategoryInfo : InvalidOperation: ({ SubscriptionI... Force = True }:<>f__AnonymousType20`6) [Remove-AzWvdUserSession_Delete], Exception FullyQualifiedErrorId : 404,Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Cmdlets.RemoveAzWvdUserSession_Dele te ErrorDetails : ActivityId: 76b47e69-b7a5-413e-9e10-ef4b54141fa8 Error: User session ID not found InvocationInfo : System.Management.Automation.InvocationInfo ScriptStackTrace : at Remove-AzWvdUserSession, C:\Modules\User\Az.DesktopVirtualization\exports\ProxyCmdletDefinitions.ps1: line 3437 at TryForceLogOffUser, : line 286 at , : line 764 PipelineIterationInfo : {} PSMessageDetails :

2020-11-04 09_22_48-WVDAutoScaleRunbookARMBased 11_3_2020, 6_41 PM - Microsoft Azure and 3 more page

nakranimohit0 commented 3 years ago

@desmphil what's the version of the runbook script are you running ? This has been fixed in the latest version. #540

desmphil commented 3 years ago

Fixed thank you