logoff user remotely powershell
Сделать выход на перечисленных серверах для пользователя
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# Kepman A # logoff user remotely powershell # Parametres $userName = 'user' $Servers = @('server1','server2') # RUN $Servers | %{ $sessionId = ((quser /server:$($_) | Where-Object { $_ -match $userName }) -split ' +')[2] if ($sessionId) { "Find $($_) $($sessionId), logoff..." # logoff user session &logoff $sessionId /server:$($_) } } |