Tag Archives: Confirm

Invoke-History

NAME
    Invoke-History

SYNOPSIS
    Runs commands from the session history.

SYNTAX
    Invoke-History [[-Id] <string>] [-Confirm] [-WhatIf] [<CommonParameters>]

DESCRIPTION
    The Invoke-History cmdlet runs commands from the session history. You can pass objects representing the commands from Get-History to Invoke-History, or you can identify commands in the current history by using their ID number. To find the identification number of a command, use Get-History.

PARAMETERS
    -Id <string>
        Identifies a command in the history. You can type the ID number of the command or the first few characters of the command.

        If you type characters, Invoke-History matches the most recent commands first. If you omit this parameter, Invoke-History runs the last (most recent) command. The parameter name (“id”) is optional. To find the ID number of a command, use Get-History.

        Required?                    false
        Position?                    1
        Default value
        Accept pipeline input?     true (ByPropertyName)
        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
    None
        You cannot pipe input to this cmdlet.

OUTPUTS
    None
        Invoke-History does not generate any output, but output might be generated by the commands that Invoke-History runs.

NOTES

        The session history is a list of the commands entered during the session along with the ID. The session history represents the order of execution, the status, and the start and end times of the command. As you enter each command, Windows PowerShell adds it to the history so that you can reuse it. For more information about the session history, see about_History.

        You can also refer to Invoke-History by its built-in Aliases, “r” and “ihy”. For more information, see about_aliases.

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

    C:\PS>Invoke-History

    Description
    ———–
    This command runs the last (most recent) command in the session history. You can abbreviate this command as “r” (think “repeat” or “rerun”), the Alias for Invoke-History.

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

    C:\PS>Invoke-History -Id 132

    Description
    ———–
    This command runs the command in the session history with ID 132. Because the name of the Id parameter is optional, you can abbreviate this command as “Invoke-History 132″, “ihy 132”, or “r 132”.

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

    C:\PS>Invoke-History get-pr

    Description
    ———–
    This command runs the most recent Get-Process command in the session history. When you type characters for the Id parameter, Invoke-History runs the first command that it finds that matches the pattern, beginning with the most recent commands. This command uses the ID parameter, but it omits the optional parameter name.

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

    C:\PS>Invoke-History (16..24), 27

    Description
    ———–
    This command runs commands 16 through 24 and 27. You can list multiple IDs and ID ranges separated by commas.

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

    C:\PS>Get-History -Id 255 -count 7 | Invoke-History

    Description
    ———–
    This command runs the 7 commands in the history that end with command 255 (typically 249 through 255). It uses the Get-History cmdlet to retrieve the commands. The pipeline operator (|) passes the commands to Invoke-History, which executes them.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113344
    about_History
    Get-History
    Add-History
    Clear-History

Invoke-Item

NAME
    Invoke-Item

SYNOPSIS
    Performs the default action on the specified item.

SYNTAX
    Invoke-Item [-LiteralPath] <string[]> [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Include <string[]>] [-Confirm] [-WhatIf] [-UseTransaction] [<CommonParameters>]

    Invoke-Item [-Path] <string[]> [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Include <string[]>] [-Confirm] [-WhatIf] [-UseTransaction] [<CommonParameters>]

DESCRIPTION
    The Invoke-Item cmdlet performs the default action on the specified item. For example, it runs an executable file or opens a document file in the application associated with the document file type. The default action depends on the type of item and is determined by the Windows PowerShell provider that provides access to the data.

PARAMETERS
    -Credential <PSCredential>
        Specifies a user account that has permission to perform this action. The default is the current user.

        Type a user name, such as “User01” or “Domain01\User01”, or enter a PSCredential object, such as one generated by the Get-Credential cmdlet. If you type a user name, you will be prompted for a password.

        This parameter is not supported by any providers installed with Windows PowerShell.

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

    -Exclude <string[]>
        Omits the specified items. The value of this parameter qualifies the Path parameter. Enter a path element or pattern, such as “*.txt”. Wildcards are permitted.

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

    -Filter <string>
        Specifies a filter in the provider’s format or language. The value of this parameter qualifies the Path parameter. The syntax of the filter, including the use of wildcards, depends on the provider. Filters are more efficient than other parameters, because the provider applies them when retrieving the objects rather than having Windows PowerShell filter the objects after they are retrieved.

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

    -Include <string[]>
        Performs the default action only on the specified items. The value of this parameter qualifies the Path parameter. Enter a path element or pattern, such as “*.txt”. Wildcards are permitted.

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

    -LiteralPath <string[]>
        Specifies a path to the item. The value of LiteralPath 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?                    true
        Position?                    1
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -Path <string[]>
        Specifies the path to the selected item.

        Required?                    true
        Position?                    1
        Default value
        Accept pipeline input?     true (ByValue, ByPropertyName)
        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

    -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 to Invoke-Item.

OUTPUTS
    None
        The command does not generate any output. However, output might be generated by the item that it invokes.

