PowerShell Pipe Options and Functions List
Posted by SysAdmin Tools on
Here is a list of the commands we will cover.
Each command has a link to the Microsoft Reference Page with full Description, Syntax and Examples, but a short description and some examples are supplied here.
You can get this same list by running the following command.
Get-Command | where {$_.Source -eq "Microsoft.PowerShell.Management" } | Sort-Object Name
WE WILL BE COVERING THE FOLLOWING COMMANDS
SCROLL DOWN FOR ALL THE DETAILS OF EACH COMMAND
Commands
ConvertFrom-SddlString
Format-Hex
Get-FileHash
Import-PowerShellDataFile
New-Guid
New-TemporaryFile
Add-Member
Add-Type
Clear-Variable
Compare-Object
ConvertFrom-Csv
ConvertFrom-Json
ConvertFrom-String
ConvertFrom-StringData
Convert-String
ConvertTo-Csv
ConvertTo-Html
ConvertTo-Json
ConvertTo-Xml
Debug-Runspace
Disable-PSBreakpoint
Disable-RunspaceDebug
Enable-PSBreakpoint
Enable-RunspaceDebug
Export-Alias
Export-Clixml
Export-Csv
Export-FormatData
Export-PSSession
Format-Custom
Format-List
Format-Table
Format-Wide
Get-Alias
Get-Culture
Get-Date
Get-Event
Get-EventSubscriber
Get-FormatData
Get-Host
Get-Member
Get-PSBreakpoint
Get-PSCallStack
Get-Random
Get-Runspace
Get-RunspaceDebug
Get-TraceSource
Get-TypeData
Get-UICulture
Get-Unique
Get-Variable
Group-Object
Import-Alias
Import-Clixml
Import-Csv
Import-LocalizedData
Import-PSSession
Invoke-Expression
Invoke-RestMethod
Invoke-WebRequest
Measure-Command
Measure-Object
New-Alias
New-Event
New-Object
New-TimeSpan
New-Variable
Out-File
Out-GridView
Out-Printer
Out-String
Read-Host
Register-EngineEvent
Register-ObjectEvent
Remove-Event
Remove-PSBreakpoint
Remove-TypeData
Remove-Variable
Select-Object
Select-String
Select-Xml
Send-MailMessage
Set-Alias
Set-Date
Set-PSBreakpoint
Set-TraceSource
Set-Variable
Show-Command
Sort-Object
Start-Sleep
Tee-Object
Trace-Command
Unblock-File
Unregister-Event
Update-FormatData
Update-List
Update-TypeData
Wait-Debugger
Wait-Event
Write-Debug
Write-Error
Write-Host
Write-Information
Write-Output
Write-Progress
Write-Verbose
Write-Warning
BE SURE TO CHECK OUT OUR AWESOME FREE AND PREMIUM TOOLS
AFTER YOU CHECK OUT THIS LIST
Add-Member
DESCRIPTION
The Add-Member cmdlet lets you add members (properties and methods) to an instance of a PowerShell object. For instance, you can add a NoteProperty member that contains a description of the object or a ScriptMethod member that runs a script to change the object.
EXAMPLE
$A = Get-ChildItem c:\ps-test\test.txt
$A | Add-Member -NotePropertyName Status -NotePropertyValue Done
OUTPUT
$A.Status
Done
Add-Type
DESCRIPTION
The Add-Type cmdlet lets you define a Microsoft .NET Core class in your PowerShell session. You can then instantiate objects, by using the New-Object cmdlet, and use the objects just as you would use any .NET Core object. If you add an Add-Type command to your PowerShell profile, the class is available in all PowerShell sessions.
EXAMPLE
$Source = @"
public class BasicTest
{
public static int Add(int a, int b)
{
return (a + b);
}
public int Multiply(int a, int b)
{
return (a * b);
}
}
"@
Add-Type -TypeDefinition $Source
[BasicTest]::Add(4, 3)
$BasicTestObject = New-Object BasicTest
$BasicTestObject.Multiply(5, 2)
Clear-Variable
DESCRIPTION
The Clear-Variable cmdlet deletes the data stored in a variable, but it does not delete the variable. As a result, the value of the variable is NULL (empty). If the variable has a specified data or object type, this cmdlet preserves the type of the object stored in the variable.
EXAMPLE
Clear-Variable my* -Scope Global
Compare-Object
DESCRIPTION
The Compare-Object cmdlet compares two sets of objects. One set of objects is the reference, and the other set of objects is the difference.
EXAMPLE
Compare-Object -ReferenceObject (Get-Content -Path C:\Test\Testfile1.txt) -DifferenceObject (Get-Content -Path C:\Test\Testfile2.txt)
OUTPUT
InputObject SideIndicator
----------- -------------
cat =>
racoon =>
dog <=
squirrel <=
ConvertFrom-Csv
DESCRIPTION
The ConvertFrom-Csv cmdlet creates objects from CSV variable-length strings that are generated by the ConvertTo-Csv cmdlet.
EXAMPLE
$P = Get-Process | ConvertTo-Csv $P | ConvertFrom-Csv
ConvertFrom-Json
DESCRIPTION
The ConvertFrom-Json cmdlet converts a JavaScript Object Notation (JSON) formatted string to a custom PSCustomObject object that has a property for each field in the JSON string. JSON is commonly used by web sites to provide a textual representation of objects. The JSON standard does not prohibit usage that is prohibited with a PSCustomObject. For example, if the JSON string contains duplicate keys, only the last key is used by this cmdlet. See other examples below.
EXAMPLE
Get-Date | Select-Object -Property * | ConvertTo-Json | ConvertFrom-Json
ConvertFrom-SddlString
DESCRIPTION
The ConvertFrom-SddlString cmdlet converts a Security Descriptor Definition Language string to a custom PSCustomObject object with the following properties: Owner, Group, DiscretionaryAcl, SystemAcl and RawDescriptor.
EXAMPLE
$acl = Get-Acl -Path C:\Windows
ConvertFrom-SddlString -Sddl $acl.Sddl
ConvertFrom-String
DESCRIPTION
The ConvertFrom-String cmdlet extracts and parses structured properties from string content. This cmdlet generates an object by parsing text from a traditional text stream. For each string in the pipeline, the cmdlet splits the input by either a delimiter or a parse expression, and then assigns property names to each of the resulting split elements. You can provide these property names; if you do not, they are automatically generated for you.
EXAMPLE
"Hello World" | ConvertFrom-String
ConvertFrom-StringData
DESCRIPTION
The ConvertFrom-StringData cmdlet converts a string that contains one or more key and value pairs into a hash table. Because each key-value pair must be on a separate line, here-strings are often used as the input format. By default, the key must be separated from the value by an equals sign (=) character.
EXAMPLE
$Here = @'
Msg1 = The string parameter is required.
Msg2 = Credentials are required for this command.
Msg3 = The specified variable does not exist.
'@
ConvertFrom-StringData -StringData $Here
OUTPUT
Name Value
---- -----
Msg3 The specified variable does not exist.
Msg2 Credentials are required for this command.
Msg1 The string parameter is required.
Convert-String
DESCRIPTION
The cmdlet formats a string to match the format of examples.
EXAMPLE
"Mu Han", "Jim Hance", "David Ahs", "Kim Akers" | Convert-String -Example "Ed Wilson=Wilson, E."
OUTPUT
Han, M.
Hance, J.
Ahs, D.
Akers, K.
ConvertTo-Csv
DESCRIPTION
The ConvertTo-CSV cmdlet returns a series of comma-separated value (CSV) strings that represent the objects that you submit. You can then use the ConvertFrom-Csv cmdlet to recreate objects from the CSV strings. The objects converted from CSV are string values of the original objects that contain property values and no methods.
EXAMPLE
Get-Process -Name pwsh | ConvertTo-Csv -NoTypeInformation -Delimiter ","
OUTPUT
"Name","SI","Handles","VM","WS","PM","NPM","Path","Parent","Company","CPU","FileVersion", ...
"pwsh","8","950","2204001161216","100925440","59686912","67104", ...
ConvertTo-Html
DESCRIPTION
The ConvertTo-Html cmdlet converts .NET objects into HTML that can be displayed in a Web browser. You can use this cmdlet to display the output of a command in a Web page.
EXAMPLE
Get-Alias | ConvertTo-Html | Out-File aliases.htm
Invoke-Item aliases.htm
ConvertTo-Json
DESCRIPTION
The ConvertTo-Json cmdlet converts any .NET object to a string in JavaScript Object Notation (JSON) format. The properties are converted to field names, the field values are converted to property values, and the methods are removed.
EXAMPLE
(Get-UICulture).Calendar | ConvertTo-Json
OUTPUT
{
"MinSupportedDateTime": "0001-01-01T00:00:00",
"MaxSupportedDateTime": "9999-12-31T23:59:59.9999999",
"AlgorithmType": 1,
"CalendarType": 1,
"Eras": [
1
],
"TwoDigitYearMax": 2029,
"IsReadOnly": true
}
ConvertTo-Xml
DESCRIPTION
The ConvertTo-Xml
cmdlet creates an XML-based representation of one or more .NET objects. To use this cmdlet, pipe one or more objects to the cmdlet, or use the InputObject parameter to specify the object.
EXAMPLE
Get-Date | ConvertTo-Xml
Debug-Runspace
DESCRIPTION
The Debug-Runspace cmdlet starts an interactive debugging session with a local or remote active runspace. You can find a runspace that you want to debug by first running Get-Process to find processes associated with PowerShell, then Enter-PSHostProcess with the process ID specified in the Id parameter to attach to the process, and then Get-Runspace to list runspaces within the PowerShell host process.
EXAMPLE
Get-Process -ComputerName "WS10TestServer" -Name "*powershell*"
Handles WS(K) VM(M) CPU(s) Id ProcessName
------- ----- ----- ------ -- -----------
377 69912 63 2.09 2420 powershell
399 123396 829 4.48 1152 powershell_ise
Enter-PSSession -ComputerName "WS10TestServer"
[WS10TestServer]:Enter-PSHostProcess -Id 1152
[WS10TestServer:][Process:1152]: Get-Runspace
Id Name ComputerName Type State Availability
-- ---- ------------ ---- ----- ------------
1 Runspace1 WS10TestServer Remote Opened Available
2 RemoteHost WS10TestServer Remote Opened Busy
[WS10TestServer][Process:1152]: > Debug-Runspace -Id 2
Hit Line breakpoint on 'C:\TestWFVar1.ps1:83'
At C:\TestWFVar1.ps1:83 char:1
+ $scriptVar = "Script Variable"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Process:1152]: [RSDBG: 2]: >
Disable-PSBreakpoint
DESCRIPTION
The Remove-PSBreakpoint cmdlet deletes a breakpoint. Enter a breakpoint object or a breakpoint ID.
EXAMPLE
Get-PSBreakpoint | Remove-PSBreakpoint
Disable-RunspaceDebug
DESCRIPTION
The Disable-RunspaceDebug cmdlet disables debugging on one or more runspaces, and releases any pending debugger stop.
EXAMPLE
Disable-RunspaceDebug
Get-RunspaceDebug
OUTPUT
Id Name Enabled BreakAll
-- ---- ------- --------
1 Runspace1 False False
Enable-PSBreakpoint
DESCRIPTION
The Enable-PSBreakpoint cmdlet re-enables disabled breakpoints. You can use it to enable all breakpoints, or specific breakpoints by providing breakpoint objects or IDs.
A breakpoint is a point in a script where execution stops temporarily so that you can examine the state of the script.
EXAMPLE
Get-PSBreakpoint | Enable-PSBreakpoint
Enable-RunspaceDebug
DESCRIPTION
The Enable-RunspaceDebug cmdlet enables debugging on runspaces where any breakpoint is preserved until a debugger is attached.
EXAMPLE
Enable-RunspaceDebug
Get-RunspaceDebug
OUTPUT
Id Name Enabled BreakAll
-- ---- ------- --------
1 Runspace1 True False
Export-Alias
DESCRIPTION
The Export-Alias
cmdlet exports the aliases in the current session to a file. If the output file does not exist, the cmdlet will create it.
EXAMPLE
Export-Alias -Path "alias.csv"
Export-Clixml
DESCRIPTION
The Export-Clixml cmdlet creates a Common Language Infrastructure (CLI) XML-based representation of an object or objects and stores it in a file. You can then use the Import-Clixml cmdlet to recreate the saved object based on the contents of that file. For more information about CLI, see Language independence.
EXAMPLE
"This is a test" | Export-Clixml -Path .\sample.xml
Export-Csv
DESCRIPTION
The Export-CSV cmdlet creates a CSV file of the objects that you submit. Each object is a row that includes a comma-separated list of the object's property values. You can use the Export-CSV cmdlet to create spreadsheets and share data with programs that accept CSV files as input.
EXAMPLE
Get-Process -Name WmiPrvSE | Select-Object -Property BasePriority,Id,SessionId,WorkingSet |
Export-Csv -Path .\WmiData.csv -NoTypeInformation
Import-Csv -Path .\WmiData.csv
BasePriority Id SessionId WorkingSet
------------ -- --------- ----------
8 976 0 20267008
8 2292 0 36786176
8 3816 0 30351360
8 8604 0 15011840
8 10008 0 8830976
8 11764 0 14237696
8 54632 0 9502720
Export-FormatData
DESCRIPTION
The Export-FormatData cmdlet creates PowerShell formatting files (format.ps1xml) from the formatting objects in the current session. It takes the ExtendedTypeDefinition objects that Get-FormatData returns and saves them in a file in XML format.
EXAMPLE
Get-FormatData -TypeName "*" | Export-FormatData -Path "allformat.ps1xml" -IncludeScriptBlock
Export-PSSession
DESCRIPTION
The Export-PSSession cmdlet gets cmdlets, functions, aliases, and other command types from another PowerShell session (PSSession) on a local or remote computer and saves them in a PowerShell module. To add the commands from the module to the current session, use the Import-Module cmdlet.
EXAMPLE
$S = New-PSSession -ComputerName Server01
Export-PSSession -Session $S -OutputModule Server01
Format-Custom
DESCRIPTION
The Format-Custom cmdlet formats the output of a command as defined in an alternate view. Format-Custom is designed to display views that are not just tables or just lists. You can use the views defined in PowerShell, or you can create your own views in a new format.ps1xml file and use the Update-FormatData cmdlet to add them to PowerShell.
EXAMPLE
Get-Command Start-Transcript | Format-Custom -View MyView
Format-Hex
DESCRIPTION
The Format-Hex cmdlet displays a file or other input as hexadecimal values. To determine the offset of a character from the output, add the number at the leftmost of the row to the number at the top of the column for that character.
EXAMPLE
'Hello World' | Format-Hex
Label: String (System.String) <2944BEC3>
Offset Bytes Ascii
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
------ ----------------------------------------------- -----
0000000000000000 48 65 6C 6C 6F 20 57 6F 72 6C 64 Hello World
CLICK ON THE BANNER TO CHECK OUT OUR FREE AND PREMIUM TOOLS HERE
Format-List
DESCRIPTION
The Format-List cmdlet formats the output of a command as a list of properties in which each property is displayed on a separate line. You can use Format-List to format and display all or selected properties of an object as a list (format-list *)
EXAMPLE
Get-Service | Format-List
Format-Table
DESCRIPTION
The Format-Table cmdlet formats the output of a command as a table with the selected properties of the object in each column. The object type determines the default layout and properties that are displayed in each column. You can use the Property parameter to select the properties that you want to display.
EXAMPLE
Get-Host | Format-Table -AutoSize
Format-Wide
DESCRIPTION
The Format-Wide cmdlet formats objects as a wide table that displays only one property of each object. You can use the Property parameter to determine which property is displayed.
EXAMPLE
Get-ChildItem | Format-Wide -Column 3
Get-Alias
DESCRIPTION
The Get-Alias cmdlet gets the aliases in the current session. This includes built-in aliases, aliases that you have set or imported, and aliases that you have added to your PowerShell profile.
EXAMPLE
Get-Alias
CommandType Name
----------- ----
Alias % -> ForEach-Object
Alias ? -> Where-Object
Alias ac -> Add-Content
Alias asnp -> Add-PSSnapin
Alias cat -> Get-Content
Alias cd -> Set-Location
Alias chdir -> Set-Location
Alias clc -> Clear-Content
Alias clear -> Clear-Host
Alias clhy -> Clear-History
Get-Culture
DESCRIPTION
The Get-Culture
cmdlet gets information about the current culture settings. This includes information about the current language settings on the system, such as the keyboard layout, and the display format of items such as numbers, currency, and dates.
EXAMPLE
Get-Culture
LCID Name DisplayName
---- ---- -----------
1033 en-US English (United States)
Get-Date
DESCRIPTION
The Get-Date cmdlet gets a DateTime object that represents the current date or a date that you specify. Get-Date can format the date and time in several .NET and UNIX formats. You can use Get-Date to generate a date or time character string, and then send the string to other cmdlets or programs.
EXAMPLE
Get-Date
Get-Date.AddDays(-1)
OUTPUT
Tuesday, June 25, 2019 14:53:32
Tuesday, June 24, 2019 14:53:32
Get-Event
DESCRIPTION
The Get-EventLog cmdlet gets events and event logs from local and remote computers. By default, Get-EventLog gets logs from the local computer. To get logs from remote computers, use the ComputerName parameter.
EXAMPLE
Get-EventLog -List
OUTPUT
Max(K) Retain OverflowAction Entries Log
------ ------ -------------- ------- ---
15,168 0 OverwriteAsNeeded 20,792 Application
15,168 0 OverwriteAsNeeded 12,559 System
15,360 0 OverwriteAsNeeded 11,173 Windows PowerShell
Get-EventSubscriber
DESCRIPTION
The Get-EventSubscriber cmdlet gets the event subscribers in the current session.
EXAMPLE
$Timer = New-Object Timers.Timer
$Timer | Get-Member -Type Event
OUTPUT
TypeName: System.Timers.Timer
Name MemberType Definition
---- ---------- ----------
Disposed Event System.EventHandler Disposed(System.Object, System.EventArgs)
Elapsed Event System.Timers.ElapsedEventHandler Elapsed(System.Object, System.Timers.ElapsedEventArgs)
EXAMPLE
Register-ObjectEvent -InputObject $Timer -EventName Elapsed -SourceIdentifier Timer.Elapsed
Get-EventSubscriber
OUTPUT
SubscriptionId : 4
SourceObject : System.Timers.Timer
EventName : Elapsed
SourceIdentifier : Timer.Elapsed
Action :
HandlerDelegate :
SupportEvent : False
ForwardEvent : False
Get-FileHash
DESCRIPTION
The Get-FileHash cmdlet computes the hash value for a file by using a specified hash algorithm. A hash value is a unique value that corresponds to the content of the file. Rather than identifying the contents of a file by its file name, extension, or other designation, a hash assigns a unique value to the contents of a file. File names and extensions can be changed without altering the content of the file, and without changing the hash value. Similarly, the file's content can be changed without changing the name or extension. However, changing even a single character in the contents of a file changes the hash value of the file.
EXAMPLE
Get-FileHash /etc/apt/sources.list | Format-List
OUTPUT
Algorithm : SHA256
Hash : 3CBCFDDEC145E3382D592266BE193E5BE53443138EE6AB6CA09FF20DF609E268
Path : /etc/apt/sources.list
Get-FormatData
DESCRIPTION
The Get-FormatData cmdlet gets the formatting data in the current session.
The formatting data in the session includes formatting data from Format.ps1xml
formatting files, such as those in the $PSHOME
directory, formatting data for modules that you import into the session, and formatting data for commands that you import into your session by using the Import-PSSession
cmdlet.
EXAMPLE
Get-FormatData -TypeName 'System.Management.Automation.Cmd*'
Get-Host
DESCRIPTION
The Get-Host cmdlet gets an object that represents the program that is hosting Windows PowerShell.
EXAMPLE
Get-Host
OUTPUT
Name : ConsoleHost
Version : 2.0
InstanceId : e4e0ab54-cc5e-4261-9117-4081f20ce7a2
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : en-US
CurrentUICulture : en-US
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
Get-Member
DESCRIPTION
The Get-Member cmdlet gets the members, the properties and methods, of objects.
EXAMPLE
Get-Service | Get-Member
OUTPUT
TypeName: System.Service.ServiceController#StartupType
Name MemberType Definition
---- ---------- ----------
Name AliasProperty Name = ServiceName
RequiredServices AliasProperty RequiredServices = ServicesDependedOn
Disposed Event System.EventHandler Disposed(System.Object, System.EventArgs)
Close Method void Close()
Continue Method void Continue()
Dispose Method void Dispose(), void IDisposable.Dispose()
Equals Method bool Equals(System.Object obj)
ExecuteCommand Method void ExecuteCommand(int command)
GetHashCode Method int GetHashCode()
GetLifetimeService Method System.Object GetLifetimeService()
GetType Method type GetType()
InitializeLifetimeService Method System.Object InitializeLifetimeService()
Pause Method void Pause()
Refresh Method void Refresh()
Start Method void Start(), void Start(string[] args)
Stop Method void Stop()
WaitForStatus Method void WaitForStatus(System.ServiceProcess.ServiceControllerSt...
BinaryPathName Property System.String {get;set;}
CanPauseAndContinue Property bool CanPauseAndContinue {get;}
CanShutdown Property bool CanShutdown {get;}
CanStop Property bool CanStop {get;}
Container Property System.ComponentModel.IContainer Container {get;}
DelayedAutoStart Property System.Boolean {get;set;}
DependentServices Property System.ServiceProcess.ServiceController[] DependentServices {get;}
Description Property System.String {get;set;}
DisplayName Property string DisplayName {get;set;}
MachineName Property string MachineName {get;set;}
ServiceHandle Property System.Runtime.InteropServices.SafeHandle ServiceHandle {get;}
ServiceName Property string ServiceName {get;set;}
ServicesDependedOn Property System.ServiceProcess.ServiceController[] ServicesDependedOn {get;}
ServiceType Property System.ServiceProcess.ServiceType ServiceType {get;}
Site Property System.ComponentModel.ISite Site {get;set;}
StartType Property System.ServiceProcess.ServiceStartMode StartType {get;}
StartupType Property Microsoft.PowerShell.Commands.ServiceStartupType {get;set;}
Status Property System.ServiceProcess.ServiceControllerStatus Status {get;}
UserName Property System.String {get;set;}
ToString ScriptMethod System.Object ToString();
Get-PSBreakpoint
DESCRIPTION
The Get-PSBreakPoint cmdlet gets the breakpoints that are set in the current session. You can use the cmdlet parameters to get particular breakpoints.
EXAMPLE
Get-PSBreakpoint
CLICK ON THE BANNER TO CHECK OUT OUR FREE AND PREMIUM TOOLS HERE
Get-PSCallStack
DESCRIPTION
The Get-PSCallStack cmdlet displays the current call stack.
Although it is designed to be used with the Windows PowerShell debugger, you can use this cmdlet to display the call stack in a script or function outside of the debugger.
EXAMPLE
Examples are quite lengthy
Many Examples Here
Get-Random
DESCRIPTION
The Get-Random cmdlet gets a randomly selected number. If you submit a collection of objects to Get-Random, it gets one or more randomly selected objects from the collection.
EXAMPLE
Get-Random -Maximum 100
OUTPUT
47
Get-Runspace
DESCRIPTION
The Get-Runspace cmdlet gets active runspaces in a PowerShell host process.
EXAMPLE
Get-Runspace
OUTPUT
Id Name ComputerName Type State Availability
-- ---- ------------ ---- ----- ------------
1 Runspace1 localhost Local Opened Busy
2 Runspace2 localhost Local Opened Available
3 Runspace3 localhost Local Opened Available
Get-RunspaceDebug
DESCRIPTION
The Get-RunspaceDebug cmdlet shows runspace debugging options.
EXAMPLE
Get-RunspaceDebug
OUTPUT
Id Name Enabled BreakAll
-- ---- ------- --------
1 Runspace1 False False
Get-TraceSource
DESCRIPTION
The Get-TraceSource cmdlet gets the trace sources for PowerShell components that are currently in use. You can use the data to determine which PowerShell components you can trace. When tracing, the component generates detailed messages about each step in its internal processing. Developers use the trace data to monitor data flow, program execution, and errors.
EXAMPLE
Get-TraceSource -Name "*provider*"
Get-TypeData
DESCRIPTION
The Get-TypeData cmdlet gets the extended type data in the current session. This includes type data that was added to the session by Types.ps1xml file and dynamic type data that was added by using the parameter of the Update-TypeData cmdlet.
EXAMPLE
Get-TypeData -TypeName System.IO.*
OUTPUT
TypeName Members
-------- -------
System.IO.DirectoryInfo {[Mode, System.Management.Automation.Runspaces.CodePropert…
System.IO.FileInfo {[Mode, System.Management.Automation.Runspaces.CodePropert…
Get-UICulture
DESCRIPTION
The Get-UICulture cmdlet gets information about the current user interface (UI) culture settings for Windows. The UI culture determines which text strings are used for user interface elements, such as menus and messages.
You can also use the Get-Culture cmdlet, which gets the current culture on the system. The culture determines the display format of items such as numbers, currency, and dates.
EXAMPLE
Get-UICulture
Get-Unique
DESCRIPTION
The Get-Unique cmdlet compares each item in a sorted list to the next item, eliminates duplicates, and returns only one instance of each item. The list must be sorted for the cmdlet to work properly.
Get-Unique is case-sensitive. As a result, strings that differ only in character casing are considered to be unique.
EXAMPLE
1,1,1,1,12,23,4,5,4643,5,3,3,3,3,3,3,3 | Sort-Object | Get-Unique
OUTPUT
1
3
4
5
12
23
4643
Get-Variable
DESCRIPTION
The Get-Variable cmdlet gets the PowerShell variables in the current console. You can retrieve just the values of the variables by specifying the ValueOnly parameter, and you can filter the variables returned by name.
EXAMPLE
Get-Variable -Include M*,P*
CLICK ON THE BANNER TO CHECK OUT OUR FREE AND PREMIUM TOOLS HERE
Group-Object
DESCRIPTION
The Group-Object cmdlet displays objects in groups based on the value of a specified property. Group-Object returns a table with one row for each property value and a column that displays the number of items with that value.
If you specify more than one property, Group-Object first groups them by the values of the first property, and then, within each property group, it groups by the value of the next property.
EXAMPLE
Group files by extension
$files = Get-ChildItem -Path $PSHOME -Recurse
$files | Group-Object -Property extension -NoElement | Sort-Object -Property Count -Descending
OUTPUT
Count Name
----- ----
365 .xml
231 .cdxml
197
169 .ps1xml
142 .txt
114 .psd1
63 .psm1
49 .xsd
36 .dll
15 .mfl
15 .mof
Import-Alias
DESCRIPTION
The Import-Alias cmdlet imports an alias list from a file.
Beginning in Windows PowerShell 3.0, as a security feature, Import-Alias does not overwrite existing aliases by default. To overwrite an existing alias, after assuring that the contents of the alias file is safe, use the Force parameter.
EXAMPLE
Import-Alias test.txt
Import-Clixml
DESCRIPTION
The Import-Clixml
cmdlet imports a Common Language Infrastructure (CLI) XML file with data that represents Microsoft .NET Framework objects and creates the PowerShell objects. For more information about CLI, see Language independence.
EXAMPLE
Get-Process | Export-Clixml -Path .\pi.xml
$Processes = Import-Clixml -Path .\pi.xml
Import-Csv
DESCRIPTION
The Import-Csv cmdlet creates table-like custom objects from the items in CSV files. Each column in the CSV file becomes a property of the custom object and the items in rows become the property values. Import-Csv works on any CSV file, including files that are generated by the Export-Csv cmdlet.
EXAMPLE
Get-Process | Export-Csv -Path .\Processes.csv
$P = Import-Csv -Path .\Processes.csv
$P | Format-Table
OUTPUT
Name SI Handles VM WS PM NPM Path
---- -- ------- -- -- -- --- ----
ApplicationFrameHost 4 407 2199293489152 15884288 15151104 23792 C:\WINDOWS\system32\ApplicationFrameHost.exe
wininit 0 157 2199112204288 4591616 1630208 10376
winlogon 4 233 2199125549056 7659520 2826240 10992 C:\WINDOWS\System32\WinLogon.exe
WinStore.App 4 846 873435136 33652736 26607616 55432 C:\Program Files\WindowsApps\Microsoft.WindowsStore_11712.1001.13.0_x64__8weky...
WmiPrvSE 0 201 2199100219392 8830976 3297280 10632 C:\WINDOWS\system32\wbem\wmiprvse.exe
WmiPrvSE 0 407 2199157727232 18509824 12922880 16624 C:\WINDOWS\system32\wbem\wmiprvse.exe
WUDFHost 0 834 2199310204928 51945472 87441408 24984 C:\Windows\System32\WUDFHost.exe
Import-LocalizedData
DESCRIPTION
The Import-LocalizedData cmdlet dynamically retrieves strings from a subdirectory whose name matches the UI language set for the current user of the operating system. It is designed to enable scripts to display user messages in the UI language selected by the current user.
EXAMPLE
Import-LocalizedData -BindingVariable "Messages"
Import-PowerShellDataFile
DESCRIPTION
The Import-PowerShellDataFile cmdlet safely imports key-value pairs from hashtables defined in a .PSD1 file. The values could be imported using Invoke-Expression on the contents of the file. However, Invoke-Expression runs any code contained in the file. This could produce unwanted results or execute unsafe code. Import-PowerShellDataFile imports the data without invoking the code. By default there is a 500 key limit but can be bypassed with the SkipLimitCheck switch.
EXAMPLE
Get-Content .\Configuration.psd1
$config = Import-PowerShellDataFile .\Configuration.psd1
$config.AllNodes
OUTPUT
@{
AllNodes = @(
@{
NodeName = 'DSC-01'
}
@{
NodeName = 'DSC-02'
}
)
}
Name Value
---- -----
NodeName DSC-01
NodeName DSC-02
Import-PSSession
DESCRIPTION
The Import-PSSession cmdlet imports commands , such as cmdlets, functions, and aliases, from a PSSession on a local or remote computer into the current session. You can import any command that the Get-Command cmdlet can find in the PSSession.
Use an Import-PSSession command to import commands from a customized shell, such as a Microsoft Exchange Server shell, or from a session that includes Windows PowerShell modules and snap-ins or other elements that are not in the current session.
EXAMPLE
$S = New-PSSession -ComputerName Server01
Import-PSSession -Session $S
Invoke-Expression
DESCRIPTION
The Invoke-Expression
cmdlet evaluates or runs a specified string as a command and returns the results of the expression or command. Without Invoke-Expression
, a string submitted at the command line is returned (echoed) unchanged.
Expressions are evaluated and run in the current scope. For more information, see about_Scopes.
EXAMPLE
$Command = "Get-Process"
Invoke-Expression $Command
OUTPUT
Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
296 4 1572 1956 20 0.53 1348 AdtAgent
270 6 1328 800 34 0.06 2396 alg
67 2 620 484 20 0.22 716 ati2evxx
1060 15 12904 11840 74 11.48 892 CcmExec
1400 33 25280 37544 223 38.44 2564 communicator
Invoke-RestMethod
DESCRIPTION
The Invoke-RestMethod cmdlet sends HTTP and HTTPS requests to Representational State Transfer (REST) web services that return richly structured data.
PowerShell formats the response based to the data type. For an RSS or ATOM feed, PowerShell returns the Item or Entry XML nodes. For JavaScript Object Notation (JSON) or XML, PowerShell converts, or deserializes, the content into [PSCustomObject] objects.
EXAMPLE
Invoke-RestMethod -Uri https://blogs.msdn.microsoft.com/powershell/feed/ |
Format-Table -Property Title, pubDate
OUTPUT
Title pubDate
----- -------
Join the PowerShell 10th Anniversary Celebration! Tue, 08 Nov 2016 23:00:04 +0000
DSC Resource Kit November 2016 Release Thu, 03 Nov 2016 00:19:07 +0000
PSScriptAnalyzer Community Call - Oct 18, 2016 Thu, 13 Oct 2016 17:52:35 +0000
New Home for In-Box DSC Resources Sat, 08 Oct 2016 07:13:10 +0000
New Social Features on Gallery Fri, 30 Sep 2016 23:04:34 +0000
PowerShellGet and PackageManagement in PowerShell Gallery and GitHub Thu, 29 Sep 2016 22:21:42 +0000
PowerShell Security at DerbyCon Wed, 28 Sep 2016 01:13:19 +0000
DSC Resource Kit September Release Thu, 22 Sep 2016 00:25:37 +0000
PowerShell DSC and implicit remoting broken in KB3176934 Tue, 23 Aug 2016 15:07:50 +0000
PowerShell on Linux and Open Source! Thu, 18 Aug 2016 15:32:02 +0000
Invoke-WebRequest
DESCRIPTION
The Invoke-WebRequest cmdlet sends HTTP and HTTPS requests to a web page or web service. It parses the response and returns collections of links, images, and other significant HTML elements.
You can use this to download files using PowerShell.
https://stackoverflow.com/questions/51225598/downloading-a-file-with-powershell
This cmdlet was introduced in PowerShell 3.0.
EXAMPLE
Invoke-WebRequest $myDownloadUrl -OutFile c:\file.ext
Measure-Command
DESCRIPTION
The Measure-Command cmdlet runs a script block or cmdlet internally, times the execution of the operation, and returns the execution time.
EXAMPLE
Measure-Command { Get-ChildItem -Path C:\Windows\*.txt -Recurse }
OUTPUT
Days : 0
Hours : 0
Minutes : 0
Seconds : 8
Milliseconds : 618
Ticks : 86182763
TotalDays : 9.9748568287037E-05
TotalHours : 0.00239396563888889
TotalMinutes : 0.143637938333333
TotalSeconds : 8.6182763
TotalMilliseconds : 8618.2763
Measure-Object
DESCRIPTION
The Measure-Object cmdlet calculates the property values of certain types of object. Measure-Object performs three types of measurements, depending on the parameters in the command.
The Measure-Object cmdlet performs calculations on the property values of objects. You can use Measure-Object to count objects or count objects with a specified Property. You can also use Measure-Object to calculate the Minimum, Maximum, Sum, StandardDeviation and Average of numeric values. For String objects, you can also use Measure-Object to count the number of lines, words, and characters.
EXAMPLE
"One", "Two", "Three", "Four" | Set-Content -Path C:\Temp\tmp.txt
Get-Content C:\Temp\tmp.txt | Measure-Object -Character -Line -Word
OUTPUT
Lines Words Characters Property
----- ----- ---------- --------
4 4 15
New-Alias
DESCRIPTION
The New-Alias
cmdlet creates a new alias in the current PowerShell session. Aliases created by using New-Alias
are not saved after you exit the session or close PowerShell. You can use the Export-Alias
cmdlet to save your alias information to a file. You can later use Import-Alias
to retrieve that saved alias information.
EXAMPLE
New-Alias -Name "List" Get-ChildItem
New-Event
DESCRIPTION
The New-Event cmdlet creates a new custom event.
You can use custom events to notify users about state changes in your program and any change that your program can detect, including hardware or system conditions, application status, disk status, network status, or the completion of a background job.
EXAMPLE
New-Event -SourceIdentifier Timer -Sender windows.timer -MessageData "Test"
New-Guid
DESCRIPTION
The New-Guid cmdlet creates a random globally unique identifier (GUID). If you need a unique ID in a script, you can create a GUID, as needed.
EXAMPLE
New-Guid
New-Object
DESCRIPTION
The New-Object cmdlet creates an instance of a .NET Framework or COM object.
You can specify either the type of a .NET Framework class or a ProgID of a COM object. By default, you type the fully qualified name of a .NET Framework class and the cmdlet returns a reference to an instance of that class. To create an instance of a COM object, use the ComObject parameter and specify the ProgID of the object as its value.
EXAMPLE
New-Object -TypeName System.Version -ArgumentList "1.2.3.4"
More Examples Here
OUTPUT
Major Minor Build Revision
----- ----- ----- --------
1 2 3 4
New-TemporaryFile
DESCRIPTION
This cmdlet creates temporary files that you can use in scripts.
The New-TemporaryFile cmdlet creates an empty file that has the .tmp file name extension. This cmdlet names the file tmp<NNNN>.tmp, where <NNNN> is a random hexadecimal number. The cmdlet creates the file in your TEMP folder.
EXAMPLE
$TempFile = New-TemporaryFile
CLICK ON THE BANNER TO CHECK OUT OUR FREE AND PREMIUM TOOLS HERE
New-TimeSpan
DESCRIPTION
The New-TimeSpan cmdlet creates a TimeSpan object that represents a time interval. You can use a TimeSpan object to add or subtract time from DateTime objects.
EXAMPLE
$TimeSpan = New-TimeSpan -Hours 1 -Minutes 25
$TimeSpan
OUTPUT
Days : 0
Hours : 1
Minutes : 25
Seconds : 0
Milliseconds : 0
Ticks : 51000000000
TotalDays : 0.0590277777777778
TotalHours : 1.41666666666667
TotalMinutes : 85
TotalSeconds : 5100
TotalMilliseconds : 5100000
New-Variable
DESCRIPTION
The New-Variable cmdlet creates a new variable in Windows PowerShell. You can assign a value to the variable while creating it or assign or change the value after it is created.
You can use the parameters of New-Variable to set the properties of the variable, set the scope of a variable, and determine whether variables are public or private.
Typically, you create a new variable by typing the variable name and its value, such as $Var = 3, but you can use the New-Variable cmdlet to use its parameters.
EXAMPLE
New-Variable -Name "zipcode" -Value 98033
Out-File
DESCRIPTION
The Out-File
cmdlet sends output to a file. It implicitly uses PowerShell's formatting system to write to the file. The file receives the same display representation as the terminal. This means that the output may not be ideal for programmatic processing unless all input objects are strings. When you need to specify parameters for the output, use Out-File
rather than the redirection operator (>
). For more information about redirection, see about_Redirection.
EXAMPLE
Get-Process | Out-File -FilePath .\Process.txt
Get-Content -Path .\Process.txt
OUTPUT
NPM(K) PM(M) WS(M) CPU(s) Id SI ProcessName
------ ----- ----- ------ -- -- -----------
29 22.39 35.40 10.98 42764 9 Application
53 99.04 113.96 0.00 32664 0 CcmExec
27 96.62 112.43 113.00 17720 9 Code
Out-GridView
DESCRIPTION
The Out-GridView cmdlet sends the output from a command to a grid view window where the output is displayed in an interactive table.
EXAMPLE
Get-Process | Out-GridView
Out-Printer
DESCRIPTION
The Out-Printer
cmdlet sends output to the default printer or to an alternate printer, if one is specified.
EXAMPLE
Get-Content -Path ./readme.txt | Out-Printer
Out-String
DESCRIPTION
The Out-String
cmdlet converts input objects into strings. By default, Out-String
accumulates the strings and returns them as a single string, but you can use the Stream parameter to direct Out-String
to return one line at a time or create an array of strings. This cmdlet lets you search and manipulate string output as you would in traditional shells when object manipulation is less convenient.
This sometimes work better that ".ToString()"
EXAMPLE
Get-Content C:\Temp\File.txt | Out-String
If multiple lines are pulled from the test file, it makes the object a string instead of an object that still needs to be converted.
Read-Host
DESCRIPTION
The Read-Host cmdlet reads a line of input from the console (stdin). You can use it to prompt a user for input. Because you can save the input as a secure string, you can use this cmdlet to prompt users for secure data, such as passwords.
EXAMPLE
$Age = Read-Host "Please enter your age"
OUTPUT
> Please enter your age: |
Register-EngineEvent
DESCRIPTION
The Register-EngineEvent cmdlet subscribes to events that are generated by the PowerShell engine and the New-Event cmdlet. Use the SourceIdentifier parameter to specify the event.
EXAMPLE
Register-EngineEvent -SourceIdentifier PowerShell.Exiting -SupportEvent -Action { Get-History | Export-Clixml $Home\history.clixml }
Register-ObjectEvent
DESCRIPTION
The Register-ObjectEvent cmdlet subscribes to events that are generated by .NET objects on the local computer or on a remote computer.
EXAMPLE
$queryParameters = '__InstanceCreationEvent', (New-Object TimeSpan 0,0,1),
"TargetInstance isa 'Win32_Process'"
$Query = New-Object System.Management.WqlEventQuery -ArgumentList $queryParameters
$ProcessWatcher = New-Object System.Management.ManagementEventWatcher $Query
Register-ObjectEvent -InputObject $ProcessWatcher -EventName "EventArrived"
Remove-Event
DESCRIPTION
The Remove-Event cmdlet deletes events from the event queue in the current session.
This cmdlet deletes only the events currently in the queue. To cancel event registrations or unsubscribe, use the Unregister-Event cmdlet.
EXAMPLE
Remove-Event -SourceIdentifier "ProcessStarted"
Remove-PSBreakpoint
DESCRIPTION
The Remove-PSBreakpoint cmdlet deletes a breakpoint. Enter a breakpoint object or a breakpoint ID.
When you remove a breakpoint, the breakpoint object is no longer available or functional. If you have saved a breakpoint object in a variable, the reference still exists, but the breakpoint does not function.
EXAMPLE
Get-PSBreakpoint | Remove-PSBreakpoint
Remove-TypeData
DESCRIPTION
The Remove-TypeData cmdlet deletes extended type data from the current session. This cmdlet affects only the current session and sessions that are created in the current session.
EXAMPLE
Remove-TypeData -TypeName System.Array
Remove-Variable
DESCRIPTION
The Remove-Variable cmdlet deletes a variable and its value from the scope in which it is defined, such as the current session. You cannot use this cmdlet to delete variables that are set as constants or those that are owned by the system.
EXAMPLE
$Processes = Get-Process
Remove-Variable Processes
Select-Object
DESCRIPTION
The Select-Object cmdlet selects specified properties of an object or set of objects. It can also select unique objects, a specified number of objects, or objects in a specified position in an array.
EXAMPLE
Get-Process | Select-Object -Property ProcessName, Id, WS
Select-String
DESCRIPTION
The Select-String cmdlet uses regular expression matching to search for text patterns in input strings and files. You can use Select-String similar to grep in UNIX or findstr.exe in Windows.
EXAMPLE
'Hello', 'HELLO' | Select-String -Pattern 'HELLO' -CaseSensitive -SimpleMatch
Select-Xml
DESCRIPTION
The Select-Xml cmdlet lets you use XPath queries to search for text in XML strings and documents. Enter an XPath query, and use the Content, Path, or Xml parameter to specify the XML to be searched.
EXAMPLE
$Path = "$Pshome\Types.ps1xml"
$XPath = "/Types/Type/Members/AliasProperty"
Select-Xml -Path $Path -XPath $Xpath | Select-Object -ExpandProperty Node
OUTPUT
Name ReferencedMemberName
---- --------------------
Count Length
Name Key
Name ServiceName
RequiredServices ServicesDependedOn
ProcessName Name
Handles Handlecount
VM VirtualSize
WS WorkingSetSize
Name ProcessName
Handles Handlecount
VM VirtualMemorySize
WS WorkingSet
PM PagedMemorySize
NPM NonpagedSystemMemorySize
Name __Class
Namespace ModuleName
Send-MailMessage
DESCRIPTION
The Send-MailMessage
cmdlet sends an email message from within PowerShell.
You must specify a Simple Mail Transfer Protocol (SMTP) server or the Send-MailMessage
command fails. Use the SmtpServer parameter or set the $PSEmailServer
variable to a valid SMTP server. The value assigned to $PSEmailServer
is the default SMTP setting for PowerShell. For more information, see about_Preference_Variables.
EXAMPLE
Send-MailMessage -From 'User01 <user01@fabrikam.com>' -To 'User02 <user02@fabrikam.com>', 'User03 <user03@fabrikam.com>' -Subject 'Sending the Attachment' -Body "Forgot to send the attachment. Sending now." -Attachments .\data.csv -Priority High -DeliveryNotificationOption OnSuccess, OnFailure -SmtpServer 'smtp.fabrikam.com'
Set-Alias
DESCRIPTION
The Set-Alias
cmdlet creates or changes an alias for a cmdlet or a command, such as a function, script, file, or other executable. An alias is an alternate name that refers to a cmdlet or command. For example, sal
is the alias for the Set-Alias
cmdlet. For more information, see about_Aliases.
EXAMPLE
Set-Alias -Name list -Value Get-ChildItem
Set-Date
DESCRIPTION
The Set-Date
cmdlet changes the system date and time on the computer to a date and time that you specify. You can specify a new date and/or time by typing a string or by passing a DateTime or TimeSpan object to Set-Date
. To specify a new date or time, use the Date parameter. To specify a change interval, use the Adjust parameter.
EXAMPLE
Set-Date -Date (Get-Date).AddDays(3)
Set-Date -Adjust -0:10:0 -DisplayHint Time
Set-PSBreakpoint
DESCRIPTION
The Set-PSBreakpoint cmdlet sets a breakpoint in a script or in any command run in the current session. You can use Set-PSBreakpoint to set a breakpoint before executing a script or running a command, or during debugging, when stopped at another breakpoint.
EXAMPLE
Set-PSBreakpoint -Script "sample.ps1" -Line 5
Set-TraceSource
DESCRIPTION
The Set-TraceSource cmdlet configures, starts, and stops a trace of a PowerShell component. You can use it to specify which components will be traced and where the tracing output is sent.
EXAMPLE
Set-TraceSource -Name "ParameterBinding" -Option ExecutionFlow -PSHost -ListenerOption "ProcessId,TimeStamp"
Set-Variable
DESCRIPTION
The Set-Variable cmdlet assigns a value to a specified variable or changes the current value. If the variable does not exist, the cmdlet creates it.
EXAMPLE
Set-Variable -Name "desc" -Value "A description"
Get-Variable -Name "desc"
OUTPUT
Name Value
---- -----
desc A description
Show-Command
DESCRIPTION
The Show-Command cmdlet lets you create a PowerShell command in a command window. You can use the features of the command window to run the command or have it return the command to you.
EXAMPLE
Show-Command -Name "Invoke-Command"
Sort-Object
DESCRIPTION
The Sort-Object
cmdlet sorts objects in ascending or descending order based on object property values. If sort properties are not included in a command, PowerShell uses default sort properties of the first input object. If the type of the input object has no default sort properties, PowerShell attempts to compare the objects themselves. For more information, see the Notes section.
EXAMPLE
Sort by Size
Get-ChildItem -Path C:\Test -File | Sort-Object -Property Length
OUTPUT
Directory: C:\Test
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 2/13/2019 13:26 20 Bfile.txt
-a---- 2/12/2019 16:24 23 Zsystemlog.log
-a---- 2/13/2019 08:55 26 anotherfile.txt
-ar--- 2/12/2019 14:31 27 ReadOnlyFile.txt
-a---- 2/1/2019 08:43 183 CreateTestFile.ps1
-a---- 2/12/2019 15:40 118014 Command.txt
Start-Sleep
DESCRIPTION
The Start-Sleep cmdlet suspends the activity in a script or session for the specified period of time. You can use it for many tasks, such as waiting for an operation to complete or pausing before repeating an operation.
EXAMPLE
Start-Sleep -s 15
Tee-Object
DESCRIPTION
The Tee-Object cmdlet redirects output, that is, it sends the output of a command in two directions (like the letter T). It stores the output in a file or variable and also sends it down the pipeline. If Tee-Object is the last command in the pipeline, the command output is displayed at the prompt.
EXAMPLE
Get-Process | Tee-Object -FilePath "C:\Test1\testfile2.txt"
OUTPUT
Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
83 4 2300 4520 39 0.30 4032 00THotkey
272 6 1400 3944 34 0.06 3088 alg
81 3 804 3284 21 2.45 148 ApntEx
81 4 2008 5808 38 0.75 3684 Apoint
...
Trace-Command
DESCRIPTION
The Trace-Command cmdlet configures and starts a trace of the specified expression or command. It works like Set-TraceSource, except that it applies only to the specified command.
EXAMPLE
Trace-Command -Name metadata,parameterbinding,cmdlet -Expression {Get-Process Notepad} -PSHost
Unblock-File
DESCRIPTION
The Unblock-File cmdlet lets you open files that were downloaded from the Internet. It unblocks PowerShell script files that were downloaded from the Internet so you can run them, even when the PowerShell execution policy is RemoteSigned. By default, these files are blocked to protect the computer from untrusted files.
EXAMPLE
Unblock-File -Path C:\Users\User01\Documents\Downloads\PowerShellTips.chm
Unregister-Event
DESCRIPTION
The Unregister-Event cmdlet cancels an event subscription that was created by using the Register-EngineEvent, Register-ObjectEvent, or Register-WmiEvent cmdlet.
EXAMPLE
Unregister-Event -SourceIdentifier "ProcessStarted"
Update-FormatData
DESCRIPTION
The Update-FormatData
cmdlet reloads the formatting data from formatting files into the current session. This cmdlet lets you update the formatting data without restarting PowerShell.
Without parameters, Update-FormatData
reloads the formatting files that it loaded previously. You can use the parameters of Update-FormatData
to add new formatting files to the session.
EXAMPLE
Update-FormatData -AppendPath "trace.format.ps1xml, log.format.ps1xml"
Update-List
DESCRIPTION
The Update-List cmdlet adds, removes, or replaces items in a property value of an object and returns the updated object. This cmdlet is designed for properties that contain collections of objects.
The Add and Remove parameters add individual items to and remove them from the collection.
EXAMPLE
Examples are quite lengthy. See them here
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/update-list
Update-TypeData
DESCRIPTION
The Update-TypeData cmdlet updates the extended type data in the session by reloading the Types.ps1xml files into memory and adding new extended type data.
EXAMPLE
Update-TypeData -PrependPath TypesA.types.ps1xml, TypesB.types.ps1xml
Update-TypeData -PrependPath TypesA.types.ps1xml
Wait-Debugger
DESCRIPTION
Stops the PowerShell script execution engine at the point immediately after the Wait-Debugger cmdlet and waits for a debugger to be attached. This is similar to using Enable-RunspaceDebug -BreakAll in a DSC resource but breaks at a specific point in the script.
Make sure you remove the Wait-Debugger
lines after you are done. A running script appears to be hung when it is stopped at a Wait-Debugger
.
EXAMPLE
Examples are quite lengthy. See them here.
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/wait-debugger?view=powershell-7.2
Wait-Event
DESCRIPTION
The Wait-Event cmdlet suspends execution of a script or function until a particular event is raised. Execution resumes when the event is detected. To cancel the wait, press CTRL+C.
EXAMPLE
Wait-Event -SourceIdentifier "ProcessStarted"
Write-Debug
DESCRIPTION
The Write-Debug cmdlet writes debug messages to the host from a script or command.
EXAMPLE
Write-Debug "Cannot open file."
Write-Error
DESCRIPTION
The Write-Error cmdlet declares a non-terminating error. By default, errors are sent in the error stream to the host program to be displayed, along with output.
EXAMPLE
Write-Error "Access denied."
Write-Host
DESCRIPTION
The Write-Host cmdlet's primary purpose is to produce for-(host)-display-only output, such as printing colored text like when prompting the user for input in conjunction with Read-Host. Write-Host uses the ToString() method to write the output. By contrast, to output data to the pipeline, use Write-Output or implicit output.
EXAMPLE
Write-Host "no newline test " -NoNewline
Write-Host "second string"
OUTPUT
no newline test second string
Write-Information
DESCRIPTION
The Write-Information cmdlet specifies how PowerShell handles information stream data for a command.
EXAMPLE
Write-Information -MessageData "Processes starting with 'P'" -InformationAction Continue
Get-Process -Name p*
OUTPUT
Processes starting with 'P'
18 19.76 15.16 0.00 6232 0 PFERemediation
20 8.92 25.15 0.00 24944 0 policyHost
9 1.77 7.64 0.00 1780 0 powercfg
10 26.67 32.18 0.00 7028 0 powercfg
8 26.55 31.59 0.00 13600 0 powercfg
9 1.66 7.55 0.00 22620 0 powercfg
21 6.17 4.54 202.20 12536 1 PowerMgr
42 84.26 12.71 2,488.84 20588 1 powershell
27 47.07 45.38 2.05 25988 1 powershell
27 24.45 5.31 0.00 12364 0 PresentationFontCache
92 112.04 13.36 82.30 13176 1 pwsh
106 163.73 93.21 302.25 14620 1 pwsh
227 764.01 92.16 1,757.22 25328 1 pwsh
Write-Output
DESCRIPTION
Writes the specified objects to the pipeline. If Write-Output
is the last command in the pipeline, the objects are displayed in the console.
EXAMPLE
$P = Get-Process
Write-Output $P
Write-Progress
DESCRIPTION
The Write-Progress
cmdlet displays a progress bar in a PowerShell command window that depicts the status of a running command or script. You can select the indicators that the bar reflects and the text that appears above and below the progress bar.
EXAMPLE
for ($i = 1; $i -le 100; $i++ )
{
Write-Progress -Activity "Search in Progress" -Status "$i% Complete:" -PercentComplete $i
Start-Sleep -Milliseconds 250
}
Write-Verbose
DESCRIPTION
The Write-Verbose cmdlet writes text to the verbose message stream in PowerShell. Typically, the verbose message stream is used to deliver more in depth information about command processing.
EXAMPLE
Write-Verbose -Message "Searching the Application Event Log."
Write-Verbose -Message "Searching the Application Event Log." -Verbose
Write-Warning
DESCRIPTION
The Write-Warning cmdlet writes a warning message to the PowerShell host. The response to the warning depends on the value of the user's $WarningPreference variable and the use of the WarningAction common parameter.
EXAMPLE
Write-Warning "This is only a test warning."
Source : Microsoft.com
CLICK ON THE BANNER TO CHECK OUT OUR FREE AND PREMIUM TOOLS HERE