Windows PowerShell 1.0 Commands and Aliases

From Techotopia
Jump to: navigation, search
PreviousTable of ContentsNext
The Basics of Creating and Running Windows PowerShell 1.0 ScriptsWindows PowerShell 1.0 String Quoting and Escape Sequences


Purchase and download the full PDF version of this PowerShell eBook for only $8.99

Buy eBook


Windows PowerShell contains a collection of pre-configured commands (also known as cmdlets) which can be used either in the interactive shell environment, or within scripts. In addition, each command also has a pre-configured alias which typically shortens the amount of typing necessary to invoke a command, and often provides access to a command via a more familiar name. For example, the Get-ChildItem command for listing the contents of a directory may also be executed using the more familiar dir alias.

In this chapter of Windows PowerShell 1.0 Essentials a summary of each command is provided, together with a table of alias to command relationships.

PowerShell 1.0 Command Summary

As previously mentioned, Windows PowerShell 1.0 is supplied with a wide range of built-in commands. A full listing of available commands may be displayed from within the interactive shell by typing help. For the command-line syntax of a particular command, use the Get-Command command passing the name of the command as an argument:

PS C:\Users\Administrator> get-command pop-location

CommandType     Name         Definition
-----------     ----         ----------
Cmdlet          Pop-Location [-PassThru] [-StackName <String>] [-Verbose] [-Debug] 
                             [-ErrorAction <ActionPreference>] [-ErrorVariable <String>] 
                             [-OutVariable <String>] [-OutBuffer <Int32>]...

The following table lists the different commands provided with Windows PowerShell 1.0:

Command

Type

Description

