All posts by Adam

Push-Location

NAME
    Push-Location

SYNOPSIS
    Adds the current location to the top of a list of locations (a “stack”).

SYNTAX
    Push-Location [[-LiteralPath] <string>] [-PassThru] [-StackName <string>] [-UseTransaction] [<CommonParameters>]

    Push-Location [[-Path] <string>] [-PassThru] [-StackName <string>] [-UseTransaction] [<CommonParameters>]

DESCRIPTION
    The Push-Location cmdlet adds (“pushes”) the current location to the top of a list of locations, called a “stack.” You can push the current location onto a default stack or onto a stack that you create. If you specify a path, Push-Location pushes the current location onto the stack and then changes the current location to the location specified by the path. You cannot push a location onto the stack unless it is the current location.

PARAMETERS
    -LiteralPath <string>
        Specifies the path to the new location. Unlike the Path parameter, the value of the LiteralPath parameter is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences.

        Required?                    false
        Position?                    1
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -PassThru [<SwitchParameter>]
        Passes an object representing the location to the pipeline. By default, this cmdlet does not generate any output.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Path <string>
        Changes your location to the location specified by this path after it adds (pushes) the current location onto the top of the stack. Enter a path to any location whose provider supports this cmdlet. Wildcards are permitted. The parameter name (“Path”) is optional.

        Required?                    false
        Position?                    1
        Default value
        Accept pipeline input?     true (ByValue, ByPropertyName)
        Accept wildcard characters? false

    -StackName <string>
        Specifies the name of a stack. The current location is pushed onto this stack, and this stack becomes the current stack. If the stack does not yet exist, it is created.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -UseTransaction [<SwitchParameter>]
        Includes the command in the active transaction. This parameter is valid only when a transaction is in progress. For more information, see about_transactions.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer and OutVariable. For more information, type,
        “Get-Help about_CommonParameters“.

INPUTS
    System.String
        You can pipe a string that contains a path (but not a literal path) to Push-Location.

OUTPUTS
    None or System.Management.Automation.PathInfo
        When you use the PassThru parameter, Push-Location generates a System.Management.Automation.PathInfo object that represents the location. Otherwise, this cmdlet does not generate any output.

NOTES

        You can also refer to Push-Location by its built-in Alias, “pushd”. For more information, see about_aliases.

        A “stack” is a “last-in, first-out” (LIFO) data structure. It is like a vertical list in which only the top item is accessible. You can add (“push”) items only to the top of the stack, and you can retrieve (“pop”) items only from the top of the stack. To get to items below the top, you must retrieve all the items above.

        The Push-Location cmdlet is designed to work with the data exposed by any provider. To list the providers available in your session, type “Get-PSProvider“. For more information, see about_providers.

    ————————– EXAMPLE 1 ————————–

    C:\PS>Push-Location C:\Windows

    Description
    ———–
    This command pushes the current location onto the default stack and then changes the location to C:\Windows.

    ————————– EXAMPLE 2 ————————–

    C:\PS>Push-Location HKLM:\Software\Policies -StackName RegFunction

    Description
    ———–
    This command pushes the current location onto the RegFunction stack and changes the current location to the HKLM:\Software\Policies location. This command shows that you can use Push-Location with the Windows PowerShell Registry provider.

    ————————– EXAMPLE 3 ————————–

    C:\PS>Push-Location

    Description
    ———–
    This command pushes the current location onto the default stack.

    ————————– EXAMPLE 4 ————————–

    C:\PS>Push-Location ~ -StackName Stack2

    Description
    ———–
    This command pushes the current location onto a new stack named Stack2 and then changes the current location to the home directory (%USERPROFILE%), which is represented in the command by the tilde symbol (~) or $home. The Stack2 stack then becomes the current stack.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113370
    about_providers
    Pop-Location
    Set-Location
    Get-Location

Pop-Location

NAME
    Pop-Location

SYNOPSIS
    Changes 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 the Push-Location cmdlet.

SYNTAX
    Pop-Location [-PassThru] [-StackName <string>] [-UseTransaction] [<CommonParameters>]

DESCRIPTION
    The Pop-Location cmdlet changes the current location to the location most recently pushed onto the stack by using the Push-Location cmdlet. You can pop a location from the default stack or from a stack that you create by using a Push-Location command.

PARAMETERS
    -PassThru [<SwitchParameter>]
        Passes an object representing the location to the pipeline. By default, this cmdlet does not generate any output.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -StackName <string>
        Specifies an alternate stack. Pop-Location pops the most recently added location from this stack. This stack then becomes the current stack.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -UseTransaction [<SwitchParameter>]
        Includes the command in the active transaction. This parameter is valid only when a transaction is in progress. For more information, see about_transactions.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer and OutVariable. For more information, type,
        “Get-Help about_CommonParameters“.

INPUTS
    None
        You cannot pipe input to Pop-Location.

