Command Line examples

Log off from Command line
shutdown -L

Who is currently logged on to a server
query user /server:”server-name”

Ping with timestamp
ping -t|cmd /q /v /c “(pause&pause)>nul & for /l %a in () do (set /p “data=” && echo(!date! !time! !data!)&ping -n 2>nul”

Get Index content of Install.wim file
Dism /get-wiminfo /wimfile::\sources\install.wim

Check Windows Firewall status on remote computer
netsh -r laptop1 advfirewall show allprofiles

Install .NET 3.51 on Windows 8.1
Dism.exe /online /enable-feature /featurename:NetFX3 /All /Source:D:\sources\sxs /LimitAccess

Check if Repair Your Computer option is Enabled. If not, how to enable it
reagentc/info (tells you about the bootmenu and actual winre)
reagentc/enable (adds it from boot menu)
reagentc/disable (removes it from boot menu)

Check if TPM is installed (use with psexec.exe for remote computer)
c:\windows\system32\wbem\wmic.exe /namespace:\\root\CIMV2\Security\MicrosoftTPM path Win32_Tpm get /value

Location for batch scripts at start-up

Update group policy for just computer targeted GPOs
gpupdate /target:computer

Find vendor and model
wmic computersystem get model,manufacturer

Find Serial Number
wmic bios get serialnumber

Find OS Version (Windows 7/Server 2008 and later)
systeminfo | findstr /B /C:”OS Name” /C:”OS Version”

Run a batch file at boot in Windows 8 and 10 users
Create a shortcut to the batch file.
Once the shortcut has been created, right-click the file and select Cut.
Press the Start button and type Run and press enter.
In the Run window, type shell:startup to open the Startup folder.
Once the Startup folder has been opened, click the Home tab at the top of the folder and select Paste to paste the shortcut into the folder.

Enable Remote Management on Remote Complete (quietly) – requires PSTOOLS PSExec (
psexec \\ -s winrm.cmd quickconfig -q

Disable Windows Firewall via regedit
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\DomainProfile\EnableFirewall (change to zero)

Enable Remote Desktop on Windows Client
reg add “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server” /v fDenyTSConnections /t REG_DWORD /d 0 /f

Kill Process
1. Get the PID of the hung service using: sc queryex

2. Kill the specific PID: taskkill /f /pid [PID]