NOTES

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

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

    C:\PS>Invoke-Item C:\Test\aliasApr04.doc

    Description
    ———–
    This command opens the file AliasApr04.doc in Microsoft Office Word. In this case, opening in Word is the default action for .doc files.

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

    C:\PS>Invoke-Item “C:\Documents and Settings\Lister\My Documents\*.xls”

    Description
    ———–
    This command opens all of the Microsoft Office Excel spreadsheets in the C:\Documents and Settings\Lister\My Documents folder. Each spreadsheet is opened in a new instance of Excel. In this case, opening in Excel is the default action for .xls files.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113345
    about_providers
    Clear-Item
    Get-Item
    Move-Item
    Set-Item
    New-Item
    Remove-Item
    Rename-Item
    Copy-Item

Export-Clixml

NAME
    Export-Clixml

SYNOPSIS
    Creates an XML-based representation of an object or objects and stores it in a file.

SYNTAX
    Export-Clixml [-Path] <string> -InputObject <psobject> [-Depth <int>] [-Encoding <string>] [-Force] [-NoClobber] [-Confirm] [-WhatIf] [<CommonParameters>]

DESCRIPTION
    The Export-Clixml cmdlet creates an XML-based representation of an object or objects and stores it in a file. You can then use the Import-Clixml cmdlet to re-create the saved object based on the contents of that file.

    This cmdlet is similar to ConvertTo-Xml, except that Export-Clixml stores the resulting XML in a file. ConvertTo-Xml returns the XML, so you can continue to process it in Windows PowerShell.

PARAMETERS
    -Depth <int>
        Specifies how many levels of contained objects are included in the XML representation. The default value is 2.

        The default value can be overridden for the object type in the Types.ps1xml files. For more information, see about_types.ps1xml.

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

    -Encoding <string>
        Specifies the type of encoding for the target file. Valid values are ASCII, UTF8, UTF7, UTF32, Unicode, BigEndianUnicode, Default, and OEM. UTF8 is the default.

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

    -Force [<SwitchParameter>]
        Causes the cmdlet to clear the read-only attribute of the output file if necessary. The cmdlet will attempt to reset the read-only attribute when the command completes.

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

    -InputObject <psobject>
        Specifies the object to be converted. Enter a Variable that contains the objects, or type a command or expression that gets the objects. You can also pipe objects to Export-Clixml.

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

    -NoClobber [<SwitchParameter>]
        Ensures that the cmdlet does not overwrite the contents of an existing file. By default, if a file exists in the specified path, Export-Clixml overwrites the file without warning.

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

    -Path <string>
        Specifies the path to the file where the XML representation of the object will be stored.

        Required?                    true
        Position?                    1
        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 Export-Clixml.

OUTPUTS
    System.IO.FileInfo
        Export-Clixml creates a file that contains the XML.

NOTES

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

    C:\PS>”This is a test” | Export-Clixml sample.xml

    Description
    ———–
    This command creates an XML file that stores a representation of the string, “This is a test”.

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

    C:\PS>Get-Acl C:\test.txt | Export-Clixml -Path fileacl.xml

    C:\PS> $fileacl = Import-Clixml fileacl.xml

    Description
    ———–
    This example shows how to export an object to an XML file and then create an object by importing the XML from the file.

    The first command uses the Get-Acl cmdlet to get the security descriptor of the Test.txt file. It uses a pipeline operator to pass the security descriptor to Export-Clixml, which stores an XML-based representation of the object in a file named FileACL.xml.

    The second command uses the Import-Clixml cmdlet to create an object from the XML in the FileACL.xml file. Then, it saves the object in the $FileAcl Variable.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113297
    Import-Clixml
    ConvertTo-Xml
    Export-Csv
    ConvertTo-Html

Export-Console

NAME
    Export-Console

SYNOPSIS
    Exports the names of snap-ins in the current session to a console file.

SYNTAX
    Export-Console [[-Path] <string>] [-Force] [-NoClobber] [-Confirm] [-WhatIf] [<CommonParameters>]

DESCRIPTION
    The Export-Console cmdlet exports the names of the Windows PowerShell snap-ins in the current session to a Windows PowerShell console file (.psc1). You can use this cmdlet to save the snap-ins for use in future sessions.

    To add the snap-ins in the .psc1 console file to a session, start Windows PowerShell (Powershell.exe) at the command line by using Cmd.exe or another Windows PowerShell session, and then use the PSConsoleFile parameter of Powershell.exe to specify the console file.

    For more information about Windows PowerShell snap-ins, see about_PSSnapins.

PARAMETERS
    -Force [<SwitchParameter>]
        Overwrites the data in a console file without warning, even if the file has the read-only attribute. The read-only attribute is changed and is not reset when the command completes.

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

    -NoClobber [<SwitchParameter>]
        Will not overwrite (replace the contents of) an existing console file. By default, if a file exists in the specified path, Export-Console overwrites the file without warning.

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

    -Path <string>
        Specifies a path and file name for the console file (*.psc1). Enter a path (optional) and name. Wildcards are not permitted.

        If you type only a file name, Export-Console creates a file with that name and the “.psc1” file name extension in the current directory.

        This parameter is required unless you have opened Windows PowerShell with the PSConsoleFile parameter or exported a console file during the current session. It is also required when you use the NoClobber parameter to prevent the current console file from being overwritten.

        If you omit this parameter, Export-Console overwrites (replaces the content of) the console file that was used most recently in this session. The path to the most recently used console file is stored in the value of the $ConsoleFileName automatic Variable. For more information, see about_Automatic_Variables.

        Required?                    false
        Position?                    1
        Default value
        Accept pipeline input?     true (ByValue, ByPropertyName)
        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.String
        You can pipe a path string to Export-Console.