Get-CommandCmdletGet basic information about cmdlets and other elements of Windows PowerShell commands.
Get-HelpCmdletDisplay information about Windows PowerShell cmdlets.
Get-HistoryCmdletGet a list of the previous commands entered during the current session.
Invoke-HistoryCmdletRun selected commands from the session history.
Add-HistoryCmdletAppend entries to the session history.
ForEach-ObjectCmdletPerform an operation against each of a set of input objects.
Where-ObjectCmdletCreate a filter that controls which objects will be passed along a command pipeline.
Set-PSDebugCmdletTurns script debugging features on and off, sets the trace level and toggles strict mode.
Add-PSSnapinCmdletAdd one or more Windows PowerShell snap-ins to the current console.
Remove-PSSnapinCmdletRemove Windows PowerShell snap-ins from the current console.
Get-PSSnapinCmdletGet the Windows PowerShell snap-ins on the computer.
Export-ConsoleCmdletExport the configuration of the current console to a file so that you can reuse or share it.
Start-TranscriptCmdletCreate a record of all or part of a Windows PowerShell session in a text file.
Stop-TranscriptCmdletStop a transcript.
Add-ContentCmdletAdd content to the specified item(s).
Clear-ContentCmdletDelete the contents of a item, such as deleting the text from a file, but does not delete the item.
Clear-ItemPropertyCmdletDelete the value of a property but it does not delete the property.
Join-PathCmdletCombines a path and child-path into a single path. The provider supplies the path delimiters.
Convert-PathCmdletConvert a path from a Windows PowerShell path to a Windows PowerShell provider path.
Copy-ItemPropertyCmdletCopy a property and value from a specified location to another location.
Get-EventLogCmdletGet information about local event logs or the entries stored in those event logs.
Get-ChildItemCmdletGet the items and child items in one or more specified locations.
Get-ContentCmdletGet the content of the item at the specified location.
Get-ItemPropertyCmdletRetrieve the properties of a specified item.
Get-WmiObjectCmdletGet instances of WMI classes or information about available classes.
Move-ItemPropertyCmdletMove a property from one location to another.
Get-LocationCmdletGet information about the current working location.
Set-LocationCmdletSet the current working location to a specified location.
Push-LocationCmdletPush the current location onto the stack.
Pop-LocationCmdletChanges the current location to the location most recently pushed onto the stack. You can pop the location from the default stack or from a stack that you create by using Push-Location.
New-PSDriveCmdletInstall a new Windows PowerShell drive.
Remove-PSDriveCmdletRemove a Windows PowerShell drive from its location.
Get-PSDriveCmdletGet information about Windows PowerShell drives.
Get-ItemCmdletGet the item at the specified location.
New-ItemCmdletCreate a new item in a namespace.
Set-ItemCmdletChange the value of an item to the value specified in the command.
Remove-ItemCmdletDelete the specified items.
Move-ItemCmdletMove an item from one location to another.
Rename-ItemCmdletRename an item in a Windows PowerShell provider namespace.
Copy-ItemCmdletCopy an item from one location to another within a namespace.
Clear-ItemCmdletDelete the contents of an item, but does not delete the item.
Invoke-ItemCmdletInvoke the provider-specific default action on the specified item.
Get-PSProviderCmdletGet information about the specified Windows PowerShell provider.
New-ItemPropertyCmdletSet a new property of an item at a location.
Split-PathCmdletReturn the specified part of a path.
Test-PathCmdletDetermine whether all elements of a path exist.
Get-ProcessCmdletGet the processes that are running on the local computer.
Stop-ProcessCmdletStop one or more running processes.
Remove-ItemPropertyCmdletDelete the property and its value from an item.
Rename-ItemPropertyCmdletRename a property of an item.
Resolve-PathCmdletResolve the wildcard characters in a path and displays the path contents.
Get-ServiceCmdletGet the services on the local computer.
Stop-ServiceCmdletStop one or more running services.
Start-ServiceCmdletStart one or more stopped services.
Suspend-ServiceCmdletSuspend (pauses) one or more running services.
Resume-ServiceCmdletResumes one or more suspended (paused) services.
Restart-ServiceCmdletStop and then start one or more services.
Set-ServiceCmdletChange the display name, description, or starting mode of a service.
New-ServiceCmdletCreate a new entry for a Windows Service in the registry and the Service Database.
Set-ContentCmdletWrite or replaces the content in an item with new content.
Set-ItemPropertyCmdletSet the value of a property at the specified location.
Get-AclCmdletGet the security descriptor for a resource, such as a file or registry key.
Set-AclCmdletChange the security descriptor of a specified resource, such as a file or a registry key.
Get-PfxCertificateCmdletGet information about .pfx certificate files on the computer.
Get-CredentialCmdletGet a credential object based on a user name and password.
Get-ExecutionPolicyCmdletGet the current execution policy for the shell.
Set-ExecutionPolicyCmdletChange the user preference for the execution policy of the shell.
Get-AuthenticodeSignatureCmdletGet information about the Authenticode signature in a file.
Set-AuthenticodeSignatureCmdletUse an authenticode signature to sign a Windows PowerShell script or other file.
ConvertFrom-SecureStringCmdletConvert a secure string into an encrypted standard string.
ConvertTo-SecureStringCmdletConvert encrypted standard strings to secure strings. It can also convert plain text to secure strings. It is used with ConvertFrom-SecureString and Read-Host.
Format-ListCmdletFormat the output as a list of properties in which each property appears on a new line.
Format-CustomCmdletUse a customized view to format the output.
Format-TableCmdletFormat the output as a table.
Format-WideCmdletFormat objects as a wide table that displays only one property of each object.
Out-NullCmdletDelete output instead of sending it to the console.
Out-DefaultCmdletSend the output to the default formatter and the default output cmdlet. Has no effect on the formatting or output and is provided as a placeholder that lets you write your own Out-Default function or cmdlet.
Out-HostCmdletSend output to the command line.
Out-FileCmdletSend output to a file.
Out-PrinterCmdletSend output to a printer.
Out-StringCmdletSend objects to the host as a series of strings.
Add-MemberCmdletAdd a user-defined custom member to an instance of a Windows PowerShell object.
Compare-ObjectCmdletCompare two sets of objects.
ConvertTo-HtmlCmdletCreate an HTML page that represents an object or a set of objects.
Export-CsvCmdletCreate a comma-separated values (CSV) file that represents the input objects.
Import-CsvCmdletImports comma-separated value (CSV) files in the format produced by the Export-CSV cmdlet and returns objects that correspond to the objects represented in that CSV file.
Export-AliasCmdletExport information about currently-defined aliases to a file.
Invoke-ExpressionCmdletRun a Windows PowerShell expression that is provided in the form of a string.
Get-AliasCmdletGet the aliases for the current session.
Get-CultureCmdletGet information about the regional settings on a computer.
Get-DateCmdletGet the current date and time.
Get-HostCmdletGet a reference to the current console host object. Display Windows Powershell version and regional information by default.
Get-MemberCmdletGet information about objects or collections of objects.
Get-UICultureCmdletGet information about the current user interface culture for Windows PowerShell.
Get-UniqueCmdletReturn the unique items from a sorted list.
Import-AliasCmdletImport an alias list from a file.
Select-StringCmdletIdentify patterns in strings.
Measure-ObjectCmdletMeasure characteristics of objects and their properties.
New-AliasCmdletCreate a new alias.
New-TimeSpanCmdletCreate a TimeSpan object.
Read-HostCmdletRead a line of input from the console.
Set-AliasCmdletCreate or changes an alias (alternate name) for a cmdlet or other command element in the current Windows PowerShell session.
Set-DateCmdletChange the system time on the computer to a time that you specify.
Start-SleepCmdletSuspend shell, script, or runspace activity for the specified period of time.
Tee-ObjectCmdletPipe object input to a file or variable, then passes the input along the pipeline.
Measure-CommandCmdletMeasure the time it takes to run script blocks and cmdlets.
Update-TypeDataCmdletUpdate the current extended type configuration by reloading the *.types.ps1xml files into memory.
Update-FormatDataCmdletUpdate and appends format data files.
Write-HostCmdletDisplay objects by using the host user interface
Write-ProgressCmdletDisplay a progress bar within a Windows PowerShell command window.
New-ObjectCmdletCreate an instance of a .Net or COM object.
Select-ObjectCmdlet Selects specified properties of an object or set of objects. It can also select unique objects from an array of objects or it can select a specified number of objects from the beginning or end of an array of objects.
Group-ObjectCmdletGroups objects that contain the same value for specified properties.
Sort-ObjectCmdletSorts objects by property values.
Get-VariableCmdletGet the variables in the current console.
New-VariableCmdletCreate a new variable.
Set-VariableCmdletSet the value of a variable. Create the variable if one with the requested name does not exist.
Remove-VariableCmdletDelete a variable and its value.
Clear-VariableCmdletDelete the value of a variable.
Export-ClixmlCmdletCreate an XML-based representation of an object or objects and stores it in a file.
Import-ClixmlCmdletImport a CLIXML file and creates corresponding objects within Windows PowerShell.
Write-DebugCmdletWrite a debug message to the host display.
Write-VerboseCmdletWrite a string to the verbose display of the host.
Write-WarningCmdletWrite a warning message.
Write-ErrorCmdletWrite an object to the error pipeline.
Write-OutputCmdletWrite objects to the success pipeline.
Get-TraceSourceCmdletGet the Windows PowerShell components that are instrumented for tracing.
Set-TraceSourceCmdletConfigures, starts, and stops a trace of Windows PowerShell components.
Trace-CommandCmdletThe Trace-Command cmdlet configures and starts a trace of the specified expression or command.
AliasProviderProvides access to the Windows PowerShell aliases and the values that they represent.
EnvironmentProviderProvides access to the Windows environment variables.
FileSystemProviderThe PowerShell Provider for accessing files and directories from within the Windows PowerShell.
FunctionProviderProvides access to the functions defined in Windows PowerShell.
RegistryProviderProvides access to the system registry keys and values from within Windows PowerShell.
VariableProviderProvides access to the Windows PowerShell variables and their values.
CertificateProviderProvides access to X509 certificate stores and certificates from within Windows PowerShell.