OUTPUTS
    None or System.Management.Automation.PathInfo
        When you use the PassThru parameter, Pop-Location generates a System.Management.Automation.PathInfo object that represents the location. Otherwise, this cmdlet does not generate any output.

NOTES

        You can also refer to Pop-Location by its built-in Alias, “popd”. For more information, see about_aliases.

        The Pop-Location cmdlet is designed to work with the data exposed by any provider. To list the providers available in your session, type “Get-PSProvider“. For more information, see about_providers.

    ————————– EXAMPLE 1 ————————–

    C:\PS>Pop-Location

    Description
    ———–
    This command changes your location to the location most recently added to the current stack.

    ————————– EXAMPLE 2 ————————–

    C:\PS>Pop-Location -StackName Stack2

    Description
    ———–
    This command changes your location to the location most recently added to the Stack2 stack.

    ————————– EXAMPLE 3 ————————–

    C:\PS>pushd HKLM:\Software\Microsoft\PowerShell

    pushd Cert:\LocalMachine\TrustedPublisher

    popd

    popd

    PS C:\> Push-Location HKLM:\Software\Microsoft\PowerShell

    PS HKLM:\Software\Microsoft\PowerShell> Push-Location Cert:\LocalMachine\TrustedPublisher

    PS cert:\LocalMachine\TrustedPublisher> popd

    PS HKLM:\Software\Microsoft\PowerShell> popd

    PS C:\ps-test>

    Description
    ———–
    These commands use the Push-Location and Pop-Location cmdlets to move between locations supported by different Windows PowerShell providers. The commands use the “pushd” Alias for Push-Location and the “popd” Alias for Pop-Location.

    The first command pushes the current file system location onto the stack and moves to the HKLM drive supported by the Windows PowerShell Registry provider. The second command pushes the Registry location onto the stack and moves to a location supported by the Windows PowerShell Certificate provider.

    The last two commands pop those locations off the stack. The first “popd” command returns to the Registry: drive, and the second command returns to the file system drive.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113369
    about_providers
    Push-Location
    Set-Location
    Get-Location

Out-String

NAME
    Out-String

SYNOPSIS
    Sends objects to the host as a series of strings.

SYNTAX
    Out-String [-InputObject <psobject>] [-Stream] [-Width <int>] [<CommonParameters>]

DESCRIPTION
    The Out-String cmdlet converts the objects that Windows PowerShell manages into an array of 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 string at a time. This cmdlet lets you search and manipulate string output as you would in traditional shells when object manipulation is less convenient.

PARAMETERS
    -InputObject <psobject>
        Specifies the objects to be written to a string. Enter a Variable that contains the objects, or type a command or expression that gets the objects.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     true (ByValue)
        Accept wildcard characters? false

    -Stream [<SwitchParameter>]
        Sends the strings for each object separately. By default, the strings for each object are accumulated and sent as a single string.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Width <int>
        Specifies the number of characters in each line of output. Any additional characters are truncated, not wrapped. If you omit this parameter, the width is determined by the characteristics of the host. The default for the PowerShell.exe host is 80 (characters).

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer and OutVariable. For more information, type,
        “Get-Help about_CommonParameters“.

INPUTS
    System.Management.Automation.PSObject
        You can pipe objects to Out-String.

OUTPUTS
    System.String
        Out-String returns the string that it creates from the input object.

NOTES

        The cmdlets that contain the Out verb (the Out cmdlets) do not format objects; they just render them and send them to the specified display destination. If you send an unformatted object to an Out cmdlet, the cmdlet sends it to a formatting cmdlet before rendering it.

        The Out cmdlets do not have parameters for names or file paths. To send data to an Out cmdlet, use a pipeline operator (|) to send the output of a Windows PowerShell command to the cmdlet. You can also store data in a Variable and use the InputObject parameter to pass the data to the cmdlet. For more information, see the examples.

    ————————– EXAMPLE 1 ————————–

    C:\PS>Get-Content C:\test1\testfile2.txt | Out-String

    Description
    ———–
    This command sends the content of the Testfile2.txt file to the console as a single string. It uses the Get-Content cmdlet to get the content of the file. The pipeline operator (|) sends the content to Out-String, which sends the content to the console as a string.

    ————————– EXAMPLE 2 ————————–

    C:\PS>$c = Get-Culture | Select-Object *

    C:\PS> Out-String -InputObject $c -Width 100

    Description
    ———–
    These commands get the regional settings for the current user and convert the data to strings. The first command uses the Get-Culture cmdlet to get the regional settings. The pipeline operator (|) sends the result to the Select-Object cmdlet, which selects all properties (*) of the culture object that Get-Culture retrieved. The command then stores the results in the $c Variable.

    The second command uses Out-String to convert the CultureInfo object to a series of strings (one string for each property). It uses the InputObject parameter to pass the $c Variable to Out-String. The width parameter is set to 100 characters per line to prevent truncation.

    ————————– EXAMPLE 3 ————————–

    C:\PS>Get-Alias | Out-String -Stream | Select-StringGet-Command

    Description
    ———–
    This command displays Aliases that include the phrase “Get-Command“. It uses the Get-Alias cmdlet to get a set of AliasInfo objects (one for each Alias in the current session). This example demonstrates the difference between working with objects and working with strings.

    The pipeline operator (|) sends the output of Get-Alias to Out-String, which converts the objects to a series of strings. It uses the Stream parameter to send each string individually, instead of concatenating them into a single string. Another pipeline operator sends the strings to Select-String, which selects the strings that include “Get-Command” anywhere in the string.

    If you omit the Stream parameter, the command displays all of the Aliases, because Select-String finds “Get-Command” in the single string that Out-String returns, and the formatter displays the string as a table.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113368
    Out-File
    Out-Null
    Out-Host
    Out-Printer
    Out-Default

