Predictive Hacks

Microsoft PowerShell Commands Cheat-Sheet

Below we represent the basic PowerShell commands:

Command aliasCmdlet nameDescription of command
%ForEach-ObjectPerforms an operation against each item in a collection of input objects.
?Where-ObjectSelects objects from a collection based on their property values.
acAdd-ContentAppends content, such as words or data, to a file.
asnpAdd-PSSnapInAdds one or more Windows PowerShell snap-ins to the current session.
catGet-ContentGets the contents of a file.
cdSet-LocationSets the current working location to a specified location.
chdirSet-LocationSets the current working location to a specified location.
clcClear-ContentDeletes the contents of an item, but does not delete the item.
clearClear-HostClears the display in the host program.
clhyClear-HistoryDeletes entries from the command history.
cliClear-ItemDeletes the contents of an item, but does not delete the item.
clpClear-ItemPropertyDeletes the value of a property but does not delete the property.
clsClear-HostClears the display in the host program.
clvClear-VariableDeletes the value of a variable.
cnsnConnect-PSSessionReconnects to disconnected sessions
compareCompare-ObjectCompares two sets of objects.
copyCopy-ItemCopies an item from one location to another.
cpCopy-ItemCopies an item from one location to another.
cpiCopy-ItemCopies an item from one location to another.
cppCopy-ItemPropertyCopies a property and value from a specified location to another location.
curlInvoke-WebRequestGets content from a webpage on the Internet.
cvpaConvert-PathConverts a path from a Windows PowerShell path to a Windows PowerShell provider path.
dbpDisable-PSBreakpointDisables the breakpoints in the current console.
delRemove-ItemDeletes files and folders.
diffCompare-ObjectCompares two sets of objects.
dirGet-ChildItemGets the files and folders in a file system drive.
dnsnDisconnect-PSSessionDisconnects from a session.
ebpEnable-PSBreakpointEnables the breakpoints in the current console.
echoWrite-OutputSends the specified objects to the next command in the pipeline. If the command is the last command in the pipeline, the objects are displayed in the console.
epalExport-AliasExports information about currently defined aliases to a file.
epcsvExport-CsvConverts objects into a series of comma-separated (CSV) strings and saves the strings in a CSV file.
epsnExport-PSSessionImports commands from another session and saves them in a Windows PowerShell module.
eraseRemove-ItemDeletes files and folders.
etsnEnter-PSSessionStarts an interactive session with a remote computer.
exsnExit-PSSessionEnds an interactive session with a remote computer.
fcFormat-CustomUses a customized view to format the output.
flFormat-ListFormats the output as a list of properties in which each property appears on a new line.
foreachForEach-ObjectPerforms an operation against each item in a collection of input objects.
ftFormat-TableFormats the output as a table.
fwFormat-WideFormats objects as a wide table that displays only one property of each object.
galGet-AliasGets the aliases for the current session.
gbpGet-PSBreakpointGets the breakpoints that are set in the current session.
gcGet-ContentGets the contents of a file.
gciGet-ChildItemGets the files and folders in a file system drive.
gcmGet-CommandGets all commands.
gcsGet-PSCallStackDisplays the current call stack.
gdrGet-PSDriveGets drives in the current session.
ghyGet-HistoryGets a list of the commands entered during the current session.
giGet-ItemGets files and folders.
gjbGet-JobGets Windows PowerShell background jobs that are running in the current session.
glGet-LocationGets information about the current working location or a location stack.
gmGet-MemberGets the properties and methods of objects.
gmoGet-ModuleGets the modules that have been imported or that can be imported into the current session.
gpGet-ItemPropertyGets the properties of a specified item.
gpsGet-ProcessGets the processes that are running on the local computer or a remote computer.
groupGroup-ObjectGroups objects that contain the same value for specified properties.
gsnGet-PSSessionGets the Windows PowerShell sessions on local and remote computers.
gsnpGet-PSSnapInGets the Windows PowerShell snap-ins on the computer.
gsvGet-ServiceGets the services on a local or remote computer.
guGet-UniqueReturns unique items from a sorted list.
gvGet-VariableGets the variables in the current console.
gwmiGet-WmiObjectGets instances of Windows Management Instrumentation (WMI) classes or information about the available classes.
hGet-HistoryGets a list of the commands entered during the current session.
historyGet-HistoryGets a list of the commands entered during the current session.
icmInvoke-CommandRuns commands on local and remote computers.
iexInvoke-ExpressionRuns commands or expressions on the local computer.
ihyInvoke-HistoryRuns commands from the session history.
iiInvoke-ItemPerforms the default action on the specified item.
ipalImport-AliasImports an alias list from a file.
ipcsvImport-CsvCreates table-like custom objects from the items in a CSV file.
ipmoImport-ModuleAdds modules to the current session.
ipsnImport-PSSes sionImports commands from another session into the current session.
irmInvoke-RestMethodSends an HTTP or HTTPS request to a RESTful web service.
isepowershell_ise.exeExplains how to use the PowerShell_ISE.exe command-line tool.
iwmiInvoke-WMIMethodCalls Windows Management Instrumentation (WMI) methods.
iwrInvoke-WebRequestGets content from a web page on the Internet.
killStop-ProcessStops one or more running processes.
lpOut-PrinterSends output to a printer.
lsGet-ChildItemGets the files and folders in a file system drive.
manhelpDisplays information about Windows PowerShell commands and concepts.
mdmkdirCreates a new item.
measureMeasure-ObjectCalculates the numeric properties of objects, and the characters, words, and lines in string objects, such as files of text.
miMove-ItemMoves an item from one location to another.
mountNew-PSDriveCreates temporary and persistent mapped network drives.
moveMove-ItemMoves an item from one location to another.
mpMove-ItemPropertyMoves a property from one location to another.
mvMove-ItemMoves an item from one location to another.
nalNew-AliasCreates a new alias.
ndrNew-PSDriveCreates temporary and persistent mapped network drives.
niNew-ItemCreates a new item.
nmoNew-ModuleCreates a new dynamic module that exists only in memory.
npsscNew-PSSessionConfigurationFileCreates a file that defines a session configuration.
nsnNew-PSSessionCreates a persistent connection to a local or remote computer.
nvNew-VariableCreates a new variable.
ogvOut-GridViewSends output to an interactive table in a separate window.
ohOut-HostSends output to the command line.
popdPop-LocationChanges the current location to the location most recently pushed to the stack. You can pop the location from the default stack or from a stack that you create by using the Push-Location cmdlet.
psGet-ProcessGets the processes that are running on the local computer or a remote computer.
pushdPush-LocationAdds the current location to the top of a location stack.
pwdGet-LocationGets information about the current working location or a location stack.
rInvoke-HistoryRuns commands from the session history.
rbpRemove-PSBreakpointDeletes breakpoints from the current console.
rcjbReceive-JobGets the results of the Windows PowerShell background jobs in the current session.
rcsnReceive-PSSessionGets results of commands in disconnected sessions.
rdRemove-ItemDeletes files and folders.
rdrRemove-PSDriveDeletes temporary Windows PowerShell drives and disconnects mapped network drives.
renRename-ItemRenames an item in a Windows PowerShell provider namespace.
riRemove-ItemDeletes files and folders.
rjbRemove-JobDeletes a Windows PowerShell background job.
rmRemove-ItemDeletes files and folders.
rmdirRemove-ItemDeletes files and folders.
rmoRemove-ModuleRemoves modules from the current session.
rniRename-ItemRenames an item in a Windows PowerShell provider namespace.
rnpRename-ItemPropertyRenames a property of an item.
rpRemove-ItemPropertyDeletes the property and its value from an item.
rsnRemove-PSSessionCloses one or more Windows PowerShell sessions (PSSessions).
rsnpRemove-PSSnapinRemoves Windows PowerShell snap-ins from the current session.
rujbResume-JobRestarts a suspended job
rvRemove-VariableDeletes a variable and its value.
rvpaResolve-PathResolves the wildcard characters in a path, and displays the path contents.
rwmiRemove-WMIObjectDeletes an instance of an existing Windows Management Instrumentation (WMI) class.
sajbStart-JobStarts a Windows PowerShell background job.
salSet-AliasCreates or changes an alias (alternate name) for a cmdlet or other command element in the current Windows PowerShell session.
sapsStart-ProcessStarts one or more processes on the local computer.
sasvStart-ServiceStarts one or more stopped services.
sbpSet-PSBreakpointSets a breakpoint on a line, command, or variable.
scSet-ContentReplaces the contents of a file with contents that you specify.
selectSelect-ObjectSelects objects or object properties.
setSet-VariableSets the value of a variable. Creates the variable if one with the requested name does not exist.
shcmShow-CommandCreates Windows PowerShell commands in a graphical command window.
siSet-ItemChanges the value of an item to the valu
DevBlogs Microsoft

More useful commands here

Share This Post

Share on facebook
Share on linkedin
Share on twitter
Share on email

Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore

Python

Image Captioning with HuggingFace

Image captioning with AI is a fascinating application of artificial intelligence (AI) that involves generating textual descriptions for images automatically.

Python

Intro to Chatbots with HuggingFace

In this tutorial, we will show you how to use the Transformers library from HuggingFace to build chatbot pipelines. Let’s