Tag Archives: Force

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-Counter

NAME
    Export-Counter

SYNOPSIS
    The Export-Counter cmdlet takes PerformanceCounterSampleSet objects and exports them as counter log files.

SYNTAX
    Export-Counter [-Path] <string> -InputObject <PerformanceCounterSampleSet[]> [-Circular <switch>] [-FileFormat <string>] [-Force <switch>] [-MaxSize <int>] [<CommonParameters>]

DESCRIPTION
    The Export-Counter cmdlet exports performance counter data (PerformanceCounterSampleSet objects) to log files in binary performance log (.blg), comma-separated value (.csv), or tab-separated value (.tsv) format. You can use this cmdlet to log or relog performance counter data.

    Export-Counter is designed to export data that is returned by the Get-Counter and Import-Counter cmdlets.

    Note: Export-Counter runs only on Windows 7, Windows Server 2008 R2, and later versions of Windows.

PARAMETERS
    -Circular <switch>
        Indicates that output file should be a circular log with first in, first out (FIFO) format. When you include this parameter, the MaxSize parameter is required.

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

    -FileFormat <string>
        Specifies the output format of the output log file. Valid values are CSV, TSV, and BLG. The default value is BLG.

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

    -Force <switch>
        Overwrites and replaces an existing file if one exists in the location specified by the Path parameter.

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

    -InputObject <PerformanceCounterSampleSet[]>
        Specifies the counter data to export. Enter a Variable that contains the data or a command that gets the data, such as a Get-Counter or Import-Counter command.

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

    -MaxSize <int>
        Specifies the maximum size of the output file.

        If the Circular parameter is specified, then when the log file reaches the specified maximum size, the oldest entries are deleted as newer ones are added. If the Circular parameter is not specified, then when the log file reaches the specified maximum size, no new data is added and the cmdlet generates a non-terminating error.

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

    -Path <string>
        Specifies the path and file name of the output file. Enter a relative or absolute path on the local computer, or a Uniform Naming Convention (UNC) path to a remote computer, such as \\Computer\Share\file.blg. This parameter is required.

        Note: The file format is determined by the value of the FileFormat parameter, not by the file name extension in the path.

        Required?                    true
        Position?                    2
        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.GetCounter.PerformanceCounterSampleSet
        You can pipe performance counter data from Get-Counter or Import-Counter to Export-Counter.

OUTPUTS
    None

NOTES

        The log file generator expects that all input objects have the same counter path and that the objects are arranged in ascending time order.

        The counter type and path of the first input object determines the properties recorded in the log file. If other input objects do not have a value for a recorded property, the property field is empty. If the objects have property values that were not recorded, the extra property values are ignored.

        Performance Monitor might not be able to read all logs that Export-Counter generates. For example, Performance Monitor requires that all objects have the same path and that all objects are separated by the same time interval.

        The Import-Counter cmdlet does not have a ComputerName parameter. However, if the computer is configured for Windows PowerShell remoting, you can use the Invoke-Command cmdlet to run an Import-Counter command on a remote computer.

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

    C:\PS># Export-Counter

    Description
    ———–
    This command exports counter data to a .blg file.

    The command uses the Get-Counter cmdlet to collect processor time data. It uses a pipeline operator (|) to send the data to the Export-Counter cmdlet. The Export-Counter command uses the Path Variable to specify the output file.

    C:\PS> Get-Counter “\Processor(*)\% Processor Time” -max 50 | Export-Counter -Path $home\counters.blg

    Because the data set might be very large, this command sends the data to Export-Counter through the pipeline. If the data were saved in a Variable, the command might use a disproportionate amount of memory.

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

    C:\PS># Export-Counter

    Description
    ———–
    These commands convert a CSV file to a counter data BLG format.

    The first command uses the built-in Windows PowerShell conversion feature to store the value of 1 gigabyte (GB) in bytes in the $1GBinBytes Variable. When you type a value followed by K (kilobyte), MB (megabyte), or GB, Windows PowerShell returns the value in bytes.

    C:\PS> $1GBinBytes = 1GB

    The second command uses the Import-Counter cmdlet to import performance counter data from the Threads.csv file. The example presumes that this file was previously exported by using the Export-Counter cmdlet.

    A pipeline operator (|) sends the imported data to the Export-Counter cmdlet. The command uses the Path parameter to specify the location of the output file. It uses the Circular and MaxSize parameters to direct Export-Counter to create a circular log that wraps at 1 GB.

    C:\PS> Import-Counter threads.csv | Export-Counter -Path threadtest.blg -Circular -MaxSize $1GBinBytes

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

    C:\PS># Export-Counter

    Description
    ———–
    This example shows how to get performance counter data from a remote computer and save the data in a file on the remote computer.

    The first command uses the Get-Counter cmdlet to collect working set counter data from Server01, a remote computer. The command saves the data in the $c Variable.

    C:\PS> $c = Get-Counter -computername Server01 -counter “\Process(*)\Working Set – Private” -maxSamples 20

    The second command uses a pipeline operator (|) to send the data in $c to the Export-Counter cmdlet, which saves it in the Workingset.blg file in the Perf share on the Server01 computer.

    C:\PS> $c | Export-Counter -Path \\Server01\Perf\WorkingSet.blg

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

    C:\PS># Export-Counter

    Description
    ———–
    This example shows how to use the Import-Counter and Export-Counter cmdlets to relog existing data.

    The first command uses the Import-Counter cmdlet to import performance counter data from the DiskSpace.blg log. It saves the data in the $all Variable. This file contains samples of the “LogicalDisk\% Free Space” counter on more than 200 remote computers in the enterprise.

    C:\PS> $all = Import-Counter DiskSpace.blg

    The second command uses the CounterSamples property of the sample set object in $all and the Where-Object cmdlet (alias = “where”) to select objects with CookedValues of less than 15 (percent). The command saves the results in the $lowSpace Variable.

    C:\PS> $lowSpace = $all.countersamples | where {$_.cookedvalues -lt 15}

    The third command uses a pipeline operator (|) to send the data in the $lowSpace Variable to the Export-Counter cmdlet. The command uses the path Variable to indicate that the selected data should be logged in the LowDiskSpace.blg file.

    C:\PS> $lowSpace | Export-Counter -Path LowDiskSpace.blg

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=138337
    Get-Counter
    Import-Counter

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-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-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-WSManCredSSP

NAME
    Enable-WSManCredSSP

SYNOPSIS
    Enables Credential Security Service Provider (CredSSP) authentication on a client computer.

SYNTAX
    Enable-WSManCredSSP [-Role] <string> [[-DelegateComputer] <string>] [<CommonParameters>]

DESCRIPTION
    The Enable-WSManCredSPP cmdlet enables CredSSP authentication on a client or on a server computer. When CredSSP authentication is used, the user’s credentials are passed to a remote computer to be authenticated. This type of authentication is designed for commands that create a remote session from within another remote session. For example, you use this type of authentication if you want to run a background job on a remote computer.

    This cmdlet is used to enable CredSSP on the client by specifying Client in the Role parameter. The cmdlet then performs the following:

        – Enables CredSSP on the client. The WS-Management setting <localhost|computername>\Client\Auth\CredSSP is set to true.
        – Sets the Windows CredSSP policy AllowFreshCredentials to WSMan/Delegate on the client.
        – Note: These settings allow the client to delegate explicit credentials to a server when server authentication is achieved.

    This cmdlet is used to enable CredSSP on the server by specifying Server in the Role parameter. The cmdlet then performs the following:

     – Enables CredSSP on the server. The WS-Management setting <localhost|computername>\Service\Auth\CredSSP is set to true.
     – Note: This policy setting allows the server to act as a delegate for clients.

    Caution: CredSSP authentication delegates the user’s credentials from the local computer to a remote computer. This practice increases the security risk of the remote operation. If the remote computer is compromised, when credentials are passed to it, the credentials can be used to control the network session.

    To disable CredSSP authentication, use the Disable-WSManCredSSP cmdlet.

PARAMETERS
    -DelegateComputer <string>
        Allows the client credentials to be delegated to the server or servers that are specified by this parameter. The value of this parameter should be a fully qualified domain name.

        If the Role parameter specifies Client, the DelegateComputer parameter is mandatory.
        If the Role parameter specifies Server, the DelegateComputer parameter is not allowed.

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

    -Role <string>
        Accepts one of two possible values: Client or Server. These values specify whether CredSSP should be enabled as a client or as a server.

        If the Role parameter specifies Client, the cmdlet performs the following:

            – Enables CredSSP on the client. The WS-Management setting <localhost|computername>\Client\Auth\CredSSP is set to true.
            – Sets the Windows CredSSP policy AllowFreshCredentials to WSMan/Delegate on the client.
            – Note: These settings allow the client to delegate explicit credentials to a server when server authentication is achieved.

        If the Role parameter specifies the Server, the cmdlet performs the following:

         – Enables CredSSP on the server. The WS-Management setting <localhost|computername>\Service\Auth\CredSSP is set to true.
         – Note: This policy setting allows the server to act as a delegate for clients.

        Required?                    true
        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
    None
        This cmdlet does not accept any input.

OUTPUTS
    System.Xml.XmlElement
        If CredSSP authentication is successfully enabled, this cmdlet generates an XMLElement object.