Out-Printer

NAME
    Out-Printer

SYNOPSIS
    Sends output to a printer.

SYNTAX
    Out-Printer [[-Name] <string>] [-InputObject <psobject>] [<CommonParameters>]

DESCRIPTION
    The Out-Printer cmdlet sends output to the default printer or to an alternate printer, if one is specified.

PARAMETERS
    -InputObject <psobject>
        Specifies the objects to be sent to the printer. Enter a Variable that contains the objects, or type a command or expression that gets the objects.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     true (ByValue)
        Accept wildcard characters? false

    -Name <string>
        Specifies the alternate printer. The parameter name (“Name”) is optional.

        Required?                    false
        Position?                    1
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer and OutVariable. For more information, type,
        “Get-Help about_CommonParameters“.

INPUTS
    System.Management.Automation.PSObject
        You can pipe any object to Out-Printer.

OUTPUTS
    None
        Out-Printer does not return any objects.

NOTES

        You can also refer to Out-Printer by its built-in Alias, “lp”. For more information, see about_aliases.

        The cmdlets that contain the Out verb (the Out cmdlets) do not format objects; they just render them and send them to the specified display destination. If you send an unformatted object to an Out cmdlet, the cmdlet sends it to a formatting cmdlet before rendering it.

        The Out cmdlets do not have parameters for names or file paths. To send data to an Out cmdlet, use a pipeline operator (|) to send the output of a Windows PowerShell command to the cmdlet. You can also store data in a Variable and use the InputObject parameter to pass the data to the cmdlet. For more information, see the examples.

        Out-Printer sends data, but it does not emit any output objects. If you pipe the output of Out-Printer to Get-Member, Get-Member reports that no objects have been specified.

    ————————– EXAMPLE 1 ————————–

    C:\PS>Get-Content $pshome\about_signing.help.txt | Out-Printer

    Description
    ———–
    This command prints the content of the about_Signing Help topic to the default printer. This example shows you how to print a file, even though Out-Printer does not have a Path parameter.

    The command uses the Get-Content cmdlet to get the contents of the Help topic. The path includes $pshome, a built-in Variable that stores the installation directory for Windows PowerShell. A pipeline operator (|) passes the results to Out-Printer, which sends it to the default printer.

    ————————– EXAMPLE 2 ————————–

    C:\PS>”Hello, World” | Out-Printer -Name “\\Server01\Prt-6B Color”

    Description
    ———–
    This command prints “Hello, World” to the “Prt-6B Color” printer on Server01. This command uses the Name parameter to specify the alternate printer. Because the parameter name is optional, you can omit it.

    ————————– EXAMPLE 3 ————————–

    C:\PS>$h = Get-Help -full Get-WmiObject

    C:\PS> Out-Printer -InputObject $h

    Description
    ———–
    These commands print the full version of the Help topic for Get-WmiObject. The first command uses the Get-Help cmdlet to get the full version of the Help topic for Get-WmiObject and stores it in the $h Variable. The second command sends the content to the default printer. It uses the InputObject parameter to pass the value of the $h Variable to Out-Printer.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113367
    Out-Host
    Out-Null
    Out-String
    Out-File
    Out-Default

Out-Null

NAME
    Out-Null

SYNOPSIS
    Deletes output instead of sending it to the console.

SYNTAX
    Out-Null [-InputObject <psobject>] [<CommonParameters>]

DESCRIPTION
    The Out-Null cmdlet sends output to NULL, in effect, deleting it.

PARAMETERS
    -InputObject <psobject>
        Specifies the object that was sent to null (deleted). Enter a Variable that contains the objects, or type a command or expression that gets the objects.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     true (ByValue)
        Accept wildcard characters? false

    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer and OutVariable. For more information, type,
        “Get-Help about_CommonParameters“.

INPUTS
    System.Management.Automation.PSObject
        You can pipe any object to Out-Null.

OUTPUTS
    None
        Out-Null does not generate any output.