OUTPUTS
    System.IO.FileInfo
        Export-Console creates a file that contains the exported Aliases.

NOTES

        When a console file (.psc1) is used to start the session, the name of the console file is automatically stored in the $ConsoleFileName automatic Variable. The value of $ConsoleFileName is updated when you use the Path parameter of Export-Console to specify a new console file. When no console file is used, $ConsoleFileName has no value ($null).

        To use a Windows PowerShell console file in a new session, use the following syntax to start Windows PowerShell:
        “powershell.exe -PsConsoleFile <ConsoleFile>.psc1”.

        You can also save Windows PowerShell snap-ins for future sessions by adding an Add-PSSnapin command to your Windows PowerShell profile. For more information, see about_profiles.

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

    C:\PS>Export-Console -Path $pshome\Consoles\ConsoleS1.psc1

    Description
    ———–
    This command exports the names of Windows PowerShell snap-ins in the current session to the ConsoleS1.psc1 file in the Consoles subdirectory of the Windows PowerShell installation directory, $pshome.

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

    C:\PS>Export-Console

    Description
    ———–
    This command exports the names of Windows PowerShell snap-ins from current session to the Windows PowerShell console file that was most recently used in the current session. It overwrites the previous file contents.

    If you have not exported a console file during the current session, you are prompted for permission to continue and then prompted for a file name.

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

    C:\PS>Add-PSSnapin NewPSSnapin

    C:\PS> Export-Console -Path NewPSSnapinConsole.psc1

    C:\PS> powershell.exe -PsConsoleFile NewPsSnapinConsole.psc1

    Description
    ———–
    These commands add the NewPSSnapin Windows PowerShell snap-in to the current session, export the names of Windows PowerShell snap-ins in the current session to a console file, and then start a Windows PowerShell session with the console file.

    The first command uses the Add-PSSnapin cmdlet to add the NewPSSnapin snap-in to the current session. You can only add Windows PowerShell snap-ins that are registered on your system.

    The second command exports the Windows PowerShell snap-in names to the NewPSSnapinConsole.psc1 file.

    The third command starts Windows PowerShell with the NewPSSnapinConsole.psc1 file. Because the console file includes the Windows PowerShell snap-in name, the cmdlets and providers in the snap-in are available in the current session.

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

    C:\PS>Export-Console -Path Console01

    C:\PS> notepad console01.psc1

    <?xml version=”1.0″ encoding=”utf-8″?>
    <PSConsoleFile ConsoleSchemaVersion=”1.0″>
     <PSVersion>2.0</PSVersion>
     <PSSnapIns>
        <PSSnapIn Name=”NewPSSnapin” />
     </PSSnapIns>
    </PSConsoleFile>

    Description
    ———–
    This command exports the names of the Windows PowerShell snap-ins in the current session to the Console01.psc1 file in the current directory.

    The second command displays the contents of the Console01.psc1 file in Notepad.

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

    C:\PS>powershell.exe -PSConsoleFile Console01.psc1

    C:\PS> Add-PSSnapin MySnapin

    C:\PS> Export-Console NewConsole.psc1

    C:\PS> $consolefilename

    C:\PS> Add-PSSnapin SnapIn03

    C:\PS> Export-Console

    Description
    ———–
    This example shows how to use the $ConsoleFileName automatic Variable to determine the console file that will be updated if you use Export-Console without a Path parameter value.

    The first command uses the PSConsoleFile parameter of PowerShell.exe to open Windows PowerShell with the Console01.psc1 file.

    The second command uses the Add-PSSnapin cmdlet to add the MySnapin Windows PowerShell snap-in to the current session.

    The third command uses the Export-Console cmdlet to export the names of all the Windows PowerShell snap-ins in the session to the NewConsole.psc1 file.

    The fourth command uses the $ConsoleFileName parameter to display the most recently used console file. The sample output shows that NewConsole.ps1 is the most recently used file.

    The fifth command adds SnapIn03 to the current console.

    The sixth command uses the ExportConsole cmdlet without a Path parameter. This command exports the names of all the Windows PowerShell snap-ins in the current session to the most recently used file, NewConsole.psc1.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113298
    Add-PSSnapin
    Get-PSSnapin
    Remove-PSSnapin

Export-Csv

NAME
    Export-Csv

SYNOPSIS
    Converts Microsoft .NET Framework objects into a series of comma-separated value (CSV) Variable-length strings and saves the strings in a CSV file.

SYNTAX
    Export-Csv [[-Delimiter] <char>] [-Path] <string> -InputObject <psobject> [-Encoding <string>] [-Force] [-NoClobber] [-NoTypeInformation] [-Confirm] [-WhatIf] [<CommonParameters>]

    Export-Csv [-UseCulture] [-Path] <string> -InputObject <psobject> [-Encoding <string>] [-Force] [-NoClobber] [-NoTypeInformation] [-Confirm] [-WhatIf] [<CommonParameters>]

