Skip to main content

CLI

Common Commands​

About

Some frequently used command that comes in handy.

To know more, you can run:

help

Create user profile​

  1. Run the ff: command to determine your profile path:
$profile
  1. Create a file name Microsoft.PowerShell_profile.ps1

  2. Alternatively, you can download this example.

Enable / Disable - Superadmin​

More
Net user administrator /active:yes
Net user administrator /active:no

Network​

Note

This requires elevated / admin access and must be execute in the exact order.

Here's an extended command that might be helpful in fix issues with network.

ipconfig /release
ipconfig /flushdns
ipconfig /renew
netsh int ip reset
netsh winsock reset

Restart comupter.

Status and Reports
netsh interface show interface
netsh wlan show wlanreport
netsh interface ip show dnsservers

Local Machine​

Check for disk errors

DISM /Online /Cleanup-Image /ScanHealth
DISM /Online /Cleanup /RestoreHealth

Upgrades​

Note

This only applies for Windows 10 only.

Pro to Enterprise (Windows 10)​

STEP 1 - Run cmd as administrator

slmgr /ipk {choose_license_key_below}
EditionProduct Key
ProfessionalW269N-WFGWX-YVC9B-4J6C9-T83GX
Professional NMH37W-N47XK-V7XM9-C7227-GCQG9
EducationNW6C2-QMPVW-D7KKK-3GKT6-VCFB2
Education N2WH4N-8QGBV-H22JP-CT43Q-MDWWJ
EnterpriseNPPR9-FWDCX-D2C8J-H872K-2YT43
Enterprise NDPH2V-TTNVB-4X9Q3-TJR4H-KHJW4

STEP 2 - Connect to KMS server

slmgr /skms kms8.msguides.com

STEP 3 - Activation

slmgr /ato

STEP 4 - Confirm activation via winver using run.


Office 2021 LTSC​

STEP 1 - Run cmd as administrator

cd C:\Program Files\Microsoft Office\Office16
cd /d %ProgramFiles(x86)%\Microsoft Office\Office16

OPTIONAL: This optional step only applies if you don't have a Volume license installed in your machine.

for /f %x in ('dir /b ..\root\Licenses16\ProPlus2021VL_KMS*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%x"

STEP 2 - Activate

cscript ospp.vbs /setprt:1688
cscript ospp.vbs /unpkey:6F7TH >nul
cscript ospp.vbs /inpkey:FXYTK-NJJ8C-GB6DW-3DYQT-6F7TH
cscript ospp.vbs /sethst:e8.us.to
cscript ospp.vbs /act
Check License

For OEM.

wmic path softwarelicensingservice get OA3xOriginalProductKey
  • For Volumes. Check Host.
slmgr.vbs /dli
  • Disable KMS host caching:
slmgr.vbs /ckhc
  • Enable KMS host cahing:
slmgr.vbs /skhc