NOTES

        The cmdlets that contain the Out verb (the Out cmdlets) do not have parameters for names or file paths. To send data to an Out cmdlet, use a pipeline operator (|) to send the output of a Windows PowerShell command to the cmdlet. You can also store data in a Variable and use the InputObject parameter to pass the data to the cmdlet. For more information, see the examples.

        Out-Null does not return any output objects. If you pipe the output of Out-Null to Get-Member, Get-Member reports that no objects have been specified.

    ————————– EXAMPLE 1 ————————–

    C:\PS>Get-ChildItem | Out-Null

    Description
    ———–
    This command gets the items in the local directory, but then it discards them instead of passing them through the pipeline or displaying them at the command line. This is useful for discarding output that you do not need.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113366
    Out-Printer
    Out-Host
    Out-File
    Out-String
    Out-Default

Out-Host

NAME
    Out-Host

SYNOPSIS
    Sends output to the command line.

SYNTAX
    Out-Host [-InputObject <psobject>] [-Paging] [<CommonParameters>]

DESCRIPTION
    The Out-Host cmdlet sends output to the Windows PowerShell host for display. The host displays the output at the command line. Because Out-Host is the default, you do not need to specify it unless you want to use its parameters to change the display.

PARAMETERS
    -InputObject <psobject>
        Specifies the objects that are written to the console. Enter a Variable that contains the objects, or type a command or expression that gets the objects.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     true (ByValue)
        Accept wildcard characters? false

    -Paging [<SwitchParameter>]
        Displays one page of output at a time, and waits for user input before displaying the remaining pages, much like the traditional “more” command. By default, all of the output is displayed on a single page. The page size is determined by the characteristics of the host.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer and OutVariable. For more information, type,
        “Get-Help about_CommonParameters“.

INPUTS
    System.Management.Automation.PSObject
        You can pipe any object to Out-Host.

OUTPUTS
    None
        Out-Host does not generate any output. However, the host might display the objects that Out-Host sends to it.

NOTES

        You can also refer to Out-Host by its built-in Alias, “oh”. For more information, see about_aliases.

        The cmdlets that contain the Out verb (the Out cmdlets) do not format objects; they just render them and send them to the specified display destination. If you send an unformatted object to an Out cmdlet, the cmdlet sends it to a formatting cmdlet before rendering it.

        The Out cmdlets do not have parameters for names or file paths. To send data to an Out cmdlet, use a pipeline operator (|) to send the output of a Windows PowerShell command to the cmdlet. You can also store data in a Variable and use the InputObject parameter to pass the data to the cmdlet. For help, see the examples.

        Out-Host sends data, but it does not emit any output objects. If you pipe the output of Out-Host to Get-Member, Get-Member reports that no objects have been specified.

    ————————– EXAMPLE 1 ————————–

    C:\PS>Get-Process | Out-Host -Paging

    Description
    ———–
    This command displays the processes on the system one page at a time. It uses the Get-Process command to get the processes on the system. The pipeline operator (|) sends the results to Out-Host, which displays them at the console. The Paging parameter displays one page of data at a time.

    The same command format is used for the Help Function that is built into Windows PowerShell. That Function gets data from Get-Help and then uses the Paging parameter of Out-Host to display the data one page at a time by using this command format: Get-Help $args[0] | Out-Host -Paging).

    ————————– EXAMPLE 2 ————————–

    C:\PS>$a = Get-History

    C:\PS>Out-Host -InputObject $a

    Description
    ———–
    These commands display the session history at the command line. The first command uses the Get-History cmdlet to get the session history, and then it stores the history in the $a Variable. The second command uses Out-Host to display the content of the $a Variable, and it uses the InputObject parameter to specify the Variable to Out-Host.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113365
    Out-Printer
    Out-Null
    Out-File
    Out-String
    Out-Default
    Write-Host

Out-GridView

NAME
    Out-GridView

SYNOPSIS
    Sends output to an interactive table in a separate window.

SYNTAX
    Out-GridView [-InputObject <psobject>] [-Title <string>] [<CommonParameters>]

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. This feature requires Microsoft .NET Framework 3.5 with Service Pack 1.

    You can use the following features of the table to examine your data:

    — Hide, Show, and Reorder Columns: To hide, show, or reorder a column, right-click a column header and then click “Select Columns.”

    — Sort. To sort the data, click a column header. Click again to toggle from ascending to descending order.

    — Quick Filter. Use the “Filter” box at the top of the window to search the text in the table. You can search for text in a particular column, search for literals, and search for multiple words.

    — Criteria Filter. Use the “Add criteria” drop-down menu to create rules to filter the data. This is very useful for very large data sets, such as event logs.

    — Copy and paste. To copy rows of data from Out-GridView, press CTRL+C (copy). You can paste the data into any text or spreadsheet program.

    For instructions for using these features, type “Get-Help Out-GridView -full” and see “How to Use the Grid View Window Features” in the NOTES section.

