Some nice one-liners

  • Restart the computer you are logged on to immediately, forcing all applications to close:
    shutdown.exe /r /t 0 /f
  • The same for a remote computer:
    shutdown.exe /r /t 0 /f /m \<computer>
  • Add someone to the local Administrators groups:
    net localgroup Administrators /add <user or group>
  • Enable Remote Desktop on a remote system:
    reg add “\<computername>HKLMSYSTEMCurrentControlSetControlTerminal Server” /v fDenyTSConnections /d 0 /t REG_DWORD /f
  • Schedule a reboot of the system you are logged on to (works on Windows Server 2003):
    schtasks.exe /Create /RU “NT AUTHORITYSYSTEM” /SC ONCE /TN “Restart” /TR “%systemroot%system32shutdown.exe /r /t 0 /f” /ST 22:00 /Z
  • Schedule a reboot of the system you are logged on to (works on Windows Server 2008 and later):
    schtasks.exe /create /TN “Restart” /SC Once /ST 23:00 /TR “%windir%system32shutdown.exe /r /t 0 /f” /RU “SYSTEM”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.