Run Windows tasks from the command line

This post is intended for our field technicians and our more technical customers. Please do not run these commands unless you know what they will do.

Add a user to a group
net localgroup (group_name) (username) /add

Add a domain user to local domain group
net localgroup administrators (domainname\username) /add

Add a user to Remote Desktop group
net localgroup "Remote Desktop Users" (username) /add

Create a user
net user /add (username) (password)

Disable RDP
reg add "reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v
fDenyTSConnections /t REG_DWORD /d 1 /f

Enable RDP
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v
fDenyTSConnections /t REG_DWORD /d 0 /f

Get current CPU load
wmic cpu get loadpercentage

Get current system uptime
systeminfo | find "System Boot Time:"

Rename a PC
WMIC computersystem where caption='old_pc_name' rename new_pc_name

Set user password to never expire
WMIC USERACCOUNT WHERE "Name='username_here'" SET PasswordExpires=FALSE