PARAMETERS
    -InputObject <psobject>
        Accepts input for Out-GridView.

        When you use the InputObject parameter to send a collection (more than one) of objects to Out-GridView, Out-GridView treats the collection as one collection object, and it displays one row that represents the collection. To display the each object in the collection, use a pipeline operator (|) to send objects to Out-GridView.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     true (ByValue)
        Accept wildcard characters? false

    -Title <string>
        Specifies the text that appears in the title bar of the Out-GridView window.

        By default, the title bar displays the command that invokes Out-GridView.

        Required?                    false
        Position?                    named
        Default value                The current command
        Accept pipeline input?     false
        Accept wildcard characters? false

    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer and OutVariable. For more information, type,
        “Get-Help about_CommonParameters“.

INPUTS
    System.Management.Automation.PSObject
        You can send any object to Out-GridView.

OUTPUTS
    None
        Out-GridView does not return any objects.

NOTES

        NOTES FOR Out-GridView
        ———————-

        You can download the Microsoft .NET Framework 3.5 with Service Pack 1 from the Microsoft Download Center.

        Because this cmdlet requires a user interface, it does not work on Server Core installations of Windows Server.

        You cannot use a remote command to open a grid view window on a remote computer.

        The command output that you send cannot be pre-formatted, such as by using the Format-Table or Format-Wide cmdlets. To select properties, use the Select-Object cmdlet.

        Deserialized output from remote commands might not be formatted correctly in the grid view window.

        KEYBOARD SHORTCUTS FOR Out-GridView
        ———————————–

        By using the following keyboard shortcuts, you can perform many tasks quickly.

        Use this key:     To perform this action:
        ————-     —————————————————————-
        TAB             Moves the cursor from the Filter box to the Add criteria menu to the table and back.
        UP ARROW         Move up one row. Will move to column headers.
        DOWN ARROW        Move down one row.
        LEFT ARROW        In column header row, move left one column.
        RIGHT ARROW     In column header row, move right one column.
        CONTEXT MENU KEY In column header row, displays the “Select Columns” option.
        ENTER or SPACEBAR In column header row, sort column data (toggle A-Z, Z-A).

        HOW TO USE THE GRID VIEW WINDOW FEATURES
        —————————————-
        The following topics explain how to use the features of the window that Out-GridView displays.

        How to Hide, Show, and Reorder Columns
        ————————————–
        To hide or show a column:

        1. Right click any column header and click “Select Columns”.

        2. In the “Select Columns” dialog box, use the arrow keys to move the columns between the “Selected columns” to the “Available columns” boxes. Only columns in the “Selected Columns” box appear in the grid view window.

        To reorder columns:

        — Drag and drop the column into the desired location.

        – or-

        1. Right click any column header and click “Select Columns”.

        2. In the “Select Columns” dialog box, use the “Move up” and “Move down” buttons to reorder the columns. Columns at the top of the list appear to the left of columns at the bottom of the list in the grid view window.

        How to Sort Table Data
        ———————-
        — To sort the data, click a column header.
        — To change the sort order, click the column header again. Each time you click the same header, the sort order toggles between ascending to descending order. The current order is indicated by a triangle in the column header.

        How to Select Table Data
        ————————
        — To select a row, click the row or use the up or down arrow to navigate to the row.
        — To select all rows (except for the header row), press CTRL+A.
        — To select consecutive rows, press and hold the SHIFT key while clicking the rows or using the arrow keys.
        — To select nonconsecutive rows, press the CTRL key and click to add a row to the selection.
        You cannot select columns, and you cannot select the entire column header row.

        How to Copy Rows
        ———————-
        — To copy one or more rows from the table, select the rows and then press CTRL+C.
        You can paste the data into any text or spreadsheet program. You cannot copy columns or parts of rows and you cannot copy the column header row.

        How to Search in the Table (Quick Filter)
        ———————————
        Use the “Filter” box to search for data in the table. When you type in the box, only items that include the typed text appear in the table.

        — Search for text. To search for text in the table, in the “Filter” box, type the text to find.

        — Search for multiple words. To search for multiple words in the table, type the words separated by spaces. Out-GridView displays rows that include all of the words (logical AND).

        — Search for literal phrases. To search for phrases that include spaces or special characters, enclose the phrase in quotation marks. Out-GridView displays rows that include an exact match for the phrase.

        — Search in columns. To search for text in one or more columns, use the following format:

         <column>:<text> [<column>:<text>] …

            For example, to find “Net” in the DisplayName column, in the “Filter” box, type:

         displayname:net

            To find rows with “Net” in the DisplayName and Name columns, in the “Filter” box, type:

         displayname:net name:net

        — Turn off search. To display the entire table again, click the red X button in the top right corner of the “Filter” box or delete the text from the Filter box.

        Use Criteria to Filter the Table
        ——————————–
        You can use rules or “criteria” to determine which items are displayed in the table. Items appear only when they satisfy all of the criteria that you establish. The available criteria are determined by the properties of the objects displayed in the grid view window and the .NET Framework types of those properties.

        Each criterion has the following format:
        <column> <operator> <value>

        Criteria for different properties are connected by AND. Criteria for the same property are connected by OR. You cannot change the logical connectors.

        The criteria only affects the display. It does not delete items from the table.

        How to Add Criteria
        —————————
        1. To display the “Add criteria” menu button, in the upper right corner of the window, click the “Expand” arrow.
        2. Click the “Add Criteria” menu button.
        3. Click to select columns (properties). You can select one or many properties.
        4. When you are finished selecting properties, click the Add button.
        5. To cancel the additions, click Cancel.
        6. To add more criteria, click the Add Criteria button again.

        How to Edit a Criterion
        ——————–
        — To change an operator, click the blue operator value, and then click to select a different
         operator from the drop-down list.
        — To enter or change a value, type a value in the value box. If you enter a value that is not valid, a circular X icon appears. To remove it, change the value.
        — To create an OR statement, add a criteria with the same property.

        How to Delete Criteria
        ————————-
        — To delete selected criteria, click the red X beside each criterion.
        — To delete all criteria, click the “Clear All” button.

    ————————– EXAMPLE 1 ————————–

    C:\PS>Get-Process | Out-GridView

    Description
    ———–
    This command gets the processes running on the local computer and sends them to a grid view window.

    ————————– EXAMPLE 2 ————————–

    C:\PS>$p = Get-Process

    C:\PS> $p | Out-GridView

    Description
    ———–
    This command also gets the processes running on the local computer and sends them to a grid view window.

    The first command uses the Get-Process command to get the processes on the computer and then saves the process objects in the $p Variable.

    The second command uses a pipeline operator to send the $p Variable to Out-GridView.

    ————————– EXAMPLE 3 ————————–

    C:\PS>Get-Process | Select-Object -property name, workingset, peakworkingset | Sort-Object -property workingset -desc | Out-GridView

    Description
    ———–
    This command displays a formatted table in a grid view window.

    It uses the Get-Process cmdlet to get the processes on the computer.

    Then, it uses a pipeline operator (|) to send the process objects to the Select-Object cmdlet. The command uses the Property parameter of Select-Object to select the Name, WorkingSet, and PeakWorkingSet properties to be displayed in the table.

    Another pipeline operator sends the filtered objects to the Sort-Object cmdlet, which sorts them in descending order by the value of the WorkingSet property.

    The final part of the command uses a pipeline operator (|) to send the formatted table to Out-GridView.

    You can now use the features of the grid view to search, sort, and filter the data.

    ————————– EXAMPLE 4 ————————–

    C:\PS>($a = Get-ChildItem -path $pshome -recurse) | Out-GridView

    Description
    ———–
    This command saves its output in a Variable and sends it to Out-GridView.

    The command uses the Get-ChildItem cmdlet to get the files in the Windows PowerShell installation directory and its subdirectories. The path to the installation directory is saved in the $pshome automatic Variable.

    The command uses the assignment operator (=) to save the output in the $a Variable and the pipeline operator (|) to send the output to Out-GridView.
    The parentheses in the command establish the order of operations. As a result, the output from the Get-ChildItem command is saved in the $a Variable before it is sent to Out-GridView.

    ————————– EXAMPLE 5 ————————–

    C:\PS>Get-Process -computername Server01| ogv -Title “Processes – Server01”

    Description
    ———–
    This command displays the processes that are running on the Server01 computer in a grid view window.

    The command uses “ogv,” which is the built-in Alias for the Out-GridView cmdlet, it uses the Title parameter to specify the window title.

    ————————– EXAMPLE 6 ————————–

    C:\PS>Invoke-Command -ComputerName S1, S2, S3 -scriptblock {Get-Culture} | Out-GridView

    Description
    ———–
    This example shows the correct format for sending data collected from remote computers to the Out-GridView cmdlet.

    The command uses the Invoke-Command cmdlet to run a Get-Culture command on three remote computers. It uses a pipeline operator to send the data that is returned to the Out-GridView cmdlet.

    Notice that the script block that contains the commands that are run remotely does not include the Out-GridView command. If it did, the command would fail when it tried to open a grid view window on each of the remote computers.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113364