PowerShell 1.0 Alias Summary

Each PowerShell command has a pre-configured alias that can be used to invoke the command. These are often greatly abbreviated to reduce the amount of typing required, and occasionally used to provide a more familiar name.

A full list of pre-defined PowerShell 1.0 aliases is provided in the following table: <google>ADSDAQBOX_FLOW</google>

Alias

Command

acAdd-Content
asnpAdd-PSSnapin
clcClear-Content
cliClear-Item
clpClear-ItemProperty
clvClear-Variable
cpiCopy-Item
cppCopy-ItemProperty
cvpaConvert-Path
diffCompare-Object
epalExport-Alias
epcsvExport-Csv
fcFormat-Custom
flFormat-List
foreachForEach-Object
%ForEach-Object
ftFormat-Table
fwFormat-Wide
galGet-Alias
gcGet-Content
gciGet-ChildItem
gcmGet-Command
gdrGet-PSDrive
ghyGet-History
giGet-Item
glGet-Location
gmGet-Member
gpGet-ItemProperty
gpsGet-Process
groupGroup-Object
gsvGet-Service
gsnpGet-PSSnapin
guGet-Unique
gvGet-Variable
gwmiGet-WmiObject
iexInvoke-Expression
ihyInvoke-History
iiInvoke-Item
ipalImport-Alias
ipcsvImport-Csv
miMove-Item
mpMove-ItemProperty
nalNew-Alias
ndrNew-PSDrive
niNew-Item
nvNew-Variable
ohOut-Host
rdrRemove-PSDrive
riRemove-Item
rniRename-Item
rnpRename-ItemProperty
rpRemove-ItemProperty
rsnpRemove-PSSnapin
rvRemove-Variable
rvpaResolve-Path
salSet-Alias
sasvStart-Service
scSet-Content
selectSelect-Object
siSet-Item
slSet-Location
sleepStart-Sleep
sortSort-Object
spSet-ItemProperty
sppsStop-Process
spsvStop-Service
svSet-Variable
teeTee-Object
whereWhere-Object
?Where-Object
writeWrite-Output
catGet-Content
cdSet-Location
clearClear-Host
cpCopy-Item
hGet-History
historyGet-History
killStop-Process
lpOut-Printer
lsGet-ChildItem
mountNew-PSDrive
mvMove-Item
popdPop-Location
psGet-Process
pushdPush-Location
pwdGet-Location
rInvoke-History
rmRemove-Item
rmdirRemove-Item
echoWrite-Output
clsClear-Host
chdirSet-Location
copyCopy-Item
delRemove-Item
dirGet-ChildItem
eraseRemove-Item
moveMove-Item
rdRemove-Item
renRename-Item
setSet-Variable
typeGet-Content

Creating and Listing PowerShell Aliases

New aliases may be created, or existing ones changed using the Set-Alias command. For example, to create an alias of list for the Get-ChildItem command (which provides listing of the contents of a directory) the following command would be executed:

PS C:\Users\Administrator> set-alias list get-childitem

A list of currently defined aliases may be obtained using the Get-Alias command:

PS C:\Users\Administrator> get-alias

In addition, the current command to which an alias is mapped may be obtained by referencing the alias as an argument to Get-Alias:

PS C:\Users\Administrator> get-alias set

CommandType     Name                                      Definition
-----------     ----                                      ----------
Alias           set                                       Set-Variable

<google>BUY_WPS_BOTTOM</google>