NOTES

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

    C:\PS>Enable-WSManCredSSP -Role client -DelegateComputer server02.accounting.fabrikam.com

    cfg         : http://schemas.microsoft.com/wbem/wsman/1/config/client/auth
    lang        : en-US
    Basic     : true
    Digest     : true
    Kerberos    : true
    Negotiate : true
    Certificate : true
    CredSSP     : true

    Description
    ———–
    This command allows the client credentials to be delegated to the server02 computer.

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

    C:\PS>Enable-WSManCredSSP -Role client -DelegateComputer *.accounting.fabrikam.com

    cfg         : http://schemas.microsoft.com/wbem/wsman/1/config/client/auth
    lang        : en-US
    Basic     : true
    Digest     : true
    Kerberos    : true
    Negotiate : true
    Certificate : true
    CredSSP     : true

    Description
    ———–
    This command allows the client credentials to be delegated to all the computers in the accounting.fabrikam.com domain.

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

    C:\PS>Enable-WSManCredSSP -Role client -DelegateComputer server02.accounting.fabrikam.com, server03.accounting.fabrikam.com, server04.accounting.fabrikam.com

    cfg         : http://schemas.microsoft.com/wbem/wsman/1/config/client/auth
    lang        : en-US
    Basic     : true
    Digest     : true
    Kerberos    : true
    Negotiate : true
    Certificate : true
    CredSSP     : true

    Description
    ———–
    This command allows the client credentials to be delegated to multiple computers.

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

    C:\PS>Enable-WSManCredSSP -Role server

    Description
    ———–
    This command allows a computer to act as a delegate for another. The Enable-WSManCredSSP cmdlet (shown in the earlier examples) only enables CredSSP authentication on the client, and specifies the remote computers that can act on it’s behalf. In order for the remote computer to act as a delegate for the client, the CredSSP item in the Service node of WSMan must be set to true.

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

    C:\PS>Connect-WSMan server02
    Set-Item WSMan:\server02\service\auth\credSSP -value $true

    Description
    ———–
    This command allows a computer to act as a delegate for another computer. The Enable-WSManCredSSP commands that are shown in the earlier examples enable CredSSP authentication only on the client computer, and they specify the remote computers that can act on behalf of the client computer. For the remote computer to act as a delegate for the client computer, the CredSSP item in the Service directory of the WSMan provider must be set to true.

    In this example, the first command creates a connection to the remote server02 computer.

    The second command sets the credSSP value on the remote server02 computer, which allows the remote computer to act as a delegate.

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

Disable-PSSessionConfiguration

NAME
    Disable-PSSessionConfiguration

SYNOPSIS
    Denies access to the session configurations on the local computer.

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

