Guest User

Untitled

a guest
May 25th, 2018
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. C:>qwinsta /?
  2. Display information about Remote Desktop Sessions.
  3.  
  4. QUERY SESSION [sessionname | username | sessionid]
  5. [/SERVER:servername] [/MODE] [/FLOW] [/CONNECT] [/COUNTER] [/VM]
  6.  
  7. sessionname Identifies the session named sessionname.
  8. username Identifies the session with user username.
  9. sessionid Identifies the session with ID sessionid.
  10. /SERVER:servername The server to be queried (default is current).
  11. /MODE Display current line settings.
  12. /FLOW Display current flow control settings.
  13. /CONNECT Display current connect settings.
  14. /COUNTER Display current Remote Desktop Services counters information.
  15. /VM Display information about sessions within virtual machines.
  16.  
  17.  
  18. C:>logoff /?
  19. Terminates a session.
  20.  
  21. LOGOFF [sessionname | sessionid] [/SERVER:servername] [/V] [/VM]
  22.  
  23. sessionname The name of the session.
  24. sessionid The ID of the session.
  25. /SERVER:servername Specifies the Remote Desktop server containing the user
  26. session to log off (default is current).
  27. /V Displays information about the actions performed.
  28. /VM Logs off a session on server or within virtual machine. The unique ID of the session needs to be specified.
  29.  
  30. @ECHO OFF
  31. :: Script to log a user off a remote machine
  32. ::
  33. :: Param 1: The machine
  34. :: Param 2: The username
  35.  
  36. psexec \%1 qwinsta | grep %2 | sed 's/console//' | awk '{print $2}' > %tmp%sessionid.txt
  37. set /p sessionid=< %tmp%sessionid.txt
  38. del /q %tmp%sessionid.txt
  39. psexec \%1 logoff %sessionid% /v
  40.  
  41. import-module activedirectory
  42. set-aduser -identity "username" -accountexperationdate "12:09 pm"
  43.  
  44. set-aduser -identity "username" -enabled $false
  45.  
  46. shutdown -m "\computername" -l
  47.  
  48. logoff 1 /SEVER:computername
  49.  
  50. C:> wmic /node:[IPaddr] /user:[Admin] /password:[password] process call
  51. create "net user [user] [NewPassword]"
  52.  
  53. C:> wmic /node:[IPaddr] /user:[Admin] /password:[password] process call
  54. create "net user [user] /active:no"
  55.  
  56. C:> wmic /node:[IPaddr] /user:[Admin] /password:[password] process call
  57. create "tsdiscon"
Add Comment
Please, Sign In to add comment