DESCRIPTION
    The Export-Csv cmdlet creates a CSV Variable-length file that represents the objects that you submit.
    You can then use the Import-Csv cmdlet to re-create objects from the CSV strings in the files. The resulting objects are CSV versions of the original objects that consist of string representations of the property values and no methods.

    You can also use the ConvertTo-Csv and ConvertFrom-Csv cmdlets to convert .NET Framework objects to CSV strings (and back). Export-Csv is the same as ConvertTo-Csv, except that it saves the CSV strings in a file.

    You can use the parameters of the Export-Csv cmdlet to specify a delimiter other than a comma or to direct Export-Csv to use the default delimiter for the current culture.

    When you submit multiple objects to Export-Csv, Export-Csv organizes the file based on the properties of the first object that you submit. If the remaining objects do not have one of the specified properties, the property value of that object is null, as represented by two consecutive commas. If the remaining objects have additional properties, those property values are not included in the file.

    For more information, see Export-Csv, and see the Notes section.

PARAMETERS
    -Delimiter <char>
        Specifies a delimiter to separate the property values. The default is a comma (,). Enter a character, such as a colon (:). To specify a semicolon (;), enclose it in quotation marks.

        Required?                    false
        Position?                    2
        Default value                , (comma)
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Encoding <string>
        Specifies the encoding for the exported CSV file. Valid values are Unicode, UTF7, UTF8, ASCII, UTF32, BigEndianUnicode, Default, and OEM. The default is ASCII.

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

    -Force [<SwitchParameter>]
        Overwrites the file specified in path without prompting.

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

    -InputObject <psobject>
        Specifies the objects to export as CSV strings. Enter a Variable that contains the objects or type a command or expression that gets the objects. You can also pipe objects to Export-Csv.

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

    -NoClobber [<SwitchParameter>]
        Do not overwrite (replace the contents) of an existing file. By default, if a file exists in the specified path, Export-Csv overwrites the file without warning.

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

    -NoTypeInformation [<SwitchParameter>]
        Omits the type information from the CSV file. By default, the first line of the CSV file contains “#TYPE ” followed by the fully-qualified name of the type of the .NET Framework object.

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

    -Path <string>
        Specifies the path to the CSV output file. The parameter is required.

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

    -UseCulture [<SwitchParameter>]
        Use the list separator for the current culture as the item delimiter. The default is a comma (,).

        This parameter is very useful in scripts that are being distributed to users worldwide. To find the list separator for a culture, use the following command: (Get-Culture).TextInfo.ListSeparator.

        Required?                    false
        Position?                    named
        Default value                Comma
        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 .NET Framework object to Export-Csv.

OUTPUTS
    System.String
        The CSV list is sent to the file designated in the Path parameter.

NOTES

        The Export-Csv cmdlet converts the objects that you submit into a series of CSV Variable-length strings and saves them in the specified text file. You can use Export-Csv to save objects in a CSV file and then use the Import-Csv cmdlet to create objects from the text in the CSV file.

        In the CSV file, each object is represented by a comma-separated list of the property values of the object. The property values are converted to strings (by using the ToString() method of the object), so they are generally represented by the name of the property value. Export-Csv does not export the methods of the object.

        The format of an exported file is as follows:
        — The first line of the CSV file contains the string ‘#TYPE ‘ followed by the fully qualified name of the .NET Framework type of the object, such as #TYPE System.Diagnostics.Process. To suppress this line, use the NoTypeInformation parameter.

        — The next line of the CSV file represents the column headers. It contains a comma-separated list of the names of all the properties of the first object.

        — Additional lines of the file consist of comma-separated lists of the property values of each object.

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

    C:\PS>Get-Process wmiprvse | Select-Object basePriority,ID,SessionID,WorkingSet | Export-Csv -Path data.csv

    Description
    ———–
    This command selects a few properties of the wmiprvse process and exports them to a CSV format file named data.csv.

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

    C:\PS>Get-Process | Export-Csv processes.csv

    C:\PS> Get-Process | Export-Csv processes.csv

    # In processes.csv

    #TYPE System.Diagnostics.Process
    __NounName,Name,Handles,VM,WS,PM,NPM,Path,Company,CPU,FileVersion,…
    Process,powershell,626,201666560,76058624,61943808,11960,C:\WINDOWS…
    Process,powershell,257,151920640,38322176,37052416,7836,C:\WINDOWS\…

    Description
    ———–
    This command exports objects representing the processes on the computer to the Processes.csv file in the current directory. Because it does not specify a delimiter, a comma (,) is used to separate the fields in the file.

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

    C:\PS>Get-Process | Export-Csv processes.csv -Delimiter “;”

    # In processes.csv

    #TYPE System.Diagnostics.Process
    __NounName;Name;Handles;VM;WS;PM;NPM;Path;Company;CPU;FileVersion;…
    Process;powershell;626;201666560;76058624;61943808;11960;C:\WINDOWS…
    Process;powershell;257;151920640;38322176;37052416;7836;C:\WINDOWS\…

    Description
    ———–
    This command exports objects representing the processes on the computer to the Processes.csv file in the current directory. It uses the Delimiter parameter to specify the semicolon (;). As a result, the fields in the file are separated by semicolons.

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

    C:\PS>Get-Process | Export-Csv processes.csv -UseCulture

    Description
    ———–
    This command exports objects representing the processes on the computer to the Processes.csv file in the current directory. It uses the UseCulture parameter to direct Export-Csv to use the delimiter specified by the ListSeparator property of the current culture.

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

    C:\PS>Get-Process | Export-Csv processes.csv -NoTypeInformation

    C:\PS> Get-Process | Export-Csv processes.csv -NoTypeInformation

    # In processes.csv

    __NounName,Name,Handles,VM,WS,PM,NPM,Path,Company,CPU,FileVersion,…
    Process,powershell,626,201666560,76058624,61943808,11960,C:\WINDOWS…
    Process,powershell,257,151920640,38322176,37052416,7836,C:\WINDOWS\…

    Description
    ———–
    This command exports objects representing the processes on the computer to the Processes.csv file in the current directory. It uses the NoTypeInformation parameter to suppress the type information in the file.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113299
    Import-Csv
    ConvertTo-Csv
    ConvertFrom-Csv

