Skip to content

Instantly share code, notes, and snippets.

@adojos
Last active March 25, 2023 13:40
Show Gist options
  • Save adojos/189893f26928396c0d17e358e2b2c2f0 to your computer and use it in GitHub Desktop.
Save adojos/189893f26928396c0d17e358e2b2c2f0 to your computer and use it in GitHub Desktop.
PowerShell: Commands Reference #powershell

Basic PowerShell Commands (cmdlets)


Commands To Find Other Commands

Commands Description
Get-Command The Get-Command cmdlet gets all commands that are installed on the computer, including cmdlets, aliases, functions, filters, scripts, and applications. Get-Command gets the commands from PowerShell modules and commands that were imported from other sessions
Get-Help Helps you learn how to use commands. Following parameters can be used: -Full, -Detailed, -Examples, -Online, -Parameter, -ShowWindow
Get-Member Gets the properties and methods of objects. You can use following parameters to this command: -Name, -InputObject, -MemberType, -Static, -View

Essential PowerShell Commands

Commands Description
Set-Location This cmdlet sets the working location to a specified location. That location could be a directory, a subdirectory, a registry location, or any provider path. Used as an alternative to the CD command. Parameter -Path
Get-ChildItem Gets the items and child items in one or more specified locations. Parameter -Path
Set-ExecutionPolicy Scripting is disabled by default to prevent malicious scripts from executing in the PowerShell environment. The Set-ExecutionPolicy cmdlet's default scope is LocalMachine, which affects everyone who uses the computer. To change the execution policy for LocalMachine, start PowerShell with Run as Administrator. You can set one of four security levels (a) Restricted (b) All Signed (c) Remote Signed (d) Unrestricted
Get-ExecutionPolicy Gets the execution policies for the current session. To display the execution policies for each scope in the order of precedence, use Get-ExecutionPolicy -List. To see the effective execution policy for your PowerShell session use Get-ExecutionPolicy with no parameters
Get-Service Gets the services on the computer
Get-Process Gets the processes that are running on the local computer
Export-CSV Lets you export data to a CSV file. example Get-Command | Export-CSV Commands.csv
ConvertTo-Html You can use this cmdlet to display the output of a command in a Web page. The command takes in the output file you want to convert and the filename you want to save it with. E.g. Get-Command | ConvertTo-Html > Commands.html
Get-Module The Get-Module cmdlet lists the PowerShell modules that have been imported, or that can be imported, into a PowerShell session. Without parameters, Get-Module gets modules that have been imported into the current session
Get-Module -ListAvailable This command gets the modules that are installed on the computer and can be imported into the current session. Get-Module looks for available modules in the path specified by the $env:PSModulePath environment variable
Get-InstalledModule This cmdlet gets PowerShell modules that are installed on a computer using PowerShellGet
Copy-Item This cmdlet copies an item from one location to another location in the same namespace. To copy files and folders, type Copy-Item followed by the source -Path, -Destination parameter, and destination address. E.g. Copy-Item "E:\Directory1" -Destination "E:\Directory2" -Recurse
Move-Item This cmdlet moves an item, including its properties, contents, and child items, from one location to another location. The locations must be supported by the same provider. E.g. Move-Item -Path "E:\Folder1" -Destination "E:\Folder2"
Get-Content This cmdlet lets you view the content of an item item without using a text editor. E.g. Get-Content "E:\Folder1\Test.txt"

Reference Links

Microsoft PowerShell Scripting Reference

Windows PowerShell Commands (SS64)


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment