Commands: Difference between revisions

No edit summary
Line 5: Line 5:
The ipconfig command is a command-line utility used to display and manage the IP address assigned to a machine.
The ipconfig command is a command-line utility used to display and manage the IP address assigned to a machine.


== ipconfig ==
== ipconfig [CMD] ==
  ipconfig
  ipconfig
Displays the basic TCP/IP configuration for all adapters.
Displays the basic TCP/IP configuration for all adapters.


== ipconfig /all ==
== ipconfig /all [CMD] ==
  ipconfig /all
  ipconfig /all
Displays the full TCP/IP configuration for all adapters.
Displays the full TCP/IP configuration for all adapters.


== ipconfig /release ==
== ipconfig /release [CMD] ==
  ipconfig /release
  ipconfig /release
Releases the IP address assigned to the computer.
Releases the IP address assigned to the computer.


== ipconfig /renew ==
== ipconfig /renew [CMD] ==
  ipconfig /renew
  ipconfig /renew
Renews the IP address assigned to the computer.
Renews the IP address assigned to the computer.


== ipconfig /flushdns ==
== ipconfig /flushdns [CMD] ==
  ipconfig /flushdns
  ipconfig /flushdns
Purges the DNS resolver cache.
Purges the DNS resolver cache.


== ipconfig /registerdns ==
== ipconfig /registerdns [CMD] ==
  ipconfig /registerdns
  ipconfig /registerdns
Refreshes DHCP leases and re-registers DNS names.
Refreshes DHCP leases and re-registers DNS names.


== ipconfig /displaydns ==
== ipconfig /displaydns [CMD] ==
  ipconfig /displaydns
  ipconfig /displaydns
Displays DNS cache contents.
Displays DNS cache contents.


== ipconfig (IPv6 & advanced) ==
== ipconfig (IPv6 & advanced) [CMD] ==
  ipconfig /allcompartments
  ipconfig /allcompartments
  ipconfig /release6
  ipconfig /release6
Line 45: Line 45:
= Windows Repair (USE THIS IF WINDOWS IS ACTING UP HELLA WEIRD) =
= Windows Repair (USE THIS IF WINDOWS IS ACTING UP HELLA WEIRD) =


== DISM RestoreHealth ==
== DISM RestoreHealth [CMD/PowerShell] ==
  DISM /Online /Cleanup-Image /RestoreHealth
  DISM /Online /Cleanup-Image /RestoreHealth


== SFC Scan (run after DISM) ==
== SFC Scan (run after DISM) [CMD/PowerShell] ==
  SFC /scannow
  SFC /scannow


== SFC Scan (after reboot) ==
== SFC Scan (after reboot) [CMD/PowerShell] ==
  SFC /scannow
  SFC /scannow


= Reset Internet Settings (G.O.A.T.) =
= Reset Internet Settings (G.O.A.T.) [CMD] =
  RunDll32.exe InetCpl.cpl,ResetIEtoDefaults
  RunDll32.exe InetCpl.cpl,ResetIEtoDefaults


= Network Drive Management =
= Network Drive Management =


== List Mapped Drives ==
== List Mapped Drives [CMD/PowerShell] ==
  net use
  net use


== Remove Mapping ==
== Remove Mapping [CMD/PowerShell] ==
  net use <drive letter>: /delete
  net use <drive letter>: /delete


== Recreate Mapping ==
== Recreate Mapping [CMD/PowerShell] ==
  net use <drive letter>: \\server\share /persistent:yes
  net use <drive letter>: \\server\share /persistent:yes


== Delete All Mappings ==
== Delete All Mappings [CMD/PowerShell] ==
  net use * /delete
  net use * /delete


== Persistently Map Drive ==
== Persistently Map Drive [CMD/PowerShell] ==
  net use /persistent:yes h: \\VBoxSvr\Win11\Documents
  net use /persistent:yes h: \\VBoxSvr\Win11\Documents


= User Management =
= User Management =


== Create Local User ==
== Create Local User [CMD] ==
  net user "user.name" password /add
  net user "user.name" password /add


== Add to Administrators ==
== Add to Administrators [CMD] ==
  net localgroup administrators "user.name" /add
  net localgroup administrators "user.name" /add


== Remove from Administrators ==
== Remove from Administrators [CMD] ==
  net localgroup administrators "user.name" /delete
  net localgroup administrators "user.name" /delete


== Delete User ==
== Delete User [CMD] ==
  net user "user.name" /delete
  net user "user.name" /delete


== Disable Built-in Accounts ==
== Disable Built-in Accounts [CMD] ==
  net user "Administrator" /active:no
  net user "Administrator" /active:no
  net user "Guest" /active:no
  net user "Guest" /active:no
Line 94: Line 94:
= Power & System =
= Power & System =


== Disable Hibernation ==
== Disable Hibernation [CMD/PowerShell] ==
  powercfg.exe /Hibernate off
  powercfg.exe /Hibernate off


== Compact OS ==
== Compact OS [CMD/PowerShell] ==
  Compact.exe /CompactOS:always
  Compact.exe /CompactOS:always


== Rename Computer ==
== Rename Computer [PowerShell] ==
  Rename-Computer -NewName "YourNewHostname"
  Rename-Computer -NewName "YourNewHostname"


= Sessions =
= Sessions =


== List Sessions ==
== List Sessions [CMD] ==
  query session
  query session


== Logoff Session ==
== Logoff Session [CMD] ==
  logoff {number}
  logoff {number}


= Windows Fixes =
= Windows Fixes =


== Fix Windows 11 Right Click ==
== Fix Windows 11 Right Click [CMD/PowerShell] ==
  reg.exe add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve
  reg.exe add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve


== Fix Edge Alt Key ==
== Fix Edge Alt Key [CMD/PowerShell] ==
  reg add HKLM\SOFTWARE\Policies\Microsoft\Edge /v ConfigureKeyboardShortcuts /d {"disabled":["focus_settings_and_more"]}
  reg add HKLM\SOFTWARE\Policies\Microsoft\Edge /v ConfigureKeyboardShortcuts /d {"disabled":["focus_settings_and_more"]}


== Disable Widgets ==
== Disable Widgets [CMD/PowerShell] ==
  reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v TaskbarDa /t REG_DWORD /d 0
  reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v TaskbarDa /t REG_DWORD /d 0


== Fix Windows Update Missing ==
== Fix Windows Update Missing [CMD/PowerShell] ==
  reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v SettingsPageVisibility /f
  reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v SettingsPageVisibility /f


= Active Directory =
= Active Directory =


== Check Password Expiry ==
== Check Password Expiry [PowerShell] ==
  Get-ADUser -identity INSERTclientUSERNAMEHERE -properties PasswordLastSet, PasswordExpired, PasswordNeverExpires | ft Name, PasswordLastSet, PasswordExpired, PasswordNeverExpires
  Get-ADUser -identity INSERTclientUSERNAMEHERE -properties PasswordLastSet, PasswordExpired, PasswordNeverExpires | ft Name, PasswordLastSet, PasswordExpired, PasswordNeverExpires


== Force AD Sync ==
== Force AD Sync [PowerShell] ==
  start-adsyncsynccycle -policytype delta
  start-adsyncsynccycle -policytype delta


== Join Domain ==
== Join Domain [PowerShell] ==
  add-computer -domainname "YourDomainName" -restart
  add-computer -domainname "YourDomainName" -restart


= Apps & Installation =
= Apps & Installation =


== Install New Teams ==
== Install New Teams [PowerShell] ==
  Add-ProvisionedAppPackage -Online -PackagePath "MSTeams-x64.msix" -SkipLicense
  Add-ProvisionedAppPackage -Online -PackagePath "MSTeams-x64.msix" -SkipLicense


== Install OpenSSH ==
== Install OpenSSH [PowerShell] ==
  Add-WindowsCapability -Online -Name OpenSSH.Server[[Special:Contributions/170.55.73.212|170.55.73.212]] 23:52, 23 March 2026 (UTC)0.0.1.0
  Add-WindowsCapability -Online -Name OpenSSH.Server[[Special:Contributions/170.55.73.212|170.55.73.212]] 00:01, 24 March 2026 (UTC)0.0.1.0


== Install RSAT ==
== Install RSAT [PowerShell] ==
  Get-WindowsCapability -Name RSAT* -Online | Add-WindowsCapability -Online
  Get-WindowsCapability -Name RSAT* -Online | Add-WindowsCapability -Online


== Install Vim (System Wide) ==
== Install Vim (System Wide) [PowerShell] ==
  mkdir vim-install; cd vim-install; $ProgressPreference = 'SilentlyContinue'; Invoke-Webrequest -UseBasicParsing https://github.com/vim/vim-win32-installer/releases/download/v9.1.0/gvim_9.1.0_x86_signed.zip -o gvim.zip; Expand-Archive -Path gvim.zip -DestinationPath .; cp .\vim\vim91\vim.exe C:\windows\system32\vim.exe
  mkdir vim-install; cd vim-install; $ProgressPreference = 'SilentlyContinue'; Invoke-Webrequest -UseBasicParsing https://github.com/vim/vim-win32-installer/releases/download/v9.1.0/gvim_9.1.0_x86_signed.zip -o gvim.zip; Expand-Archive -Path gvim.zip -DestinationPath .; cp .\vim\vim91\vim.exe C:\windows\system32\vim.exe


== Install Vim (User Only) ==
== Install Vim (User Only) [PowerShell] ==
  mkdir vim-install; cd vim-install; $ProgressPreference = 'SilentlyContinue'; Invoke-Webrequest -UseBasicParsing https://github.com/vim/vim-win32-installer/releases/download/v9.1.0/gvim_9.1.0_x86_signed.zip -o gvim.zip; Expand-Archive -Path gvim.zip -DestinationPath .; cp .\vim\vim91\vim.exe $env:LOCALAPPDATA\Microsoft\WindowsApps\vim.exe
  mkdir vim-install; cd vim-install; $ProgressPreference = 'SilentlyContinue'; Invoke-Webrequest -UseBasicParsing https://github.com/vim/vim-win32-installer/releases/download/v9.1.0/gvim_9.1.0_x86_signed.zip -o gvim.zip; Expand-Archive -Path gvim.zip -DestinationPath .; cp .\vim\vim91\vim.exe $env:LOCALAPPDATA\Microsoft\WindowsApps\vim.exe


== Install Git ==
== Install Git [PowerShell] ==
  winget install --id Git.Git -e --source winget --scope user
  winget install --id Git.Git -e --source winget --scope user


= Services =
= Services =


== List Services ==
== List Services [PowerShell] ==
  Get-Service
  Get-Service


== Set Auto Start ==
== Set Auto Start [PowerShell] ==
  Set-Service -Name {servicename} -StartupType Automatic
  Set-Service -Name {servicename} -StartupType Automatic


== Manage Service ==
== Manage Service [PowerShell] ==
  Start-Service {servicename}
  Start-Service {servicename}
  Stop-Service {servicename}
  Stop-Service {servicename}
Line 171: Line 171:
= Networking (Advanced) =
= Networking (Advanced) =


== Remove Default Gateway ==
== Remove Default Gateway [PowerShell] ==
  Remove-NetRoute -InterfaceAlias "{get this name from Get-NetAdapter}" -DestinationPrefix 0.0.0.0/0
  Remove-NetRoute -InterfaceAlias "{get this name from Get-NetAdapter}" -DestinationPrefix 0.0.0.0/0


== Set IP Address ==
== Set IP Address [PowerShell] ==
  Get-NetAdapter -Name '{get this name from Get-NetAdapter}' | New-NetIPAddress -IPAddress {newIP} -PrefixLength {cidr}
  Get-NetAdapter -Name '{get this name from Get-NetAdapter}' | New-NetIPAddress -IPAddress {newIP} -PrefixLength {cidr}


== Allow Ping ==
== Allow Ping [CMD/PowerShell] ==
  netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=allow
  netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=allow


== Show WiFi Passwords ==
== Show WiFi Passwords [CMD] ==
  for /f "skip=9 tokens=1,2 delims=:" %i in ('netsh wlan show profiles') do @if "%j" NEQ "" (echo SSID: %j & netsh wlan show profiles %j key=clear | findstr "Key Content")
  for /f "skip=9 tokens=1,2 delims=:" %i in ('netsh wlan show profiles') do @if "%j" NEQ "" (echo SSID: %j & netsh wlan show profiles %j key=clear | findstr "Key Content")


== Disable WiFi Scanning ==
== Disable WiFi Scanning [CMD/PowerShell] ==
  netsh wlan set autoconfig enabled=no interface="Wi-Fi"
  netsh wlan set autoconfig enabled=no interface="Wi-Fi"


== Enable WiFi Scanning ==
== Enable WiFi Scanning [CMD/PowerShell] ==
  netsh wlan set autoconfig enabled=yes interface="Wi-Fi"
  netsh wlan set autoconfig enabled=yes interface="Wi-Fi"


= Storage & Files =
= Storage & Files =


== Resize VHD ==
== Resize VHD [PowerShell] ==
  resize-vhd -path "f:\Shares\profiledisks" -Sizebytes 30GB
  resize-vhd -path "f:\Shares\profiledisks" -Sizebytes 30GB


== Robocopy Migration ==
== Robocopy Migration [CMD/PowerShell] ==
  robocopy "C:\users\awesome.guy" "D:\users\awesome.guy" /E /COPYALL /zb /r:10 /w:10 /tee /unilog+:"D:\robocopylog.txt"
  robocopy "C:\users\awesome.guy" "D:\users\awesome.guy" /E /COPYALL /zb /r:10 /w:10 /tee /unilog+:"D:\robocopylog.txt"


= DNS & Group Policy =
= DNS & Group Policy =


== Add DNS Suffix ==
== Add DNS Suffix [PowerShell] ==
  Set-DnsClientGlobalSetting -SuffixSearchList @("corp.mariocorp.com")
  Set-DnsClientGlobalSetting -SuffixSearchList @("corp.mariocorp.com")


== Force GP Update ==
== Force GP Update [CMD/PowerShell] ==
  gpupdate.exe /force
  gpupdate.exe /force


= Misc =
= Misc =


== Firefox Profile Manager ==
== Firefox Profile Manager [CMD/PowerShell] ==
  "C:\Program Files\Mozilla Firefox\firefox.exe" --ProfileManager
  "C:\Program Files\Mozilla Firefox\firefox.exe" --ProfileManager


== Ping with Timestamp ==
== Ping with Timestamp [PowerShell] ==
  ping google.com -t | % { "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') $_" }
  ping google.com -t | % { "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') $_" }

Revision as of 00:01, 24 March 2026

This page includes both cmd and powershell commands, realistically, all of them should run from powershell anyway.

IP Configuration (ipconfig)

The ipconfig command is a command-line utility used to display and manage the IP address assigned to a machine.

ipconfig [CMD]

ipconfig

Displays the basic TCP/IP configuration for all adapters.

ipconfig /all [CMD]

ipconfig /all

Displays the full TCP/IP configuration for all adapters.

ipconfig /release [CMD]

ipconfig /release

Releases the IP address assigned to the computer.

ipconfig /renew [CMD]

ipconfig /renew

Renews the IP address assigned to the computer.

ipconfig /flushdns [CMD]

ipconfig /flushdns

Purges the DNS resolver cache.

ipconfig /registerdns [CMD]

ipconfig /registerdns

Refreshes DHCP leases and re-registers DNS names.

ipconfig /displaydns [CMD]

ipconfig /displaydns

Displays DNS cache contents.

ipconfig (IPv6 & advanced) [CMD]

ipconfig /allcompartments
ipconfig /release6
ipconfig /renew6
ipconfig /showclassid
ipconfig /setclassid
ipconfig /showclassid6
ipconfig /setclassid6
ipconfig /flushdns6

Windows Repair (USE THIS IF WINDOWS IS ACTING UP HELLA WEIRD)

DISM RestoreHealth [CMD/PowerShell]

DISM /Online /Cleanup-Image /RestoreHealth

SFC Scan (run after DISM) [CMD/PowerShell]

SFC /scannow

SFC Scan (after reboot) [CMD/PowerShell]

SFC /scannow

Reset Internet Settings (G.O.A.T.) [CMD]

RunDll32.exe InetCpl.cpl,ResetIEtoDefaults

Network Drive Management

List Mapped Drives [CMD/PowerShell]

net use

Remove Mapping [CMD/PowerShell]

net use <drive letter>: /delete

Recreate Mapping [CMD/PowerShell]

net use <drive letter>: \\server\share /persistent:yes

Delete All Mappings [CMD/PowerShell]

net use * /delete

Persistently Map Drive [CMD/PowerShell]

net use /persistent:yes h: \\VBoxSvr\Win11\Documents

User Management

Create Local User [CMD]

net user "user.name" password /add

Add to Administrators [CMD]

net localgroup administrators "user.name" /add

Remove from Administrators [CMD]

net localgroup administrators "user.name" /delete

Delete User [CMD]

net user "user.name" /delete

Disable Built-in Accounts [CMD]

net user "Administrator" /active:no
net user "Guest" /active:no

Power & System

Disable Hibernation [CMD/PowerShell]

powercfg.exe /Hibernate off

Compact OS [CMD/PowerShell]

Compact.exe /CompactOS:always

Rename Computer [PowerShell]

Rename-Computer -NewName "YourNewHostname"

Sessions

List Sessions [CMD]

query session

Logoff Session [CMD]

logoff {number}

Windows Fixes

Fix Windows 11 Right Click [CMD/PowerShell]

reg.exe add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve

Fix Edge Alt Key [CMD/PowerShell]

reg add HKLM\SOFTWARE\Policies\Microsoft\Edge /v ConfigureKeyboardShortcuts /d {"disabled":["focus_settings_and_more"]}

Disable Widgets [CMD/PowerShell]

reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v TaskbarDa /t REG_DWORD /d 0

Fix Windows Update Missing [CMD/PowerShell]

reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v SettingsPageVisibility /f

Active Directory

Check Password Expiry [PowerShell]

Get-ADUser -identity INSERTclientUSERNAMEHERE -properties PasswordLastSet, PasswordExpired, PasswordNeverExpires | ft Name, PasswordLastSet, PasswordExpired, PasswordNeverExpires

Force AD Sync [PowerShell]

start-adsyncsynccycle -policytype delta

Join Domain [PowerShell]

add-computer -domainname "YourDomainName" -restart

Apps & Installation

Install New Teams [PowerShell]

Add-ProvisionedAppPackage -Online -PackagePath "MSTeams-x64.msix" -SkipLicense

Install OpenSSH [PowerShell]

Add-WindowsCapability -Online -Name OpenSSH.Server170.55.73.212 00:01, 24 March 2026 (UTC)0.0.1.0

Install RSAT [PowerShell]

Get-WindowsCapability -Name RSAT* -Online | Add-WindowsCapability -Online

Install Vim (System Wide) [PowerShell]

mkdir vim-install; cd vim-install; $ProgressPreference = 'SilentlyContinue'; Invoke-Webrequest -UseBasicParsing https://github.com/vim/vim-win32-installer/releases/download/v9.1.0/gvim_9.1.0_x86_signed.zip -o gvim.zip; Expand-Archive -Path gvim.zip -DestinationPath .; cp .\vim\vim91\vim.exe C:\windows\system32\vim.exe

Install Vim (User Only) [PowerShell]

mkdir vim-install; cd vim-install; $ProgressPreference = 'SilentlyContinue'; Invoke-Webrequest -UseBasicParsing https://github.com/vim/vim-win32-installer/releases/download/v9.1.0/gvim_9.1.0_x86_signed.zip -o gvim.zip; Expand-Archive -Path gvim.zip -DestinationPath .; cp .\vim\vim91\vim.exe $env:LOCALAPPDATA\Microsoft\WindowsApps\vim.exe

Install Git [PowerShell]

winget install --id Git.Git -e --source winget --scope user

Services

List Services [PowerShell]

Get-Service

Set Auto Start [PowerShell]

Set-Service -Name {servicename} -StartupType Automatic

Manage Service [PowerShell]

Start-Service {servicename}
Stop-Service {servicename}
Restart-Service {servicename}

Networking (Advanced)

Remove Default Gateway [PowerShell]

Remove-NetRoute -InterfaceAlias "{get this name from Get-NetAdapter}" -DestinationPrefix 0.0.0.0/0

Set IP Address [PowerShell]

Get-NetAdapter -Name '{get this name from Get-NetAdapter}' | New-NetIPAddress -IPAddress {newIP} -PrefixLength {cidr}

Allow Ping [CMD/PowerShell]

netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=allow

Show WiFi Passwords [CMD]

for /f "skip=9 tokens=1,2 delims=:" %i in ('netsh wlan show profiles') do @if "%j" NEQ "" (echo SSID: %j & netsh wlan show profiles %j key=clear | findstr "Key Content")

Disable WiFi Scanning [CMD/PowerShell]

netsh wlan set autoconfig enabled=no interface="Wi-Fi"

Enable WiFi Scanning [CMD/PowerShell]

netsh wlan set autoconfig enabled=yes interface="Wi-Fi"

Storage & Files

Resize VHD [PowerShell]

resize-vhd -path "f:\Shares\profiledisks" -Sizebytes 30GB

Robocopy Migration [CMD/PowerShell]

robocopy "C:\users\awesome.guy" "D:\users\awesome.guy" /E /COPYALL /zb /r:10 /w:10 /tee /unilog+:"D:\robocopylog.txt"

DNS & Group Policy

Add DNS Suffix [PowerShell]

Set-DnsClientGlobalSetting -SuffixSearchList @("corp.mariocorp.com")

Force GP Update [CMD/PowerShell]

gpupdate.exe /force

Misc

Firefox Profile Manager [CMD/PowerShell]

"C:\Program Files\Mozilla Firefox\firefox.exe" --ProfileManager

Ping with Timestamp [PowerShell]

ping google.com -t | % { "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') $_" }