Export-Alias

NAME
    Export-Alias

SYNOPSIS
    Exports information about currently defined Aliases to a file.

SYNTAX
    Export-Alias [-Path] <string> [[-Name] <string[]>] [-Append] [-As {Csv | Script}] [-Description <string>] [-Force] [-NoClobber] [-PassThru] [-Scope <string>] [-Confirm] [-WhatIf] [<CommonParameters>]

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.

    Export-Alias can export the Aliases in a particular scope or all scopes, it can generate the data in CSV format or as a series of Set-Alias commands that you can add to a session or to a Windows PowerShell profile.

PARAMETERS
    -Append [<SwitchParameter>]
        Appends the output to the specified file, rather than overwriting the existing contents of that file.

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

    -As <ExportAliasFormat>
        Determines the output format. CSV is the default.

        Valid values are:

        — CSV: Comma-separated value (CSV) format.
        — Script: Creates a Set-Alias command for each exported Alias. If you name the output file with a .ps1 file name extension, you can run it as a script to add the Aliases to any session.

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

    -Description <string>
        Adds a description to the exported file. The description appears as a comment at the top of the file, following the header information.

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

    -Force [<SwitchParameter>]
        Overwrites the output file, even if the read-only attribute is set on the file.

        By default, Export-Alias overwrites files without warning, unless the read-only or hidden attribute is set or the NoClobber parameter is used in the command. The NoClobber parameter takes precedence over the Force parameter when both are used in a command.

        The Force parameter cannot force Export-Alias to overwrite files with the hidden attribute.

        Required?                    false
        Position?                    named
        Default value                Does not overwrite read-only files.
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Name <string[]>
        Specifies the names of the Aliases to export. Wildcards are permitted.

        By default, Export-Alias exports all Aliases in the session or scope.

        Required?                    false
        Position?                    2
        Default value                Export all Aliases
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -NoClobber [<SwitchParameter>]
        Prevents Export-Alias from overwriting any files, even if the Force parameter is used in the command.

        If the NoClobber parameter is omitted, Export-Alias will overwrite an existing file without warning, unless the read-only attribute is set on the file. NoClobber takes precedence over the Force parameter, which permits Export-Alias to overwrite a file with the read-only attribute.

        NoClobber does not prevent the Append parameter from adding content to an existing file.

        Required?                    false
        Position?                    named
        Default value                Overwrites read-write files.
        Accept pipeline input?     false
        Accept wildcard characters? false

    -PassThru [<SwitchParameter>]
        Returns objects that represent the Aliases that were exported. By default, this cmdlet does not generate any output.

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

    -Path <string>
        Specifies the path to the output file. Wildcards are permitted, but the resulting path value must resolve to a single file name. This parameter is required.

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

    -Scope <string>
        Specifies the scope from which the Aliases should be exported.

        Valid values are “Global”, “Local”, or “Script”, or a number relative to the current scope (0 through the number of scopes where 0 is the current scope and 1 is its parent). “Local” is the default. For more information, see about_scopes.

        Required?                    false
        Position?                    named
        Default value                Local
        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
    None.
        You cannot pipe objects to this cmdlet.

OUTPUTS
    None or System.Management.Automation.AliasInfo
        When you use the Passthru parameter, Export-Alias returns a System.Management.Automation.AliasInfo object that represents the Alias. Otherwise, this cmdlet does not generate any output.