Out-File

NAME
    Out-File

SYNOPSIS
    Sends output to a file.

SYNTAX
    Out-File [-FilePath] <string> [[-Encoding] <string>] [-Append] [-Force] [-InputObject <psobject>] [-NoClobber] [-Width <int>] [-Confirm] [-WhatIf] [<CommonParameters>]

DESCRIPTION
    The Out-File cmdlet sends output to a file. You can use this cmdlet instead of the redirection operator (>) when you need to use its parameters.

PARAMETERS
    -Append [<SwitchParameter>]
        Adds the output to the end of an existing file, instead of replacing the file contents.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Encoding <string>
        Specifies the type of character encoding used in the file. Valid values are “Unicode”, “UTF7”, “UTF8”, “UTF32”, “ASCII”, “BigEndianUnicode”, “Default”, and “OEM”. “Unicode” is the default.

        “Default” uses the encoding of the system’s current ANSI code page.

        “OEM” uses the current original equipment manufacturer code page identifier for the operating system.

        Required?                    false
        Position?                    2
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -FilePath <string>
        Specifies the path to the output file.

        Required?                    true
        Position?                    1
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Force [<SwitchParameter>]
        Allows the cmdlet to overwrite an existing read-only file. Even using the Force parameter, the cmdlet cannot override security restrictions.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -InputObject <psobject>
        Specifies the objects to be written to the file. Enter a Variable that contains the objects or type a command or expression that gets the objects.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     true (ByValue)
        Accept wildcard characters? false

    -NoClobber [<SwitchParameter>]
        Will not overwrite (replace the contents) of an existing file. By default, if a file exists in the specified path, Out-File overwrites the file without warning. If both Append and NoClobber are used, the output is appended to the existing file.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Width <int>
        Specifies the number of characters in each line of output. Any additional characters are truncated, not wrapped. If you omit this parameter, the width is determined by the characteristics of the host. The default for the Windows PowerShell console is 80 (characters).

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Confirm [<SwitchParameter>]
        Prompts you for confirmation before executing the command.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -WhatIf [<SwitchParameter>]
        Describes what would happen if you executed the command without actually executing the command.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer and OutVariable. For more information, type,
        “Get-Help about_CommonParameters“.

