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
Language | Name | Command | Description |
---|---|---|---|
PowerShell | New IP Address | New-NetIPAddress –InterfaceIndex 21 IPAddress “192.168.0.7” –PrefixLength 24 -DefaultGateway 192.168.0.11 | Sets the IP of the NIC |
PowerShell | IP Address | Get-NetIPAddress | Returns the IP Address. You can find the InterfaceIndex and Alias using this |
PowerShell | Set DNS | Set-DnsClientServerAddress -InterfaceIndex 21 -ServerAddresses 192.168.0.1, 192.168.0.2 | Sets the DNS 1 and 2 of the NIC |
PowerShell | Run 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 |
PowerShell | Open %TEMP% folder in explorer | Invoke-Item $env:temp | Opens the Temp path in explorer. ii can be used for short |
Windows | Windows Explorer | explorer | Open Win Explorer from Run |
Windows | Windows Firewall | firewall.cpl | Opens Win Firewall |
Windows | System Properties | sysdm.cpl | System Properties |
Windows | New Explorer Window of current Window | Ctrl+N | |
Windows | Run CMD as administrator quick way | Start > Type cmd in start box > Ctrl+Shift+Enter | |
Windows | Display the System Properties dialog box | WinKey+Break | |
Windows | View the properties for the selected item | ALT+ENTER | |
Windows | Restart computer without countdown | Shutdown -r -t 00 | |
Windows | Task Manager | taskmgr | |
Windows | Services | services.msc | |
Windows | Remote Desktop | mstsc | |
Windows | Registry | regedit | |
Windows | Regional Settings | intl.cpl | |
Windows | Printers folder | printers | |
Windows | Power Configuration | powercfg.cpl | |
Windows | Network Connections | control netconnections | |
Windows | Network Connections | ncpa.cpl | |
Windows | User Accounts Basic | control userpasswords | |
Windows | User Accounts Advanced | control userpasswords2 | |
Group Policy | Force Policy Update | gpupdate /force | This can be done on machine on each end |
Group Policy | Show Applied Policies | rsop.msc | show set of policies that are applied |
SSH | Switch on ESXi Server Command | putty -ssh ip address | Power - check status Power on - switch on server |
SSH | Shutdown 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 DC | test DC | dcdiag /s:vmlab.local /q dcdiag /? | Analysis of problems in a forest and reports problems |
Server | AD Admin Center | dsac.exe | Starts AD Admin Center |
Virtualbox | RDP to VM | 192.168.56.1:3389 | Enable Remote display in settings > display |
Virtualbox | Start VM headless | vboxheadless -s Win10_1803 | Starts the VM without a GUI so it can be RDP'd |
Windows | Create 2x2 Grid of Windows | Win key + left then Win key+up. Do the same again but with other directions to make into 2x2 grid | This could be win explorer, browser, word or any windows. Combine with Winkey+E to make quick explorer windows |
Windows | New Desktop | Winkey+tab > click new desktop | drag windows onto the desktop to move them into it |
Windows | Switch between desktops | Ctrl+Winkey+left/right | switch between virtual desktops that are enabled |
Windows | New virtual desktop | Winkey+ctrl+d | Creates a new virtual desktop on win10 |
Windows | Close virtual desktop | Winkey+ctrl+F4 | Close the virtual desktop |
Windows | More options on files/folders in Explorer | Shift+right click file/folder | Displays more options and Send to options |
Windows | Saves Search and options | Start typing search > click search on ribbon > save search to file | Lets you save searches and repeat them by clicking the saved file |
Windows | Search Tips in Explorer | example: 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 |
Windows | PrntScrn direct to pictures folder | Winkey+Prntscrn | This saves the image direct to the pictures folder |
Windows | Game DVR | Search Game DVR in Settings App | This lets you record your game and desktop screen |
Web browser | Go back or forward | Alt+Left, Alt+Right | moves back or forward 1 page |
Web browser | New tab | Ctrl+click link | Opens the link in new tab |
Web browser | Choose Tab | Alt + number of the tab | 1,2,3,4 etc |
Web browser | Undo close tab | Ctrl+Shift+T | |
Virtualbox | Command options | VBoxManage | Full list is displayed or visit this link: https://www.virtualbox.org/manual/ch08.html |
Virtualbox | List VMs and Running VMs | vboxmanage list runningvms | |
Virtualbox | Start a VM | vboxmanage startvm Win10_1803 --type headless | starts in headless mode, no GUI. VM Name is case sensitive |
Virtualbox | Info of VM | vboxmanage showvminfo Win10_1803 | Detailed info |
Virtualbox | Options 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 |
Powershell | PS Version | $PSVersionTable.PSVersion | $PSVersionTable show more details |
Powershell | Help for any cmdlet | 1. Get-Help Get-* 2. Get-Help Get-Help | Use * to locate specific cmdlets |
Powershell | Execution Policy | Get-ExecutionPolicy | RemoteSigned default allows local scripts to run |
Powershell | List Services | Get-Service | |
Powershell | Allow PS Remoting | Enable-PSRemoting | Allows access to local machine with PS |
Powershell | Converts to HTML | Get-Service | ConvertTo-HTML -Property Name, Status > C:\services.htm | Sends output to HTML file |
Powershell | Stop Process | 1. stop-process -id 2508 2. stop-process -name notepad | Ends the task/process |
Powershell | Export Csv | get-service | export-csv c:\services.csv | exports to a csv file |
Powershell | Select Objects | Get-Service | Select-Object Name, Status | Export-CSV c:\service.csv | Get specific objects only for a cleaner file |
Powershell | Get Member of objects | get-process | gm | Gets properties of objects |
Powershell | Get-Command | get-command convertto* | Lets you find all commands |
Powershell | Use More if too much output | get-process | more | displays info 1 page at a time |
Powershell | Where 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 |
Powershell | Display 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 |
Powershell | Alias list | Get-Alias or gal | All short versions of commands |
PS Core 6 | Add Cmdlets from Powershell | 1. Install-Module WindowsPSModulePath -Force 2. Add-WindowsPSModulePath | This will allow you to use Get-NetAdapter etc. |
Virtualbox | Switch work spaces | Ctrl+Alt+Up Arrow Ctrl+Alt+Left/Right | Drag windows between workspaces and switch between them |
Atom | Remove blank lines | Find > \n+, Replace with \n | Regex expression |
Atom | Select edit multiple lines | Hold Alt+Shift then down/up arrow | This works on Linux might be diff on Win |
Atom | Add to start and end of all lines | Ctrl+F, select regex, first box ^ replace with "text you want", replace all. for end of line change ^ to $ in the first box | This uses regex |
Powershell | Set Network IP Address, DNS, Rename Adapter | Get-NetIPConfiguration (gip) | Various Network config settings to read, edit and remove |
Powershell | Add 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 |
Powershell | Rename Computer | Rename-Computer -Computername "computer" -nename "newname" -domaincredential domain\user -force -restart | Renames the computer. You can also rename multiple computers at once. |
Windows | Open Folder/File Properties | Alt+Enter on Folder | |
Windows | Create New Folder | Ctrl+Shift+N | |
Windows | Copy Source to Destination | robocopy E:\ C:\Downloads /MIR | Mirrors the contents |
Windows | Get Time Zone | tzutil /g | |
Windows | Open up Start button right click menu | Win key+x | |
Windows | Open User startup folder | Run > shell:startup | |
Trello | Keyboard shortucts | Shortcuts Link | |
Linux | Restart Cinnamon Session | Alt+F2. type r | Applies to CInnamon Desktop |
Linux | Ubuntu version on Mint | cat *etc*upstream-release*lsb-release | replace * with / removed due to mod_security issue |
Linux | Linux Mint version | cat *etc*issue | replace * with / removed due to mod_security issue |
Nemo Explorer Cinnamon | Right Click Context Menu | Drag File/Folder press Alt and release both for context menu | Option for Move/Copy/Link/Cancel for Nemo on Linux |
Nemo Explorer Cinnamon | Left click twice to rename files | edit > preferences > Behavior > Click on a file’s name twice to rename it | Allows renaming of files with 2 mouse clicks and not just F2 or right click > rename |
Nemo Explorer Cinnamon | Sort folders at the top of list | Rename with 0 at the start | |
Nemo Explorer Cinnamon | See the full path of folder | Ctrl+L | Toggles full path in address bar |
ImageMagick | Batch 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 | |
QPDF | Batch 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 | |
QPDF | Decrypt password on a single pdf file | qpdf --password="ThePassword" --decrypt "SourceFile.pdf" "OutputFile-decrypted.pdf" | |
Dell Bios/Boot Menu Keys | Keyboard shortcut key to enter Bios and Boot Menu | Bios: F12 Boot Menu: F2 | |
Lenovo Bios/Boot Menu Keys | Keyboard shortcut key to enter Bios and Boot Menu | Bios: F2 Boot Menu: F12 | |
HP Bios/Boot Menu Keys | Keyboard shortcut key to enter Bios and Boot Menu | Bios: F9 Boot Menu: F12 | |
Surface Bios/Boot Menu Keys | Keyboard shortcut key to enter Bios and Boot Menu | Bios: 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 10 | Restart into advanced startup options menu using CMD | shutdown /r /o | |
Windows 10 | Audit Mode for Images | Ctrl+Shift+F3 on OOBE (Add FN for some laptops) | |
Windows 10 | Settings app on OOBE | Start CMD Shift+F10 enter: start ms-settings: | |
Intune Autopilot | Autopilot OOBE CMD Window | Shift+F10 for CMD | Can be used to run Autopilot script on usb or explorer, event viewer etc |
Intune Autopilot | White Glove Menu | On the first OOBE screen press Win Key x5, | Choose Autopilot provisioning. Other option Reset and install Provisioning package |
Intune Autopilot | Autopilot Local Reset | From 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 |
Powershell | System Info in Powershell | Get-ComputerInfo | |
Powershell | Get Windows License Key | powershell "(Get-WmiObject -query ‘select * from SoftwareLicensingService’).OA3xOriginalProductKey" | Can use CMD: wmic path softwarelicensingservice get OA3xOriginalProductKey |
VSCode | Github Clone Repo | Ctrl+Shift+P Git: Clone | |
VSCode | Display Terminal | Ctrl+` | |
MSI | MSIEXEC switches | MSIEXEC Switch Options | |
Nemo | Connect to Windows Server Share in Linux | In 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 | ![]() |
Linux | arp | arp -a | Known IP Addresses on the network |
Linux | nmap | sudo apt-get install nmap -y | Network scan |
Windows | Get drive letter quickly | mountvol wmic logicaldisk list brief powershell -c "Get-PSDrive -PSProvider 'FileSystem'" echo list volume | diskpart | |
Windows | Check if device is Azure AD or Hybrid joined | dsregcmd.exe /status | |
PowerShell | Add current folder to zip | powershell compress-archive . publish.zip | |
Windows | List of Windows ms-settings: commands | ms-settings | |
Windows | Check Free Disk Space | fsutil volume diskfree c: | |
VSCode PowerShell | ctrl+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 | ||
VSCode | Column Select | hold left mouse click then press alt+shift then drag Also shift+alt then arrow keys | |
Windows | Get Serial of Device | wmic bios get serialnumber | |
Windows | Local Reset or Fresh Start | systemreset systemreset -cleanpc | |
ImageMagick | Convert image to transparent background. Set name of bg colour | convert Selection_004.png -fuzz 15% -transparent white newselection.png | |
PowerShell | Install PowerShell 7 One line | iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI" | |