NOTES

        You can only Export-Aliases to a file.

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

    C:\PS>Export-Alias -Path Alias.csv

    Description
    ———–
    This command exports current Alias information to a file named Alias.csv in the current directory.

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

    C:\PS>Export-Alias -Path Alias.csv -NoClobber

    Description
    ———–
    This command exports the Aliases in the current session to an Alias.csv file.

    Because the NoClobber parameter is specified, the command will fail if an Alias.csv file already exists in the current directory.

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

    C:\PS>Export-Alias -Path Alias.csv -Append -Description “Appended Aliases” -Force

    Description
    ———–
    This command appends the Aliases in the current session to the Alias.csv file.

    The command uses the Description parameter to add a description to the comments at the top of the file.

    The command also uses the Force parameter to overwrite any existing Alias.csv files, even if they have the read-only attribute.

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

    C:\PS>Export-Alias -Path Alias.ps1 -As script

    C:\PS> Add-Content -Path $profile -value (Get-Content Alias.ps1)

    C:\PS> $s = New-PSSession -computername Server01
    C:\PS> Invoke-Command -session $s -filepath .\alias.ps1

    Description
    ———–
    This example shows how to use the script file format that Export-Alias generates.

    The first command exports the Aliases in the session to the Alias.ps1 file. It uses the As parameter with a value of Script to generate a file that contains a Set-Alias command for each Alias.

    The second command adds the Aliases in the Alias.ps1 file to the CurrentUser-CurrentHost profile. (The path to the profile is saved in the $profile Variable.) The command uses the Get-Content cmdlet to get the Aliases from the Alias.ps1 file and the Add-Content cmdlet to add them to the profile. For more information, see about_profiles.

    The third and fourth commands add the Aliases in the Alias.ps1 file to a remote session on the Server01 computer. The third command uses the New-PSSession cmdlet to create the session. The fourth command uses the FilePath parameter of the Invoke-Command cmdlet to run the Alias.ps1 file in the new session.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113296
    Import-Alias
    Get-Alias
    New-Alias
    Set-Alias

Enable-PSRemoting

NAME
    Enable-PSRemoting

SYNOPSIS
    Configures the computer to receive remote commands.

SYNTAX
    Enable-PSRemoting [-Force] [-Confirm] [-WhatIf] [<CommonParameters>]

DESCRIPTION
    The Enable-PSRemoting cmdlet configures the computer to receive Windows PowerShell remote commands that are sent by using the WS-Management technology.

    You need to run this command only once on each computer that will receive commands. You do not need to run it on computers that only send commands. Because the configuration activates listeners, it is prudent to run it only where it is needed.

    The Enable-PSRemoting cmdlet performs the following operations:

    — Runs the Set-WSManQuickConfig cmdlet, which performs the following tasks:
    —– Starts the WinRM service.
    —– Sets the startup type on the WinRM service to Automatic.
    —– Creates a listener to accept requests on any IP address.
    —– Enables a firewall exception for WS-Management communications.

    — Enables all registered Windows PowerShell session configurations to receive instructions from a remote computer.
    —– Registers the “Microsoft.PowerShell” session configuration, if it is not already registered.
    —– Registers the “Microsoft.PowerShell32” session configuration on 64-bit computers, if it is not already registered.
    —– Removes the “Deny Everyone” setting from the security descriptor for all the registered session configurations.
    —– Restarts the WinRM service to make the preceding changes effective.

    To run this cmdlet on Windows Vista, Windows Server 2008, and later versions of Windows, you must start Windows PowerShell with the “Run as administrator” option.

PARAMETERS
    -Force [<SwitchParameter>]
        Suppresses all user prompts. By default, you are prompted to confirm each operation.

        Required?                    false
        Position?                    named
        Default value                False
        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
    None
        You cannot pipe input to this cmdlet.

OUTPUTS
    System.String
        Enable-PSRemoting returns strings that describe its results.

NOTES

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

    C:\PS>Enable-PSRemoting

    Description
    ———–
    This command configures the computer to receive remote commands.

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

    C:\PS>Enable-PSRemoting -Force

    Description
    ———–
    This command configures the computer to receive remote commands. It uses the Force parameter to suppress the user prompts.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=144300
    about_remote
    about_Session_Configurations
    Disable-PSRemoting
    Get-PSSessionConfiguration
    Enable-PSSessionConfiguration
    Disable-PSSessionConfiguration
    Register-PSSessionConfiguration
    Set-PSSessionConfiguration
    WS-Management Provider

Enable-PSSessionConfiguration

NAME
    Enable-PSSessionConfiguration

SYNOPSIS
    Enables the session configurations on the local computer.

SYNTAX
    Enable-PSSessionConfiguration [[-Name] <string[]>] [-Force] [-SecurityDescriptorSddl <string>] [-Confirm] [-WhatIf] [<CommonParameters>]

DESCRIPTION
    The Enable-PSSessionConfiguration cmdlet re-enables registered session configurations that have been disabled by using the Disable-PSSessionConfiguration cmdlet. This is an advanced cmdlet that is designed to be used by system administrators to manage customized session configurations for their users.

    Without parameters, Enable-PSSessionConfiguration re-enables the Microsoft.PowerShell configuration, which is the default configuration that is used for sessions.

    This cmdlet performs the following operations for each enabled configuration:
    — Removes the “deny all” setting from the security descriptor of the configuration or replaces the security descriptor with one that you specify.
    — Turns on the listener that accepts requests on any IP address.
    — Restarts the WinRM service.

    The Enable-PSSessionConfiguration cmdlet calls the Set-WSManQuickConfig cmdlet. However, it should not be used to enable remoting on the computer. Instead, use the more comprehensive cmdlet, Enable-PSRemoting.

PARAMETERS
    -Force [<SwitchParameter>]
        Suppresses all user prompts, and restarts the WinRM service without prompting. Restarting the service makes the configuration change effective.

        To prevent a restart and suppress the restart prompt, use the NoServiceRestart parameter.

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

    -Name <string[]>
        Specifies the names of session configurations to enable. Enter one or more configuration names. Wildcards are permitted.

        You can also pipe a string that contains a configuration name or a session configuration object to Enable-PSSessionConfiguration.

        If you omit this parameter, Enable-PSSessionConfiguration enables the Microsoft.PowerShell session configuration.

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

    -SecurityDescriptorSddl <string>
        Replaces the security descriptor on the session configuration with the specified security descriptor.

        If you omit this parameter, Enable-PSSessionConfiguration just deletes the “deny all” item from the security descriptor.

        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
    Microsoft.PowerShell.Commands.PSSessionConfigurationCommands#PSSessionConfiguration, System.String
        You can pipe a session configuration object or a string that contains the name of a session configuration to Enable-PSSessionConfiguration.

OUTPUTS
    None
        This cmdlet does not return any objects.

NOTES

        To run this cmdlet on Windows Vista, Windows Server 2008, and later versions of Windows, you must start Windows PowerShell with the “Run as administrator” option.

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

    C:\PS>Enable-PSSessionConfiguration

    Description
    ———–
    This command re-enables the Microsoft.PowerShell default session configuration on the computer.

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

    C:\PS>Enable-PSSessionConfiguration -Name MaintenanceShell, AdminShell

    Description
    ———–
    This command re-enables the MaintenanceShell and AdminShell session configurations on the computer.

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

    C:\PS>Enable-PSSessionConfiguration -Name *

    C:\PS> Get-PSSessionConfiguration | Enable-PSSessionConfiguration

    Description
    ———–
    These commands re-enable all session configurations on the computer. The commands are equivalent, so you can use either one.

    Enable-PSSessionConfiguration does not generate an error if you enable a session configuration that is already enabled.

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

    C:\PS>Enable-PSSessionConfiguration -Name MaintenanceShell -SecurityDescriptorSddl “O:NSG:BAD:P(A;;GXGWGR;;;BA)(A;;GAGR;;;S-1-5-21-123456789-188441444-3100496)S:P”

    Description
    ———–
    This command re-enables the MaintenanceShell session configuration and specifies a new security descriptor for the configuration.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=144301
    about_Session_Configurations
    Disable-PSSessionConfiguration
    Get-PSSessionConfiguration
    Register-PSSessionConfiguration
    Set-PSSessionConfiguration
    Unregister-PSSessionConfiguration
    WS-Management Provider

Enable-ComputerRestore

NAME
    Enable-ComputerRestore

SYNOPSIS
    Enables the System Restore feature on the specified file system drive.

SYNTAX
    Enable-ComputerRestore [-Drive] <string[]> [-Confirm] [-WhatIf] [<CommonParameters>]

DESCRIPTION
    The Enable-ComputerRestore cmdlet turns on the System Restore feature on one or more file system drives. As a result, you can use tools, such as the Restore-Computer cmdlet, to restore the computer to a previous state.

    By default, System Restore is enabled on all eligible drives, but you can disable it, such as by using the Disable-ComputerRestore cmdlet. To enable (or re-enable) System Restore on any drive, it must be enabled on the system drive, either first or concurrently. To find the state of System Restore for each drive, use Rstrui.exe.

PARAMETERS
    -Drive <string[]>
        Specifies the file system drives. Enter one or more file system drive letters, each followed by a colon and a backslash and enclosed in quotation marks, such as “C:\” or “D:\”. This parameter is required.

        You cannot use this cmdlet to enable System Restore on a remote network drive, even if the drive is mapped to the local computer, and you cannot enable System Restore on drives that are not eligible for System Restore, such as external drives.

        To enable System Restore on any drive, System Restore must be enabled on the system drive, either before or concurrently.

        Required?                    true
        Position?                    1
        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
    None
        You cannot pipe objects to this cmdlet.

OUTPUTS
    None
        This cmdlet does not generate any output.

NOTES

        Disable-ComputerRestore and Enable-ComputerRestore work only on client operating systems, such as Windows Vista and Windows XP.

        To run an Enable-ComputerRestore command on Windows Vista and later versions of Windows, open Windows PowerShell with the “Run as administrator” option.

        To find the file system drives that are eligible for system restore, in System in Control Panel, see the System Protection tab. To open this tab in Windows PowerShell, type “SystemPropertiesProtection”.

        This cmdlet uses the Windows Management Instrumentation (WMI) SystemRestore class.

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

    C:\PS>Enable-ComputerRestore -Drive “C:\”

    Description
    ———–
    This command enables System Restore on the C: drive of the local computer.

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

    C:\PS>Enable-ComputerRestore -Drive “C:\”, “D:\”

    Description
    ———–
    This command enables System Restore on the C: and D: drives of the local computer.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=135209
    Disable-ComputerRestore
    Get-ComputerRestorePoint
    Restore-Computer
    Restart-Computer

Enable-PSBreakpoint

NAME
    Enable-PSBreakpoint

SYNOPSIS
    Enables the breakpoints in the current console.