DESCRIPTION
    The Disable-PSSessionConfiguration cmdlet prevents all users of the computer from using the session configuration in a session. This is an advanced cmdlet that is designed to be used by system administrators to manage customized session configurations for their users.

    The Disable-PSSessionConfiguration cmdlet adds a “deny all” setting to the security descriptor of one or more registered session configurations. As a result, you can unregister, view, and change the configurations, but you cannot use them in a session.

    Without parameters, Disable-PSSessionConfiguration disables the Microsoft.PowerShell configuration, which is the default configuration that is used for sessions. Unless the user specifies a different configuration, both local and remote users are effectively prevented from creating any sessions that connect to the computer.

    To disable all session configurations on the computer, use Disable-PSRemoting.

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

    -Name <string[]>
        Specifies the names of session configurations to disable. 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 Disable-PSSessionConfiguration.

        If you omit this parameter, Disable-PSSessionConfiguration disables the Microsoft.PowerShell session configuration.

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

    -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 Disable-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>Disable-PSSessionConfiguration

    Description
    ———–
    This command disables the Microsoft.PowerShell session configuration.

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

    C:\PS>Disable-PSSessionConfiguration -Name *

    Description
    ———–
    This command disables all registered session configurations on the computer.

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

    C:\PS>Disable-PSSessionConfiguration -Name Microsoft* -Force

    Description
    ———–
    This command disables all session configurations that have names that begin with “Microsoft”. The command uses the Force parameter to suppress all user prompts from the command.

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

    C:\PS>Get-PSSessionConfiguration -Name MaintenanceShell, AdminShell | Disable-PSSessionConfiguration

    Description
    ———–
    This command disables the MaintenanceShell and AdminShell session configurations.

    The command uses a pipeline operator (|) to send the results of a Get-PSSessionConfiguration command to Disable-PSSessionConfiguration.

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

    C:\PS>Get-PSSessionConfiguration | Format-Table -property Name, Permission -auto

    Name                 Permission
    —-                 ———-
    MaintenanceShell     BUILTIN\Administrators AccessAllowed
    microsoft.powershell BUILTIN\Administrators AccessAllowed
    microsoft.powershell32 BUILTIN\Administrators AccessAllowed

    C:\PS> Disable-PSSessionConfiguration -Name MaintenanceShell -Force

    C:\PS> Get-PSSessionConfiguration | Format-Table -property Name, Permission -auto

    Name                 Permission
    —-                 ———-
    MaintenanceShell     Everyone AccessDenied, BUILTIN\Administrators AccessAllowed
    microsoft.powershell BUILTIN\Administrators AccessAllowed
    microsoft.powershell32 BUILTIN\Administrators AccessAllowed

    C:\PS> Set-PSSessionConfiguration -Name MaintenanceShell -MaximumReceivedDataSizePerCommandMB 60

    ParamName            ParamValue
    ———            ———-
    psmaximumreceived… 60

    “Restart WinRM service”
    WinRM service need to be restarted to make the changes effective. Do you want to run the command “Restart-Service winrm”?
    [Y] Yes [N] No [S] Suspend [?] Help (default is “Y”): y

    C:\PS> New-PSSession -computername localhost -configurationName MaintenanceShell

    [localhost] Connecting to remote server failed with the following error message : Access is denied. For more information, see the about_remote_Troubl
    eshooting Help topic.
        + CategoryInfo         : OpenError: (System.Manageme….RemoteRunspace:RemoteRunspace) [], PSRemotingTransportException
        + FullyQualifiedErrorId : PSSessionOpenFailed

    Description
    ———–
    This example shows the effect of disabling a session configuration.

    The first command uses the Get-SessionConfiguration and Format-Table cmdlets to display only the Name and Permission properties of the session configuration objects. This table format makes it easier to see the values of the objects. The results show that members of the Administrators group are permitted to use the session configurations.

    The second command uses the Disable-PSSessionConfiguration cmdlet to disable the MaintenanceShell session configuration. The command uses the Force parameter to suppress all user prompts.

    The third command repeats the first command. The results show that you can still get the object that represents the MaintenanceShell session configuration even though everyone is denied access to it. The “AccessDenied” entry takes precedence over all other entries in the security descriptor.

    The fourth command uses the Set-PSSessionConfiguration cmdlet to increase the MaximumDataSizePerCommandMB setting on the MaintenanceShell session configuration to 60. The results show that the command was successful even though everyone is denied access to the configuration.

    The fifth command attempts to use the MaintenanceShell session configuration in a session. It uses the New-PSSession cmdlet to create a new session and the ConfigurationName parameter to specify the MaintenanceShell configuration. The results show that the New-PSSession command fails because the user is denied access to the configuration.

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

Copy-ItemProperty

NAME
    Copy-ItemProperty

SYNOPSIS
    Copies a property and value from a specified location to another location.

SYNTAX
    Copy-ItemProperty [-LiteralPath] <string[]> [-Destination] <string> [-Name] <string> [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Force] [-Include <string[]>] [-PassThru] [-Confirm] [-WhatIf] [-UseTransaction] [<CommonParameters>]

    Copy-ItemProperty [-Path] <string[]> [-Destination] <string> [-Name] <string> [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Force] [-Include <string[]>] [-PassThru] [-Confirm] [-WhatIf] [-UseTransaction] [<CommonParameters>]

DESCRIPTION
    The Copy-ItemProperty cmdlet copies a property and value from a specified location to another location. For example, you can use Copy-ItemProperty to copy one or more Registry entries from one Registry key to another Registry key.

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

    -Destination <string>
        Specifies the path to the destination location.

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

    -Exclude <string[]>
        Omits the specified items. 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

    -Force [<SwitchParameter>]
        Allows the cmdlet to override restrictions such as renaming existing files as long as security is not compromised.

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

    -Include <string[]>
        Specifies only those items upon which the cmdlet will act, excluding all others.

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

    -LiteralPath <string[]>
        Specifies a path to the item property. 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

    -Name <string>
        Specifies the name of the property to be copied.

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

    -PassThru [<SwitchParameter>]
        Returns an object representing the copied item property. 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[]>
        Specifies the path to the property to be copied.

        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 Copy-ItemProperty.

OUTPUTS
    None or System.Management.Automation.PSCustomObject
        When you use the Passthru parameter, Copy-ItemProperty generates a PsCustomObject representing the copied item property. Otherwise, this cmdlet does not generate any output.

NOTES

        The Copy-ItemProperty 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>Copy-Itemproperty -Path MyApplication -Destination HKLM:\Software\MyApplicationRev2 -Name MyProperty

    Description
    ———–
    This command copies the property named MyProperty from the MyApplication Registry key to the MyApplicationRev2 Registry key.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113293
    about_providers
    Clear-ItemProperty
    New-ItemProperty
    Move-ItemProperty
    Rename-ItemProperty
    Get-ItemProperty
    Set-ItemProperty