Skip to main content

Piping

Updated over 10 months ago

Piping lets you use the result of the previous command. This can shorten your scripts since it requires less text and multiple commands can be written on a single line.

Example

Here is an example of piping that shows a Get-List command for list "Documents" in a site collection:

# Connect to the SharePoint site and retrieve the "Documents" list
$srcList = Connect-Site -Url "http://farm/sites/sitecollection" | Get-List -Name "Documents"

# List properties of the retrieved "Documents" list
Id : ab6a768d-3478-4302-8258-53f2c2637c12
Title : Documents
BaseType : Document Library
Source : /sites/sitecollection/
ContentApproval : False
RootFolder : /sites/sitecollection/Documents/
EnableAttachments : False
EnableVersioning : True
EnableMinorVersions : True
ForceCheckout : False
Site : http://farm/sites/sitecollection/
Did this answer your question?