SYNTAX
    Enable-PSBreakpoint [-Id] <Int32[]> [-PassThru] [-Confirm] [-WhatIf] [<CommonParameters>]

    Enable-PSBreakpoint [-Breakpoint] <Breakpoint[]> [-PassThru] [-Confirm] [-WhatIf] [<CommonParameters>]

DESCRIPTION
    The Enable-PSBreakpoint cmdlet re-enables disabled breakpoints. You can use it to enable all breakpoints, or you can specify breakpoints by submitting breakpoint objects or breakpoint IDs.

    A breakpoint is a point in a script where execution stops temporarily so that you can examine the instructions in the script. Newly created breakpoints are automatically enabled, but you can disable them by using the Disable-PSBreakpoint cmdlet.

    Technically, this cmdlet changes the value of the Enabled property of a breakpoint object to True.

    Enable-PSBreakpoint is one of several cmdlets designed for debugging Windows PowerShell scripts. For more information about the Windows PowerShell debugger, see about_debuggers.

PARAMETERS
    -Breakpoint <Breakpoint[]>
        Specifies the breakpoints to enable. Enter a Variable that contains breakpoint objects or a command that gets breakpoint objects, such as a Get-PSBreakpoint command. You can also pipe breakpoint objects to Enable-PSBreakpoint.

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

    -Id <Int32[]>
        Enables breakpoints that have the specified breakpoint IDs. The default value is all breakpoints. Enter the IDs or a Variable that contains the IDs. (You cannot pipe IDs to Enable-PSBreakpoint.) To find the ID of a breakpoint, use the Get-PSBreakpoint cmdlet.

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

    -PassThru [<SwitchParameter>]
        Returns an object representing the enabled breakpoint. By default, this cmdlet does not generate any output.

        Required?                    false
        Position?                    named
        Default value                No output
        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.Breakpoint
        You can pipe a breakpoint object to Enable-PSBreakpoint.

OUTPUTS
    None or System.Management.Automation.Breakpoint
        When you use the PassThru parameter, Enable-PSBreakpoint returns a breakpoint object that represent that breakpoint that was enabled. Otherwise, this cmdlet does not generate any output.

NOTES

        The Enable-PSBreakpoint cmdlet does not generate an error if you try to enable a breakpoint that is already enabled. As such, you can enable all breakpoints without error, even when only a few are disabled.

        Breakpoints are enabled when you create them by using the Set-PSBreakpoint cmdlet. You do not need to enable newly created breakpoints.

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

    C:\PS>Get-PSBreakpoint | Enable-PSBreakpoint

    Description
    ———–
    This command enables all breakpoints in the current console. You can abbreviate the command as “gbp | ebp”.

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

    C:\PS>Enable-PSBreakpoint -Id 0, 1, 5

    Description
    ———–
    This command enables breakpoints with breakpoint IDs 0, 1, and 5.

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

    C:\PS>$b = Set-PSBreakpoint -script sample.ps1 -variable Name

    C:\PS> $b | Disable-PSBreakpoint -PassThru

    AccessMode : Write
    Variable : Name
    Action     :
    Enabled    : False
    HitCount : 0
    Id         : 0
    Script     : C:\ps-test\sample.ps1
    ScriptName : C:\ps-test\sample.ps1

    C:\PS> $b | Enable-PSBreakpoint -PassThru

    AccessMode : Write
    Variable : Name
    Action     :
    Enabled    : True
    HitCount : 0
    Id         : 0
    Script     : C:\ps-test\sample.ps1
    ScriptName : C:\ps-test\sample.ps1

    Description
    ———–
    These commands re-enable a breakpoint that has been disabled.

    The first command uses the Set-PSBreakpoint cmdlet to create a breakpoint on the “Name” Variable in the Sample.ps1 script. Then, it saves the breakpoint object in the $b Variable.

    The second command uses the Disable-PSBreakpoint cmdlet to disable the new breakpoint. It uses a pipeline operator (|) to send the breakpoint object in $b to the Disable-PSBreakpoint cmdlet, and it uses the PassThru parameter of Disable-PSBreakpoint to display the disabled breakpoint object. This lets you verify that the value of the Enabled property of the breakpoint object is False.

    The third command uses the Enable-PSBreakpoint cmdlet to re-enable the breakpoint. It uses a pipeline operator (|) to send the breakpoint object in $b to the Enable-PSBreakpoint cmdlet, and it uses the PassThru parameter of Enable-PSBreakpoint to display the breakpoint object. This lets you verify that the value of the Enabled property of the breakpoint object is True.

    The results are shown in the following sample output.

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

    C:\PS>$b = Get-PSBreakpoint -Id 3, 5

    C:\PS> Enable-PSBreakpoint -breakpoint $b

    Description
    ———–
    These commands enable a set of breakpoints by specifying their breakpoint objects.

    The first command uses the Get-PSBreakpoint cmdlet to get the breakpoints and saves them in the $b Variable.

    The second command uses the Enable-PSBreakpoint cmdlet and its Breakpoint parameter to enable the breakpoints.
    This command is the equivalent of “Enable-PSBreakpoint -Id 3, 5″.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113295
    about_debuggers
    Set-PSBreakpoint
    Disable-PSBreakpoint
    Get-PSBreakpoint
    Remove-PSBreakpoint
    Get-PSCallStack