Skip to content

Commands

Share this Post
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

PowerShell Cmdlets and Useful Commands for Win, Linux etc.

 

LanguageNameCommandDescription
WindowsWindows ExplorerexplorerOpen Win Explorer from Run
WindowsWindows Firewallfirewall.cplOpens Win Firewall
WindowsSystem Propertiessysdm.cplSystem Properties
PowerShellIP AddressGet-NetIPAddressReturns the IP Address. You can find the InterfaceIndex and Alias using this
PowerShellNew IP AddressNew-NetIPAddress –InterfaceIndex 21 IPAddress “192.168.0.7” –PrefixLength 24 -DefaultGateway 192.168.0.11Sets the IP of the NIC
PowerShellSet DNSSet-DnsClientServerAddress -InterfaceIndex 21 -ServerAddresses 192.168.0.1, 192.168.0.2Sets the DNS 1 and 2 of the NIC
PowerShellRun PS as Admin quick wayStart > Type powershell in start box > Ctrl+Shift+Enter
OR
Add Icon to Taskbar press Ctrl+Shift+Click (this is faster)
Opens PowerShell as administrator
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 AccountsMain control userpasswords
WindowsUser AccountsAdvanced control 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
PowerShellOpen %TEMP% folder in explorerInvoke-Item $env:tempOpens the Temp path in explorer. ii can be used for short
SSHSwitch on ESXi Server Commandputty -ssh ip addressPower - check status
Power on - switch on server
SSHShutdown serverplink -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
PowershellPS Version$PSVersionTable.PSVersion$PSVersionTable show more details
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
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
PowershellHelp for any cmdletGet-Help Get-*
Get-Help Get-Help
Use * to locate specific cmdlets
PowershellExecution PolicyGet-ExecutionPolicyRemoteSigned default allows local scripts to run
PowershellList ServicesGet-Service
PowershellAllow PS RemotingEnable-PSRemotingAllows access to local machine with PS
PowershellConverts to HTMLGet-Service | ConvertTo-HTML -Property Name, Status > C:\services.htmSends output to HTML file
PowershellStop Processstop-process -id 2508
stop-process -name notepad
Ends the task/process
PowershellExport Csvget-service | export-csv c:\services.csvexports to a csv file
PowershellSelect ObjectsGet-Service | Select-Object Name, Status | Export-CSV c:\service.csv Get specific objects only for a cleaner file
PowershellGet Member of objectsget-process | gmGets properties of objects
PowershellGet-Commandget-command convertto*Lets you find all commands
PowershellUse More if too much outputget-process | moredisplays info 1 page at a time
PowershellWhere Object and backtickGet-Process `
| Where-Object {$_.company -Notlike '*Microsoft*'}`
| Format-Table ProcessName, Company -auto
` backtick at end allows you to continue cmdlet on next line
PowershellDisplay get commandsGet-Command -Verb get | Get-Help | Select-Object name, synopsis | convertTo-Html > c:\helpcommands.htmOutputs the get commands as a list in html file
PowershellAlias listGet-Alias or galAll short versions of commands
PS Core 6Add Cmdlets from PowershellInstall-Module WindowsPSModulePath -Force
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 AdapterGet-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 domainAdd-Computer "computername" -domainname hplab.local -Credential AD\administratorYou will be asked for password after pressing enter
Add multiple computers after Add-Computer enter names with commas
PowershellRename ComputerRename-Computer -Computername "computer" -nename "newname" -domaincredential domain\user -force -restartRenames 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
TrelloKeyboard shortuctsShortcuts Link
Web browserUndo close tabCtrl+Shift+T

 


Share this Post
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
Scroll Up