INPUTS
    System.Management.Automation.PSObject
        You can pipe any object to Out-File.

OUTPUTS
    None
        Out-File does not generate any output.

NOTES

        The Out cmdlets do not format objects; they just render them and send them to the specified display destination. If you send an unformatted object to an Out cmdlet, the cmdlet sends it to a formatting cmdlet before rendering it.

        The Out cmdlets do not have parameters for names or file paths. To send data to a cmdlet that contains the Out verb (an Out cmdlet), use a pipeline operator (|) to send the output of a Windows PowerShell command to the cmdlet. You can also store data in a Variable and use the InputObject parameter to pass the data to the cmdlet. For help, see the examples.

        Out-File sends data, but it does not emit any output objects. If you pipe the output of Out-File to Get-Member, Get-Member reports that no objects have been specified.

    ————————– EXAMPLE 1 ————————–

    C:\PS>Get-Process | Out-File -FilePath C:\Test1\process.txt

    Description
    ———–
    This command sends a list of processes on the computer to the Process.txt file. If the file does not exist, Out-File creates it. Because the name of the FilePath parameter is optional, you can omit it and submit the equivalent command “Get-Process | outfile C:\Test1\process.txt”.

    ————————– EXAMPLE 2 ————————–

    C:\PS>Get-Process | Out-File C:\Test1\process.txt -NoClobber

    Out-File : File C:\Test1\process.txt already exists and NoClobber was specified.
    At line:1 char:23
    + Get-Process | Out-File <<<< process.txt -NoClobber

    Description
    ———–
    This command also sends a list of processes to the Process.txt file, but it uses the NoClobber parameter, which prevents an existing file from being overwritten. The output shows the error message that appears when NoClobber is used with an existing file.

    ————————– EXAMPLE 3 ————————–

    C:\PS>$a = Get-Process

    C:\PS> Out-File -FilePath C:\Test1\process.txt -InputObject $a -Encoding ASCII -Width 50

    Description
    ———–
    These commands send a list of processes on the computer to the Process.txt file. The text is encoded in ASCII format so that it can be read by search programs like Findstr and Grep. By default, Out-File uses Unicode format.

    The first command gets the list of processes and stores them in the $a Variable. The second command uses the Out-File cmdlet to send the list to the Process.txt file.

    The command uses the InputObject parameter to specify that the input is in the $a Variable. It uses the Encoding parameter to convert the output to ASCII format. It uses the Width parameter to limit each line in the file to 50 characters. Because the lines of output are truncated at 50 characters, the rightmost column in the process table is omitted.

    ————————– EXAMPLE 4 ————————–

    C:\PS>Set-Location hklm:\software

    c:\PS>Get-Acl mycompany\mykey | Out-File -FilePath c:\ps\acl.txt

    c:\PS>Get-Acl mycompany\mykey | Out-File -FilePath FileSystem::acl.txt

    Description
    ———–
    These commands show how to use the Out-File cmdlet when you are not in a FileSystem drive.

    The first command sets the current location to the HKLM:\Software Registry key.

    The second and third commands have the same effect. They use the Get-Acl cmdlet to get the security descriptor of the MyKey Registry subkey (HKLM\Software\MyCompany\MyKey). A pipeline operator passes the result to the Out-File cmdlet, which sends it to the Acl.txt file.

    Because Out-File is not supported by the Windows PowerShell Registry provider, you must specify either the file system drive name, such as “c:”, or the name of the provider followed by two colons, “FileSystem::”, in the value of the FilePath parameter. The second and third commands demonstrate these methods.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113363
    Out-String
    Out-Null
    Out-Host
    Out-Printer
    Out-Default
    Tee-Object

Out-Default

NAME
    Out-Default

SYNOPSIS
    Sends the output to the default formatter and to the default output cmdlet.

SYNTAX
    Out-Default [-InputObject <psobject>] [<CommonParameters>]

DESCRIPTION
    The Out-Default cmdlet sends output to the default formatter and the default output cmdlet. This cmdlet has no effect on the formatting or output of Windows PowerShell commands. It is a placeholder that lets you write your own Out-Default Function or cmdlet.

PARAMETERS
    -InputObject <psobject>

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     true (ByValue)
        Accept wildcard characters? false

    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer and OutVariable. For more information, type,
        “Get-Help about_CommonParameters“.

INPUTS

OUTPUTS

NOTES

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113362

New-WSManSessionOption

NAME
    New-WSManSessionOption

SYNOPSIS
    Creates a WS-Management session option hash table to use as input parameters to the following WS-Management cmdlets:
    Get-WSManInstance
    Set-WSManInstance
    Invoke-WSManAction
    Connect-WSMan

SYNTAX
    New-WSManSessionOption [-NoCompression <switch>] [-NoProxy <switch>] [-ProxyAuthentication <string>] [-ProxyPassword <string>] [-ProxyUserName <string>] [-SkipCACheck <switch>] [-SkipCNCheck <switch>] [-SkipRevocation <switch>] [-SPNPort <int>] [-Timeout <int>] [-UnEncrypted <switch>] [-UseIEProxyconfig <switch>] [-UseProxyAutoDetection <switch>] [-UseWinHTTPProxyConfig <switch>] [-UTF16 <switch>] [<CommonParameters>]

DESCRIPTION
    Creates a WSMan Session option hashtable which can be passed into WSMan cmdlets:
    Get-WSManInstance
    Set-WSManInstance
    Invoke-WSManAction
    Connect-WSMan

PARAMETERS
    -NoCompression <switch>
        Turns off packet compression in the session. Compression is enabled by default and the packets sent between the client and server are compressed. Compression uses more processor cycles, but it makes transmission faster.

        Required?                    false
        Position?                    named
        Default value                False
        Accept pipeline input?     false
        Accept wildcard characters? false

    -NoProxy <switch>
        Do not use a proxy server. All all host names will be resolved locally.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -ProxyAuthentication <string>
        Specifies the authentication method to use at the proxy. Possible values are:

        – Basic: Basic is a scheme in which the user name and password are sent in clear-text to the server or proxy.
        – Digest: Digest is a challenge-response scheme that uses a server-specified data string for the challenge.
        – Negotiate (the default): Negotiate is a challenge-response scheme that negotiates with the server or proxy to determine which scheme to use for authentication. Examples are the Kerberos protocol and NTLM.

        Required?                    false
        Position?                    named
        Default value                Negotiate
        Accept pipeline input?     false
        Accept wildcard characters? false

    -ProxyPassword <string>
        Specifies a password to to be used for proxy authentication.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -ProxyUserName <string>
        Specifies a user name to to be used for proxy authentication.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -SkipCACheck <switch>
        Specifies that when connecting over HTTPS, the client does not validate that the server Certificate is signed by a trusted Certificate authority (CA). Use this option only when the remote computer is trusted by other means, for example, if the remote computer is part of a network that is physically secure and isolated or the remote computer is listed as a trusted host in the WS-Management configuration.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -SkipCNCheck <switch>
        Specifies that the Certificate common name (CN) of the server does not need to match the hostname of the server. This is used only in remote operations using HTTPS. This option should only be used for trusted computers.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -SkipRevocation <switch>
        Do not validate the revocation status on the server Certificate.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -SPNPort <int>
        Specifies a port number to append to the connection Service Principal Name <SPN> of the remote server. An SPN is used when the authentication mechanism is Kerberos or Negotiate.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Timeout <int>
        Defines the timeout in milliseconds for the WS-Management operation.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -UnEncrypted <switch>
        Do not use encryption when doing remote operations over HTTP.

        Note: Unencrypted traffic is not allowed by default and must be enabled in the local configuration.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -UseIEProxyconfig <switch>
        Use the Internet Explorer proxy configuration for the current user. This is the default setting.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -UseProxyAutoDetection <switch>
        Force auto-detection of a proxy.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -UseWinHTTPProxyConfig <switch>
        Use the proxy settings configured for WinHTTP.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -UTF16 <switch>
        Encode the request in UTF16 format rather than UTF8 format. The default is UTF8 encoding.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer and OutVariable. For more information, type,
        “Get-Help about_CommonParameters“.

INPUTS

OUTPUTS
    SessionOption

NOTES

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkId=141449
    Connect-WSMan
    Disable-WSManCredSSP
    Disconnect-WSMan
    Enable-WSManCredSSP
    Get-WSManCredSSP
    Get-WSManInstance
    Invoke-WSManAction
    New-WSManInstance
    Remove-WSManInstance
    Set-WSManInstance
    Set-WSManQuickConfig
    Test-WSMan