Last active
November 22, 2021 12:04
-
-
Save viniciusmelocodes/6538d6c7f0274a3475d5ffca6a624e00 to your computer and use it in GitHub Desktop.
Logoff de usuário em PowerShell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
quser | Select-Object -Skip 1 | ForEach-Object { | |
$id = ($_ -split ' +')[-5] | |
$sessioname = ($_ -split ' +')[-4] | |
# Apenas faz logoff dos usuários desconectados | |
if ($sessioname -eq 'Disco') { | |
#Write-Host $id | |
#Write-Host $sessioname | |
logoff $id | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment