Skip to content

Commands

Useful Commands for Windows 10, Linux, PowerShell, VSCode, Text/PDF editing etc.
Short URL for this page: https://1iq.uk/c
Last Updated: 18/12/2020

LanguageNameCommandDescription
PowerShellNew IP Address
New-NetIPAddress –InterfaceIndex 21 IPAddress “192.168.0.7” –PrefixLength 24 -DefaultGateway 192.168.0.11
Sets the IP of the NIC
PowerShellIP Address
Get-NetIPAddress
Returns the IP Address. You can find the InterfaceIndex and Alias using this
PowerShellSet DNS
Set-DnsClientServerAddress -InterfaceIndex 21 -ServerAddresses 192.168.0.1, 192.168.0.2
Sets the DNS 1 and 2 of the NIC
PowerShellRun PS as Admin quick way
Start > Type powershell in start box > Ctrl+Shift+Enter OR WinKey+X,A OR Add Icon to Taskbar press Ctrl+Shift+Click (this is faster)
Opens PowerShell as administrator
PowerShellOpen %TEMP% folder in explorer
Invoke-Item $env:temp
Opens the Temp path in explorer. ii can be used for short
WindowsWindows ExplorerexplorerOpen Win Explorer from Run
WindowsWindows Firewallfirewall.cplOpens Win Firewall
WindowsSystem Propertiessysdm.cplSystem Properties
WindowsNew Explorer Window of current WindowCtrl+N
WindowsRun CMD as administrator quick wayStart > Type cmd in start box > Ctrl+Shift+Enter
WindowsDisplay the System Properties dialog boxWinKey+Break
WindowsView the properties for the selected itemALT+ENTER
WindowsRestart computer without countdownShutdown -r -t 00
WindowsTask Managertaskmgr
WindowsServicesservices.msc
WindowsRemote Desktopmstsc
WindowsRegistryregedit
WindowsRegional Settingsintl.cpl
WindowsPrinters folderprinters
WindowsPower Configurationpowercfg.cpl
WindowsNetwork Connectionscontrol netconnections
WindowsNetwork Connectionsncpa.cpl
WindowsUser Accounts Basiccontrol userpasswords
WindowsUser Accounts Advancedcontrol userpasswords2
Group PolicyForce Policy Updategpupdate /forceThis can be done on machine on each end
Group PolicyShow Applied Policiesrsop.mscshow set of policies that are applied
SSHSwitch on ESXi Server Command
putty -ssh ip address
Power - check status
Power on - switch on server
SSHShutdown server
plink -ssh -2 -pw Windows1 root@192.168.0.10 "/sbin/shutdown.sh && /sbin/poweroff"
shuts VMs safely and then the ESXi server
Server DCtest DCdcdiag /s:vmlab.local /q
dcdiag /?
Analysis of problems in a forest and reports problems
ServerAD Admin Centerdsac.exeStarts AD Admin Center
VirtualboxRDP to VM192.168.56.1:3389Enable Remote display in settings > display
VirtualboxStart VM headlessvboxheadless -s Win10_1803Starts the VM without a GUI so it can be RDP'd
WindowsCreate 2x2 Grid of WindowsWin key + left then Win key+up. Do the same again but with other directions to make into 2x2 gridThis could be win explorer, browser, word or any windows. Combine with Winkey+E to make quick explorer windows
WindowsNew DesktopWinkey+tab > click new desktopdrag windows onto the desktop to move them into it
WindowsSwitch between desktopsCtrl+Winkey+left/rightswitch between virtual desktops that are enabled
WindowsNew virtual desktopWinkey+ctrl+dCreates a new virtual desktop on win10
WindowsClose virtual desktopWinkey+ctrl+F4Close the virtual desktop
WindowsMore options on files/folders in ExplorerShift+right click file/folderDisplays more options and Send to options
WindowsSaves Search and optionsStart typing search > click search on ribbon > save search to fileLets you save searches and repeat them by clicking the saved file
WindowsSearch Tips in Explorerexample:
type:word datemodified:last week or thisweek
This is useful to trace a file if you forgot the name or have a lot of files
WindowsPrntScrn direct to pictures folderWinkey+PrntscrnThis saves the image direct to the pictures folder
WindowsGame DVRSearch Game DVR in Settings AppThis lets you record your game and desktop screen
Web browserGo back or forwardAlt+Left, Alt+Rightmoves back or forward 1 page
Web browserNew tabCtrl+click linkOpens the link in new tab
Web browserChoose TabAlt + number of the tab1,2,3,4 etc
Web browserUndo close tabCtrl+Shift+T
VirtualboxCommand optionsVBoxManageFull list is displayed or visit this link:
https://www.virtualbox.org/manual/ch08.html
VirtualboxList VMs and Running VMsvboxmanage list runningvms
VirtualboxStart a VMvboxmanage startvm Win10_1803 --type headlessstarts in headless mode, no GUI. VM Name is case sensitive
VirtualboxInfo of VMvboxmanage showvminfo Win10_1803Detailed info
VirtualboxOptions for controlling VM
Pause/Resume/Stop VM
vboxmanage controlvm
vboxmanage controlvm Win10_1803 pause --type headless
vboxmanage controlvm Win10_1803 resume --type headless
vboxmanage controlvm Win10_1803 resume --type headless
Enter controlvm for full list of options
PowershellPS Version
$PSVersionTable.PSVersion
$PSVersionTable show more details
PowershellHelp for any cmdlet
1. Get-Help Get-* 2. Get-Help Get-Help
Use * to locate specific cmdlets
PowershellExecution Policy
Get-ExecutionPolicy
RemoteSigned default allows local scripts to run
PowershellList Services
Get-Service
PowershellAllow PS Remoting
Enable-PSRemoting
Allows access to local machine with PS
PowershellConverts to HTML
Get-Service | ConvertTo-HTML -Property Name, Status > C:\services.htm
Sends output to HTML file
PowershellStop Process
1. stop-process -id 2508 2. stop-process -name notepad
Ends the task/process
PowershellExport Csv
get-service | export-csv c:\services.csv
exports to a csv file
PowershellSelect Objects
Get-Service | Select-Object Name, Status | Export-CSV c:\service.csv 
Get specific objects only for a cleaner file
PowershellGet Member of objects
get-process | gm
Gets properties of objects
PowershellGet-Command
get-command convertto*
Lets you find all commands
PowershellUse More if too much output
get-process | more
displays info 1 page at a time
PowershellWhere Object and backtick
Get-Process ` | Where-Object {$_.company -Notlike '*Microsoft*'}` | Format-Table ProcessName, Company -auto
` backtick at end allows you to continue cmdlet on next line
PowershellDisplay get commands
Get-Command -Verb get | Get-Help | Select-Object name, synopsis | convertTo-Html > c:\helpcommands.htm
Outputs the get commands as a list in html file
PowershellAlias list
Get-Alias or gal
All short versions of commands
PS Core 6Add Cmdlets from Powershell
1. Install-Module WindowsPSModulePath -Force 2. Add-WindowsPSModulePath
This will allow you to use Get-NetAdapter etc.
VirtualboxSwitch work spacesCtrl+Alt+Up Arrow
Ctrl+Alt+Left/Right
Drag windows between workspaces and switch between them
AtomRemove blank linesFind > \n+, Replace with \nRegex expression
AtomSelect edit multiple linesHold Alt+Shift then down/up arrowThis works on Linux might be diff on Win
AtomAdd to start and end of all linesCtrl+F, select regex, first box ^ replace with "text you want", replace all. for end of line change ^ to $ in the first boxThis uses regex
PowershellSet Network IP Address, DNS, Rename Adapter
Get-NetIPConfiguration (gip)
Get-NetAdapter
Get-NetAdapterHardwareInfo
Get-NetAdapter |ft Name, DriverFileName, DriverDate, DriverDescription
Get-Help Get-NetAdapter -Detailed

New-NetIPAddress -InterfaceIndex 6 -IPAddress 192.168.10.25 -PrefixLength "24" -DefaultGateway 192.168.10.10
If wrong IP or Gateway use Remove-NetIPAddress
Can also use Set-NetIPAddress to change settings
Set-DnsClientServerAddress -InterfaceIndex 6 -ServerAddresses 192.168.10.1

Rename-NetAdapter -Name Ethernet -NewName ExtNet
Various Network config settings to read, edit and remove
PowershellAdd computer to domain
Add-Computer "computername" -domainname hplab.local -Credential AD\administrator
You will be asked for password after pressing enter
Add multiple computers after Add-Computer enter names with commas
PowershellRename Computer
Rename-Computer -Computername "computer" -nename "newname" -domaincredential domain\user -force -restart
Renames the computer. You can also rename multiple computers at once.
WindowsOpen Folder/File PropertiesAlt+Enter on Folder
WindowsCreate New FolderCtrl+Shift+N
WindowsCopy Source to Destinationrobocopy E:\ C:\Downloads /MIRMirrors the contents
WindowsGet Time Zonetzutil /g
WindowsOpen up Start button right click menuWin key+x
WindowsOpen User startup folderRun > shell:startup
TrelloKeyboard shortuctsShortcuts Link
LinuxRestart Cinnamon SessionAlt+F2. type rApplies to CInnamon Desktop
LinuxUbuntu version on Mintcat *etc*upstream-release*lsb-releasereplace * with / removed due to mod_security issue
LinuxLinux Mint versioncat *etc*issuereplace * with / removed due to mod_security issue
Nemo Explorer CinnamonRight Click Context MenuDrag File/Folder press Alt and release both for context menuOption for Move/Copy/Link/Cancel for Nemo on Linux
Nemo Explorer CinnamonLeft click twice to rename filesedit > preferences > Behavior > Click on a file’s name twice to rename itAllows renaming of files with 2 mouse clicks and not just F2 or right click > rename
Nemo Explorer CinnamonSort folders at the top of listRename with 0 at the start
Nemo Explorer CinnamonSee the full path of folderCtrl+LToggles full path in address bar
ImageMagickBatch covert jpg to png and resize to 1000*1000 preserving aspect ratio
for file in *.jpg; do convert $file -resize 1000x1000 converted-$file.png; done
QPDFBatch command to remove passwords from PDF files
mkdir -p temp && for f in *.pdf ; do qpdf --password=ThePassword --decrypt "$f" "temp/$f"; done && mv temp/* . && rm -rf temp
QPDFDecrypt password on a single pdf file
qpdf --password="ThePassword" --decrypt "SourceFile.pdf" "OutputFile-decrypted.pdf"
Dell Bios/Boot Menu KeysKeyboard shortcut key to enter Bios and Boot MenuBios: F12
Boot Menu: F2
Lenovo Bios/Boot Menu KeysKeyboard shortcut key to enter Bios and Boot MenuBios: F2
Boot Menu: F12
HP Bios/Boot Menu KeysKeyboard shortcut key to enter Bios and Boot MenuBios: F9
Boot Menu: F12
Surface Bios/Boot Menu KeysKeyboard shortcut key to enter Bios and Boot MenuBios: Surface Pro 7 - From Power off hold vol down and press power on until logo appears (Surface Laptop 2 Vol Up Instead)

Boot Menu: As above or in Windows Recovery > Advanced
Windows 10Restart into advanced startup options menu using CMDshutdown /r /o
Windows 10Audit Mode for ImagesCtrl+Shift+F3 on OOBE
(Add FN for some laptops)
Windows 10Settings app on OOBEStart CMD Shift+F10
enter: start ms-settings:
Intune AutopilotAutopilot OOBE CMD WindowShift+F10 for CMDCan be used to run Autopilot script on usb or explorer, event viewer etc
Intune AutopilotWhite Glove MenuOn the first OOBE screen press Win Key x5, Choose Autopilot provisioning. Other option Reset and install Provisioning package
Intune AutopilotAutopilot Local ResetFrom device lock screen
Ctrl+WinKey+R
Config Profile > Windows 10 > Device restrictions > General. The Automatic Redeployment setting should be set to Allow. Deploy this setting to all devices where a local reset is required
PowershellSystem Info in Powershell
Get-ComputerInfo
PowershellGet Windows License Key
powershell "(Get-WmiObject -query ‘select * from SoftwareLicensingService’).OA3xOriginalProductKey"
Can use CMD: wmic path softwarelicensingservice get OA3xOriginalProductKey
VSCodeGithub Clone RepoCtrl+Shift+P
Git: Clone
VSCodeDisplay TerminalCtrl+`
MSIMSIEXEC switchesMSIEXEC Switch Options
NemoConnect to Windows Server Share in LinuxIn Nemo > File > Connect to Server. See image for details. Right click the network share in Nemo and click add bookmark to save in bookmarks list
Linuxarp
arp -a
Known IP Addresses on the network
Linuxnmap
sudo apt-get install nmap -y
nmap -sP 192.168.1.0/24
Network scan
WindowsGet drive letter quicklymountvol
wmic logicaldisk list brief
powershell -c "Get-PSDrive -PSProvider 'FileSystem'"
echo list volume | diskpart
WindowsCheck if device is Azure AD or Hybrid joineddsregcmd.exe /status
PowerShellAdd current folder to zippowershell compress-archive . publish.zip
WindowsList of Windows ms-settings: commandsms-settings
WindowsCheck Free Disk Spacefsutil volume diskfree c:
VSCode PowerShellctrl+shift+p, enable ise mode
cmdl+enter to create a function template
Param+enter creates param block, can press tab to go through the entries
VSCodeColumn Selecthold left mouse click then press alt+shift then drag
Also shift+alt then arrow keys
WindowsGet Serial of Devicewmic bios get serialnumber
WindowsLocal Reset or Fresh Startsystemreset
systemreset -cleanpc
ImageMagickConvert image to transparent background. Set name of bg colour
convert Selection_004.png -fuzz 15% -transparent white newselection.png
PowerShellInstall PowerShell 7 One line
iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"
0 0 votes
Article Rating
Share this Post
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x