Powershell Commands

Powershell commands: Windows PowerShell is basically the latest command line shell. It is very effective and scriptable as compared to the command prompt. This article will describe the Powershell commands to help you know how each of them works

 

Command alias Cmdlet – Name How Command works
? Where-Object Selects objects based on their respective property values from the collection
% ForEach-Object Carry out an operation for every item in range of input objects.
asnp Add-PSSnapIn Adds 1 or more – Windows PowerShell snap-ins to the present session
ac Add-Content Adds content like data or words to a file.
Cat Get-Content Fetches contents of any file
clc Clear-Content Erases the content of any item, but never deletes the item
clhy Clear-History Erases entries from command history
clp Clear-Item Removes the contents of an item, but never deletes the item.
clear Clear-Host Removes the display in host program.
clp Clear-ItemProperty Erases the property value but will not remove the property.
cnsn Connect-PSSession Allows reconnection to sessions that are disconnected
dbp Disable-PSBreakpoint Disables breakpoints in existing console.
del Remove-Item Deletes files & folders.
diff Compare-Object Compares 2 sets of objects.
dir Get-ChildItem Brings in the files & folders in file system drive.
dnsn Disconnect-PSSession Disconnects from a specific session.
ebp Enable-PSBreakpoint Activates the breakpoints in existing console.
echo Write-Output Sends out the particular objects to next command in line.  In case the command is the last command in line the objects get displayed in console itself.
pal Export-Alias Sends out details about presently defined aliases to a specific file.
epcsv Export-Csv Converts objects into a CSV (series of comma-separated (CSV) strings and then saves strings in CSV file.
epsn Export-PSSession Imports commands from a different session & saves them in a Windows PowerShell module.
erase Remove-Item Removes files & folders.
etsn Enter-PSSession Initiates an interactive session with a computer located remotely
exsn Exit-PSSession Finishes an interactive session with a computer located at a remote place
fc Format-Custom Utilizes a tailored view in order to format the result.
fl Format-List Formats the output in form of a properties list wherein every property is seen in a new line.
foreach ForEach-Object Carries out an operation for each item in the lot of input objects.
w Format-Wide Formats objects as a wide table that displays only one property of each object.
gal Get-Alias Fetches the aliases for present session.
gbp Get-PSBreakpoint Fetches the breakpoints set in the present session.
gc Get-Content Grabs the contents stored in a file
gci Get-ChildItem Fetches the files & folders in file system drive.
gcm Get-Command Extracts all commands.
gcs Get-PSCallStack Shows present call stack.
gdr Get-PSDrive Extracts drives in present session.
ghy Get-History Extracts a list of commands typed in during the present session.
gi Get-Item Brings in files & folders.
gjb Get-Job Fetches Windows PowerShell jobs at the background running in present session.
gl Get-Location Fetches the details about present working location/location stack.
gm Get-Member Extracts the properties & methods of objects.
gmo Get-Module Fetches the modules been imported or which can easily be imported to the existing session
gp Get-ItemProperty Extracts the properties of a mentioned item.
gps Get-Process Extracts processes running on the local computer/distant computer.
group Group-Object Groups objects which have similar values for given properties.
gsnp Get-PSSnapIn Extracts – Windows PowerShell snap-ins on PC.
gsv Get-Service Fetches the services on remote or local PC
gu Get-Unique Sends back unique items extracted from a sorted list.
gv Get-Variable Fetches the variables in the existing console.
gwmi Get-WmiObject Brings in instances of – WMI(windows Management Instrumentation classes/details classes available.
history Get-History Extracts a command list entered during the present session.
icm Invoke-Command Runs the commands on both remote and local computers.
iex Invoke-Expression Runs commands/expressions on local computer.
ihy Invoke-History Runs commands listed in the session history.
ii Invoke-Item Carries out default action for a particular item.
ipal Import-Alias Imports the list of an alias from a file.
ipcsv Import-Csv Builds custom objects that are like table using the items present in a CSV file.
ipsn Import-PSSes
sion
Imports commands present in a different session to present session.
irm Invoke-RestMethod Sends HTTP/HTTPS request to the RESTful web service.
ise powershell_ise.exe Elaborates on the method of using command line tool of PowerShell_ISE.exe
iwmi Invoke-WMIMethod Calls WMI (Windows Management Instrumentation methods.

If we missed any commands here, you can find them at https://devblogs.microsoft.com/scripting/table-of-basic-powershell-commands/

Follow Us On:

Author Bio: Ajit yadav is a professional blogger and co-founder of WindowsClassroom. He is a software engineer by education and blogger & writer by profession.

Ajit Yadav

Author Bio: Ajit yadav is a professional blogger and co-founder of WindowsClassroom. He is a software engineer by education and blogger & writer by profession.

Leave a Reply

Your email address will not be published. Required fields are marked *