Poweshell-Commands


Poweshell-Commands




Export-Alias Export-Clixml Export-Counter Export-ModuleMember Export-Console Export-FormatData Export-CSV Export-PSSession

Example



NAME
    Export-Counter
    
SYNOPSIS
    The Export-Counter cmdlet takes PerformanceCounterSampleSet objects and exp
    orts them as counter log files.
    
SYNTAX
    Export-Counter [-Path]  -InputObject  [-Circular ] [-FileFormat ] [-Force ] [-MaxSize <
    int>] []
    
    
DESCRIPTION
    The Export-Counter cmdlet exports performance counter data (PerformanceCoun
    terSampleSet 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-Count
    er and Import-Counter cmdlets.
    
    Note: Export-Counter runs only on Windows 7, Windows Server 2008 R2, and la
    ter versions of Windows.
    

PARAMETERS
    -Circular 
        Indicates that output file should be a circular log with first in, firs
        t out (FIFO) format. When you include this parameter, the MaxSize param
        eter is required.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -FileFormat 
        Specifies the output format of the output log file.  Valid values are C
        SV, TSV, and BLG.  The default value is BLG.
        
        Required?                    false
        Position?                    named
        Default value                BLG
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -Force 
        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 
        Specifies the counter data to export. Enter a variable that contains th
        e 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 
        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 one
        s 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 t
        he cmdlet generates a non-terminating error.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -Path 
        Specifies the path and file name of the output file. Enter a relative o
        r 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 para
        meter, not by the file name extension in the path.
        
        Required?                    true
        Position?                    2
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    
        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-Counte
        r to Export-Counter.
    
    
OUTPUTS
    None
        
    
    
NOTES
    
    
        The log file generator expects that all input objects have the same cou
        nter path and that the objects are arranged in ascending time order.
        
        The counter type and path of the first input object determines the prop
        erties recorded in the log file. If other input objects do not have a v
        alue for a recorded property, the property field is empty. If the objec
        ts have property values that were not recorded, the extra property valu
        es are ignored. 
        
        Performance Monitor might not be able to read all logs that Export-Coun
        ter generates. For example, Performance Monitor requires that all objec
        ts have the same path and that all objects are separated by the same ti
        me interval.
        
        The Import-Counter cmdlet does not have a ComputerName parameter. Howev
        er, 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 fi
    le.
    
    C:\PS> get-counter "\Processor(*)\% Processor Time" -max 50 | export-counte
    r -path $home\counters.blg
    
    Because the data set might be very large, this command sends the data to Ex
    port-Counter through the pipeline. If the data were saved in a variable, th
    e 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 t
    o 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, Windo
    ws PowerShell returns the value in bytes.
    
    C:\PS> $1GBinBytes = 1GB
    
    
    The second command uses the Import-Counter cmdlet to import performance cou
    nter data from the Threads.csv file. The example presumes that this file wa
    s previously exported by using the Export-Counter cmdlet.
    
    A pipeline operator (|) sends the imported data to the Export-Counter cmdle
    t. The command uses the Path parameter to specify the location of the outpu
    t file. It uses the Circular and MaxSize parameters to direct Export-Counte
    r to create a circular log that wraps at 1 GB.
    
    C:\PS> import-counter threads.csv | export-counter -path threadtest.blg -ci
    rcular -maxsize $1GBinBytes
    
    
    
    
    
    -------------------------- EXAMPLE 3 --------------------------
    
    C:\PS># Export-Counter
    
    
    Description
    -----------
    This example shows how to get performance counter data from a remote comput
    er and save the data in a file on the remote computer.
    
    
    The first command uses the Get-Counter cmdlet to collect working set counte
    r data from Server01, a remote computer. The command saves the data in the 
    $c variable.
    
    C:\PS> $c = get-counter -computername Server01 -counter "\Process(*)\Workin
    g Set - Private" -maxSamples 20
    
    
    
    The second command uses a pipeline operator (|) to send the data in $c to t
    he 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 coun
    ter 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 m
    ore 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 objec
    t in $all and the Where-Object cmdlet (alias = "where") to select objects w
    ith CookedValues of less than 15 (percent). The command saves the results i
    n 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 $low
    Space variable to the Export-Counter cmdlet. The command uses the path vari
    able to indicate that the selected data should be logged in the LowDiskSpac
    e.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 




NAME
    Export-ModuleMember
    
SYNOPSIS
    Specifies the module members that are exported.
    
SYNTAX
    Export-ModuleMember [[-Function] ] [-Alias ] [-Cmdlet <
    string[]>] [-Variable ] []
    
    
DESCRIPTION
    The Export-ModuleMember cmdlet specifies the module members (such as cmdlet
    s, functions, variables, and aliases) that are exported from a script modul
    e (.psm1) file, or from a dynamic module created by using the New-Module cm
    dlet. This cmdlet can be used only in a script module file or a dynamic mod
    ule.
    
    If a script module does not include an Export-ModuleMember command, the fun
    ctions in the script module are exported, but the variables and aliases are
     not. When a script module includes an Export-ModuleMember command, only th
    e members specified in the Export-ModuleMember command are exported.
    
    If a script module contains multiple Export-ModuleMember commands, only the
     members listed in an Export-ModuleMember command are exported.
    
    You can also use Export-ModuleMember to export members that the script modu
    le imports from other modules.
    

PARAMETERS
    -Alias 
        Specifies the aliases that are exported from the script module file. En
        ter the alias names. Wildcards are permitted.
        
        Required?                    false
        Position?                    named
        Default value                None
        Accept pipeline input?       true (ByPropertyName)
        Accept wildcard characters?  true
        
    -Cmdlet 
        Specifies the cmdlets that are exported from the script module file. En
        ter the cmdlet names. Wildcards are permitted.
        
        You cannot create cmdlets in a script module file, but you can import c
        mdlets from a binary module into a script module and re-export them fro
        m the script module.
        
        Required?                    false
        Position?                    named
        Default value                None
        Accept pipeline input?       true (ByPropertyName)
        Accept wildcard characters?  true
        
    -Function 
        Specifies the functions that are exported from the script module file. 
        Enter the function names. Wildcards are permitted. You can also pipe fu
        nction name strings to Export-ModuleMember.
        
        Required?                    false
        Position?                    1
        Default value                None
        Accept pipeline input?       true (ByValue, ByPropertyName)
        Accept wildcard characters?  true
        
    -Variable 
        Specifies the variables that are exported from the script module file. 
        Enter the variable names (without a dollar sign). Wildcards are permitt
        ed.
        
        Required?                    false
        Position?                    named
        Default value                None
        Accept pipeline input?       true (ByPropertyName)
        Accept wildcard characters?  true
        
    
        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 function name strings to Export-ModuleMember.
    
    
OUTPUTS
    None
        This cmdlet does not generate any output.
    
    
NOTES
    
    
        To exclude a member from the list of exported members, add an Export-Mo
        duleMember command that lists all other members but omits the member th
        at you want to exclude.
        
    
    -------------------------- EXAMPLE 1 --------------------------
    
    C:\PS>Export-ModuleMember -function * -alias *
    
    
    Description
    -----------
    This command exports the aliases defined in the script module, along with t
    he functions defined in the script module. 
    
    To export the aliases, which are not exported by default, you must also exp
    licitly specify the functions. Otherwise, only the aliases will be exported
    .
    
    
    
    
    
    -------------------------- EXAMPLE 2 --------------------------
    
    C:\PS>Export-ModuleMember -function Get-Test, New-Test, Start-Test -alias g
    tt, ntt, stt
    
    
    Description
    -----------
    This command exports three aliases and three functions defined in the scrip
    t module. 
    
    You can use this command format to specify the names of module members.
    
    
    
    
    
    -------------------------- EXAMPLE 3 --------------------------
    
    C:\PS>Export-ModuleMember
    
    
    Description
    -----------
    This command specifies that no members defined in the script module are exp
    orted.
    
    This command prevents the module members from being exported, but it does n
    ot hide the members. Users can read and copy module members or use the call
     operator (&) to invoke module members that are not exported.
    
    
    
    
    
    -------------------------- EXAMPLE 4 --------------------------
    
    C:\PS>Export-ModuleMember -variable increment
    
    
    Description
    -----------
    This command exports only the $increment variable from the script module. N
    o other members are exported. 
    
    If you want to export a variable, in addition to exporting the functions in
     a module, the Export-ModuleMember command must include the names of all of
     the functions and the name of the variable.
    
    
    
    
    
    -------------------------- EXAMPLE 5 --------------------------
    
    C:\PS># From TestModule.psm1
    
    function new-test 
        {  }
    export-modulemember -function new-test
    
    function validate-test 
        {  }
    
    function start-test 
        {  }
    set-alias stt start-test
    export-modulemember -function *-test -alias stt
    
    
    Description
    -----------
    These commands show how multiple Export-ModuleMember commands are interpret
    ed in a script module (.psm1) file.
    
    These commands create three functions and one alias, and then they export t
    wo of the functions and the alias.
    
    Without the Export-ModuleMember commands, all three of the functions would 
    be exported, but the alias would not be exported. With the Export-ModuleMem
    ber commands, only the Get-Test and Start-Test functions and the STT alias 
    are exported.
    
    
    
    
    
    -------------------------- EXAMPLE 6 --------------------------
    
    C:\PS>new-module -script {function SayHello {"Hello!"}; set-alias Hi SayHel
    lo; Export-ModuleMember -alias Hi -function SayHello}
    
    
    Description
    -----------
    This command shows how to use Export-ModuleMember in a dynamic module that 
    is created by using the New-Module cmdlet.
    
    In this example, Export-ModuleMember is used to export both the "Hi" alias 
    and the "SayHello" function in the dynamic module.
    
    
    
    
    
    -------------------------- EXAMPLE 7 --------------------------
    
    C:\PS>function export
    {
        param (
            [parameter(mandatory=$true)] [validateset("function","variable")] $
    type,
            [parameter(mandatory=$true)] $name,
            [parameter(mandatory=$true)] $value
        )
        if ($type -eq "function")
        {
            Set-item "function:script:$name" $value
            Export-ModuleMember $name
        }
        else
        {
            Set-Variable -scope Script $name $value
            Export-ModuleMember -variable $name
        }
    } 
    
    export function New-Test 
    {
      ...
    }
    
    
    function helper
    {
      ...
    }
    
    export variable interval 0
    $interval = 2
    
    
    Description
    -----------
    This example includes a function named Export that declares a function or c
    reates a variable, and then writes an Export-ModuleMember command for the f
    unction or variable. This lets you declare and export a function or variabl
    e in a single command.
    
    To use the Export function, include it in your script module. To export a f
    unction, type "Export" before the Function keyword. 
    
    To export a variable, use the following format to declare the variable and 
    set its value:
    
        export variable  
    
    The commands in the example show the correct format. In this example, only 
    the New-Test function and the $Interval variable are exported.
    
    
    
    
    
    
RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=141551
    Import-Module 
    Get-Module 
    Remove-Module 
    about_Modules 




NAME
    Export-Console
    
SYNOPSIS
    Exports the names of snap-ins in the current session to a console file.
    
SYNTAX
    Export-Console [[-Path] ] [-Force] [-NoClobber] [-Confirm] [-WhatIf
    ] []
    
    
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). Yo
    u 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 P
    owerShell (Powershell.exe) at the command line by using Cmd.exe or another 
    Windows PowerShell session, and then use the PSConsoleFile parameter of Pow
    ershell.exe to specify the console file. 
    
    For more information about Windows PowerShell snap-ins, see about_PSSnapins
    .
    

PARAMETERS
    -Force []
        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 []
        Will not overwrite (replace the contents of) an existing console file. 
        By default, if a file exists in the specified path, Export-Console over
        writes the file without warning.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -Path 
        Specifies a path and file name for the console file (*.psc1). Enter a p
        ath (optional) and name. Wildcards are not permitted.
        
        If you type only a file name, Export-Console creates a file with that n
        ame and the ".psc1" file name extension in the current directory.
        
        This parameter is required unless you have opened Windows PowerShell wi
        th the PSConsoleFile parameter or exported a console file during the cu
        rrent 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 con
        tent 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 a
        bout_Automatic_Variables.
        
        Required?                    false
        Position?                    1
        Default value                
        Accept pipeline input?       true (ByValue, ByPropertyName)
        Accept wildcard characters?  false
        
    -Confirm []
        Prompts you for confirmation before executing the command.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -WhatIf []
        Describes what would happen if you executed the command without actuall
        y executing the command.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    
        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 t
        he console file is automatically stored in the $ConsoleFileName automat
        ic variable.  The value of $ConsoleFileName is updated when you use the
         Path parameter of Export-Console to specify a new console file. When n
        o console file is used, $ConsoleFileName has no value ($null).
        
        To use a Windows PowerShell console file in a new session, use the foll
        owing syntax to start Windows PowerShell:
        "powershell.exe -PsConsoleFile .psc1".
        
        You can also save Windows PowerShell snap-ins for future sessions by ad
        ding an Add-PSSnapin command to your Windows PowerShell profile. For mo
        re 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 curren
    t session to the ConsoleS1.psc1 file in the Consoles subdirectory of the Wi
    ndows 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 curren
    t session, export the names of Windows PowerShell snap-ins in the current s
    ession 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 tha
    t are registered on your system.
    
    The second command exports the Windows PowerShell snap-in names to the NewP
    SSnapinConsole.psc1 file.
    
    The third command starts Windows PowerShell with the NewPSSnapinConsole.psc
    1 file. Because the console file includes the Windows PowerShell snap-in na
    me, the cmdlets and providers in the snap-in are available in the current s
    ession.
    
    
    
    
    
    -------------------------- EXAMPLE 4 --------------------------
    
    C:\PS>export-console -path Console01
    
    C:\PS> notepad console01.psc1
    
    
    
      2.0
      
        
      
    
    
    
    Description
    -----------
    This command exports the names of the Windows PowerShell snap-ins in the cu
    rrent session to the Console01.psc1 file in the current directory. 
    
    The second command displays the contents of the Console01.psc1 file in Note
    pad.
    
    
    
    
    
    -------------------------- 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 de
    termine the console file that will be updated if you use Export-Console wit
    hout a Path parameter value.
    
    The first command uses the PSConsoleFile parameter of PowerShell.exe to ope
    n 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. T
    his 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 




NAME
    Export-FormatData
    
SYNOPSIS
    Saves formatting data from the current session in a formatting file.
    
SYNTAX
    Export-FormatData [-Force] [-IncludeScriptBlock] [-InputObject ] [-NoClobber] [-Path ] []
    
    
DESCRIPTION
    The Export-FormatData cmdlet creates Windows PowerShell formatting files (f
    ormat.ps1xml) from the formatting objects in the current session. It takes 
    the ExtendedTypeDefinition objects that Get-FormatData returns and saves th
    em in a file in XML format.   
    
    Windows PowerShell uses the data in formatting files (format.ps1xml) to gen
    erate the default display of Microsoft .NET Framework objects in the sessio
    n. You can view and edit the formatting files and use the Update-FormatData
     cmdlet to add the formatting data to a session.
    
    For more information about formatting files in Windows PowerShell, see abou
    t_Format.ps1xml.
    

PARAMETERS
    -Force []
        Overwrites an existing output file, even if the file has the read-only 
        attribute.
        
        Required?                    false
        Position?                    named
        Default value                False
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -IncludeScriptBlock []
        Determines whether script blocks in the format data are exported. 
        
        Because script blocks contain code and can be used maliciously, they ar
        e not exported by default.
        
        Required?                    false
        Position?                    named
        Default value                False
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -InputObject 
        Specifies the format data objects to be exported. Enter a variable that
         contains the objects or a command that gets the objects, such as a Get
        -FormatData command. You can also pipe the objects from Get-FormatData 
        to Export-FormatData.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       true (ByValue)
        Accept wildcard characters?  false
        
    -NoClobber []
        Prevents the cmdlet from overwriting existing files. By default, Export
        -FormatData overwrites files without warning unless the file has the re
        ad-only attribute.
        
        To direct Export-FormatData to overwrite read-only files, use the Force
         parameter.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -Path 
        Specifies a location for the output file.  Enter a path (optional) and 
        file name with a format.ps1xml file name extension. If you omit the pat
        h, Export-FormatData creates the file in the current directory.
        
        If you use a file name extension other than .ps1xml, the Update-FormatD
        ata cmdlet will not recognize the file. 
        
        If you specify an existing file, Export-FormatData overwrites the file 
        without warning, unless the file has the read-only attribute. To overwr
        ite a read-only file, use the Force parameter. To prevent files from be
        ing overwritten, use the NoClobber parameter.
        
        Required?                    false
        Position?                    named
        Default value                None
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    
        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.ExtendedTypeDefinition
        You can pipe ExtendedTypeDefinition objects from Get-FormatData to Expo
        rt-FormatData.
    
    
OUTPUTS
    None
        Export-FormatData does not return any objects. It generates a file and 
        saves it in the specified path.
    
    
NOTES
    
    
        To use any formatting file, including an exported formatting file, the 
        execution policy for the session must allow scripts and configuration f
        iles to run. For more information, see about_Execution_Policies.
        
    
    -------------------------- EXAMPLE 1 --------------------------
    
    C:\PS>get-formatdata -typename * | export-formatdata -path allformat.ps1xml
     -IncludeScriptBlock
    
    
    Description
    -----------
    This command exports all of the format data in the session to the AllFormat
    .ps1xml file.
    
    The command uses the Get-FormatData cmdlet to get the format data in the se
    ssion. A value of * (all) for the TypeName parameter directs the cmdlet to 
    get all of the data in the session.
    
    The command uses a pipeline operator (|) to send the format data from the G
    et-FormatData command to the Export-FormatData cmdlet, which exports the fo
    rmat data to the AllFormat.ps1 file.
    
    The Export-FormatData command uses the IncludeScriptBlock parameter to incl
    ude script blocks in the format data in the file.
    
    
    
    
    
    -------------------------- EXAMPLE 2 --------------------------
    
    C:\PS>$f = get-formatdata -typename helpinfoshort
    
    C:\PS> export-formatdata -inputObject $f -path c:\test\help.format.ps1xml -
    IncludeScriptBlock
    
    
    Description
    -----------
    These commands export the format data for the HelpInfoShort type to the Hel
    p.format.ps1xml file.
    
    The first command uses the Get-FormatData cmdlet to get the format data for
     the HelpInfoShort type, and it saves it in the $f variable.
    
    The second command uses the InputObject parameter of the Export-FormatData 
    to enter the format data saved in the $f variable. It also uses the Include
    ScriptBlock parameter to include script blocks in the output.
    
    
    
    
    
    -------------------------- EXAMPLE 3 --------------------------
    
    C:\PS>get-formatdata -typename System.Diagnostics.Process | export-FormatDa
    ta -path process.format.ps1xml
    
    C:\PS> Update-FormatData -prependPath .\process.format.ps1xml
    
    C:\PS> get-process p*
    
    Handles  NPM(K)  PM(K)  WS(K) VM(M)   CPU(s)    Id ProcessName
    -------  ------  -----  ----- -----   ------    -- -----------
        323                                       5600 powershell
        336                                       3900 powershell_ise
        138                                       4076 PresentationFontCache
    
    
    Description
    -----------
    This example shows the effect of omitting the IncludeScriptBlock parameter 
    from an Export-FormatData command.
    
    The first command uses the Get-FormatData cmdlet to get the format data for
     the System.Diagnostics.Process object that the Get-Process cmdlet returns.
     The command uses a pipeline operator (|) to send the formatting data to th
    e Export-FormatData cmdlet, which exports it to the Process.format.ps1xml f
    ile in the current directory.
    
    In this case, the Export-FormatData command does not use the IncludeScriptB
    lock parameter.
    
    The second command uses the Update-FormatData cmdlet to add the Process.for
    mat.ps1xml file to the current session. The command uses the PrependPath pa
    rameter to ensure that the formatting data for process objects in the Proce
    ss.format.ps1xml file is found before the standard formatting data for proc
    ess objects.
    
    The third command shows the effects of this change. The command uses the Ge
    t-Process cmdlet to get processes that have names that begin with "P". The 
    output shows that property values that are calculated by using script block
    s are missing from the display.
    
    
    
    
    
    
RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=144302
    Get-FormatData 
    Update-FormatData 




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] ] [-Path]  -InputObject  [
    -Encoding ] [-Force] [-NoClobber] [-NoTypeInformation] [-Confirm] [
    -WhatIf] []
    
    Export-CSV [-UseCulture] [-Path]  -InputObject  [-Encodin
    g ] [-Force] [-NoClobber] [-NoTypeInformation] [-Confirm] [-WhatIf]
     []
    
    
DESCRIPTION
    The Export-CSV cmdlet creates a CSV variable-length file that represents th
    e objects that you submit. 
    You can then use the Import-CSV cmdlet to re-create objects from the CSV st
    rings in the files. The resulting objects are CSV versions of the original 
    objects that consist of string representations of the property values and n
    o 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 fi
    le based on the properties of the first object that you submit. If the rema
    ining objects do not have one of the specified properties, the property val
    ue of that object is null, as represented by two consecutive commas. If the
     remaining objects have additional properties, those property values are no
    t included in the file.
    
    For more information, see Export-CSV, and see the Notes section.
    

PARAMETERS
    -Delimiter 
        Specifies a delimiter to separate the property values. The default is a
         comma (,). Enter a character, such as a colon (:). To specify a semico
        lon (;), enclose it in quotation marks.
        
        Required?                    false
        Position?                    2
        Default value                , (comma)
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -Encoding 
        Specifies the encoding for the exported CSV file. Valid values are Unic
        ode, 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 []
        Overwrites the file specified in path without prompting.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -InputObject 
        Specifies the objects to export as CSV strings. Enter a variable that c
        ontains the objects or type a command or expression that gets the objec
        ts. 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 []
        Do not overwrite (replace the contents) of an existing file. By default
        , if a file exists in the specified path, Export-CSV overwrites the fil
        e without warning.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -NoTypeInformation []
        Omits the type information from the CSV file. By default, the first lin
        e of the CSV file contains "#TYPE " followed by the fully-qualified nam
        e of the type of the .NET Framework object.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -Path 
        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 []
        Use the list separator for the current culture as the item delimiter. T
        he 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 foll
        owing command: (Get-Culture).TextInfo.ListSeparator.
        
        Required?                    false
        Position?                    named
        Default value                Comma
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -Confirm []
        Prompts you for confirmation before executing the command.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -WhatIf []
        Describes what would happen if you executed the command without actuall
        y executing the command.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    
        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 serie
        s of CSV variable-length strings and saves them in the specified text f
        ile. 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 o
        f 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 doe
        s 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 th
        e NoTypeInformation parameter.
        
        -- The next line of the CSV file represents the column headers. It cont
        ains a comma-separated list of the names of all the properties of the f
        irst 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,Workin
    gSet | export-csv -path data.csv
    
    
    Description
    -----------
    This command selects a few properties of the wmiprvse process and exports t
    hem 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 specif
    y 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 para
    meter 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 par
    ameter to direct Export-CSV to use the delimiter specified by the ListSepar
    ator 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 NoTypeInformat
    ion 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 




NAME
    Export-Alias
    
SYNOPSIS
    Exports information about currently defined aliases to a file.
    
SYNTAX
    Export-Alias [-Path]  [[-Name] ] [-Append] 
	[-As {Csv | Script}] [-Description ] [-Force] [-NoClobber] 
	[-PassThru] [-Scope ] [-Confirm] [-WhatIf] []
    
    
DESCRIPTION
    The Export-Alias cmdlet exports the aliases in the current session to a fil
    e.  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 t
    hat you can add to a session or to a Windows PowerShell profile.
    

PARAMETERS
    -Append []
        Appends the output to the specified file, rather than overwriting the e
        xisting contents of that file.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -As 
        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 
        Adds a description to the exported file. The description appears as a c
        omment 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 []
        Overwrites the output file, even if the read-only attribute is set on t
        he file. 
        
        By default, Export-Alias overwrites files without warning, unless the r
        ead-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 t
        he hidden attribute.
        
        Required?                    false
        Position?                    named
        Default value                Does not overwrite read-only files.
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -Name 
        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 []
        Prevents Export-Alias from overwriting any files, even if the Force par
        ameter is used in the command.
        
        If the NoClobber parameter is omitted, Export-Alias will overwrite an e
        xisting file without warning, unless the read-only attribute is set on 
        the file. NoClobber takes precedence over the Force parameter, which pe
        rmits 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 []
        Returns objects that represent the aliases that were exported. By defau
        lt, this cmdlet does not generate any output.
        
        Required?                    false
        Position?                    named
        Default value                No output
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -Path 
        Specifies the path to the output file. Wildcards are permitted, but the
         resulting path value must resolve to a single file name. This paramete
        r is required.
        
        Required?                    true
        Position?                    1
        Default value                None
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -Scope 
        Specifies the scope from which the aliases should be exported.  
        
        Valid values are "Global", "Local", or "Script", or a number relative t
        o the current scope (0 through the number of scopes where 0 is the curr
        ent scope and 1 is its parent). "Local" is the default. For more inform
        ation, see about_Scopes.
        
        Required?                    false
        Position?                    named
        Default value                Local
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -Confirm []
        Prompts you for confirmation before executing the command.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -WhatIf []
        Describes what would happen if you executed the command without actuall
        y executing the command.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    
        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.Mana
        gement.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 fil
    e. 
    
    Because the NoClobber parameter is specified, the command will fail if an A
    lias.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 fi
    le. 
    
    The command uses the Description parameter to add a description to the comm
    ents at the top of the file. 
    
    The command also uses the Force parameter to overwrite any existing Alias.c
    sv 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 gene
    rates.
    
    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 co
    ntains a Set-Alias command for each alias.
    
    The second command adds the aliases in the Alias.ps1 file to the CurrentUse
    r-CurrentHost profile. (The path to the profile is saved in the $profile va
    riable.) The command uses the Get-Content cmdlet to get the aliases from th
    e 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  r
    emote session on the Server01 computer. The third command uses the New-PSSe
    ssion cmdlet to create the session. The fourth command uses the FilePath pa
    rameter of the Invoke-Command cmdlet to run the Alias.ps1 file in the new s
    ession.
    
    
    
    
    
    
RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113296
    Import-Alias 
    Get-Alias 
    New-Alias 
    Set-Alias 




NAME
    Export-PSSession
    
SYNOPSIS
    Imports commands from another session and saves them in a Windows PowerShel
    l module.
    
SYNTAX
    Export-PSSession [-Session]  [-OutputModule]  [[-Command
    Name] ] [[-FormatTypeName] ] [-AllowClobber] [-Argument
    List ] [-CommandType {Alias | Function | Filter | Cmdlet | Extern
    alScript | Application | Script | All}] [-Encoding ] [-Force] [-Mod
    ule ] []
    
    
DESCRIPTION
    The Export-PSSession cmdlet gets cmdlets, functions, aliases, and other com
    mand types from another PSSession on a local or remote computer and saves t
    hem in a Windows PowerShell module. To add the commands from the module to 
    the current session, use the Import-Module cmdlet.
    
    Unlike Import-PSSession, which imports commands from another PSSession into
     the current session, Export-PSSession saves the commands in a module. The 
    commands are not imported into the current session.
    
    To export commands, first use the New-PSSession cmdlet to create a PSSessio
    n that has the commands that you want to export. Then use the Export-PSSess
    ion cmdlet to export the commands. By default, Export-PSSession exports all
     commands, except for commands that exist in the current session, but you c
    an use the CommandName parameters to specify the commands to export.
    
    The Export-PSSession cmdlet uses the implicit remoting feature of Windows P
    owerShell. When you import commands into the current session, they run impl
    icitly  in the original session or in a  similar session on the originating
     computer.
    

PARAMETERS
    -AllowClobber []
        Exports the specified commands, even if they have the same names as com
        mands in the current session.
        
        If you import a command with the same name as a command in the current 
        session, the imported command hides or replaces the original commands. 
        For more information, see about_Command_Precedence. 
        
        Export-PSSession does not import commands that have the same names as c
        ommands in the current session. The default behavior is designed to pre
        vent command name conflicts.
        
        Required?                    false
        Position?                    named
        Default value                False
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -ArgumentList 
        Exports the variant of the command that results from using the specifie
        d arguments (parameter values). 
        
        For example, to export the variant of the Get-Item command in the certi
        ficate (Cert:) drive in the PSSession in $s, type "export-pssession -se
        ssion $s -command get-item -argumentlist cert:".
        
        Required?                    false
        Position?                    named
        Default value                None
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -CommandName 
        Exports only the commands with the specified names or name patterns. Wi
        ldcards are permitted. Use "CommandName" or its alias, "Name".
        
        By default, Export-PSSession exports all commands from the PSSession ex
        cept for commands that have the same names as commands in the current s
        ession. This prevents imported commands from hiding or replacing comman
        ds in the current session. To export all commands, even those that hide
         or replace other commands, use the AllowClobber parameter.
        
        If you use the CommandName parameter, the formatting files for the comm
        ands are not exported unless you use the FormatTypeName parameter. Simi
        larly, if you use the FormatTypeName parameter, no commands are exporte
        d unless you use the CommandName parameter.
        
        Required?                    false
        Position?                    3
        Default value                All commands in the session.
        Accept pipeline input?       false
        Accept wildcard characters?  true
        
    -CommandType 
        Exports only the specified types of command objects. Use "CommandType" 
        or its alias, "Type". 
        
        Valid values are:
        -- Alias: All Windows PowerShell aliases in the current session.
        -- All: All command types. It is the equivalent of "get-command *".
        -- Application: All files other than Windows PowerShell files in paths 
        listed in the Path environment variable ($env:path), including .txt, .e
        xe, and .dll files.
        -- Cmdlet: The cmdlets in the current session. "Cmdlet" is the default.
        -- ExternalScript: All .ps1 files in the paths listed in the Path envir
        onment variable ($env:path).
        -- Filter and Function: All Windows PowerShell functions.
        -- Script: Script blocks in the current session.
        
        Required?                    false
        Position?                    named
        Default value                All commands in the session.
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -Encoding 
        Specifies the encoding for the output files. Valid values are "Unicode"
        , "UTF7", "UTF8", "ASCII", "UTF32", "BigEndianUnicode", "Default", and 
        "OEM". The default is "UTF-8".
        
        Required?                    false
        Position?                    named
        Default value                UTF-8
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -Force []
        Overwrites one or more existing output files, even if the file has the 
        read-only attribute.
        
        Required?                    false
        Position?                    named
        Default value                False
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -FormatTypeName 
        Exports formatting instructions only for the specified Microsoft .NET F
        ramework types. Enter the type names. By default, Export-PSSession expo
        rts formatting instructions for all .NET Framework types that are not i
        n the System.Management.Automation namespace.
        
        The value of this parameter must be the name of a type that is returned
         by a Get-FormatData command in the session from which the commands are
         being imported. To get all of the formatting data in the remote sessio
        n, type *.
        
        If you use the FormatTypeName parameter, no commands are exported unles
        s you use the CommandName parameter.
        Similarly, if you use the CommandName parameter, the formatting files f
        or the commands are not exported unless you use the FormatTypeName para
        meter.
        
        Required?                    false
        Position?                    4
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -Module 
        Exports only the commands in the specified Windows PowerShell snap-ins 
        and modules. Enter the snap-in and module names. Wildcards are not perm
        itted.
        
        For more information, see about_PSSnapins and Import-Module.
        
        Required?                    false
        Position?                    named
        Default value                All commands in the session.
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -OutputModule 
        Specifies a path (optional) and name for the module that Export-PSSessi
        on creates. The default path is $home\Documents\WindowsPowerShell\Modul
        es. This parameter is required.
        
        If the module subdirectory or any of the files that Export-PSSession cr
        eates already exist, the command fails. To overwrite existing files, us
        e the Force parameter.
        
        Required?                    true
        Position?                    2
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -Session 
        Specifies the PSSession from which the commands are exported.  Enter a 
        variable that contains a session object or a command that gets a sessio
        n object, such as a Get-PSSession command. This parameter is required.
        
        Required?                    true
        Position?                    1
        Default value                None
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    
        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 Export-PSSession.
    
    
OUTPUTS
    System.IO.FileInfo
        Export-PSSession returns a list of files that comprise the module that 
        it created.
    
    
NOTES
    
    
        Export-PSSession relies on the Windows PowerShell remoting infrastructu
        re. To use this cmdlet, the computer must be configured for remoting. F
        or more information, see about_Remote_Requirements.
        
        You cannot use Export-PSSession to export a Windows PowerShell provider
        .
        
        Exported commands run implicitly in the PSSession from which they were 
        exported. However, the details of running the commands remotely are han
        dled entirely by Windows PowerShell. You can run the exported commands 
        just as you would run local commands.
        
        Export-Module captures and saves information about the PSSession in the
         module that it exports. If the PSSession from which the commands were 
        exported is closed when you import the module, and there are no active 
        PSSessions to the same computer, the commands in the module attempt to 
        re-create the PSSession. If attempts to re-create the PSSession fail, t
        he exported commands will not run. 
        
        The session information that Export-Module captures and saves in the mo
        dule does not include session options, such as those that you specify i
        n the $PSSessionOption automatic variable or by using the SessionOption
         parameters of  the New-PSSession, Enter-PSSession, or Invoke-Command c
        mdlet. If the original PSSession is closed when you import the module, 
        the module will use another PSSession to the same computer, if one is a
        vailable. To enable the imported commands to run in a correctly configu
        red session, create a PSSession with the options that you want before y
        ou import the module.
        
        To find the commands to export, Export-PSSession uses the Invoke-Comman
        d cmdlet to run a Get-Command command in the PSSession. To get and save
         formatting data for the commands, it uses the Get-FormatData and Expor
        t-FormatData cmdlets. You might see error messages from Invoke-Command,
         Get-Command, Get-FormatData, and Export-FormatData when you run an Exp
        ort-PSSession command. Also, Export-PSSession cannot export commands fr
        om a session that does not include the Get-Command, Get-FormatData, Sel
        ect-Object, and Get-Help cmdlets.
        
        Export-PSSession uses the Write-Progress cmdlet to display the progress
         of the command. You might see the progress bar while the command is ru
        nning.
        
        Exported commands have the same limitations as other remote commands, i
        ncluding the inability to start a program with a user interface, such a
        s Notepad.
        
        Because Windows PowerShell profiles are not run in PSSessions, the comm
        ands that a profile adds to a session are not available to Export-PSSes
        sion. To export commands from a profile, use an Invoke-Command command 
        to run the profile in the PSSession manually before exporting commands.
         
        
        The module that Export-PSSession creates might include a formatting fil
        e, even if the command does not import formatting data. If the command 
        does not import formatting data, any formatting files that are created 
        will not contain formatting data.
        
    
    -------------------------- EXAMPLE 1 --------------------------
    
    C:\PS>$s = new-pssession -computerName Server01
    
    C:\PS> export-pssession -session $s -outputModule Server01
    
    
    Description
    -----------
    The commands in this example export all commands from a PSSession on the Se
    rver01 computer to the Server01 module on the local computer except for com
    mands that have the same names as commands in the current session. It also 
    exports the formatting data for the commands.   
    
    The first command creates a PSSession on the Server01 computer. The second 
    command exports the commands and formatting data from the session into the 
    Server01 module.
    
    
    
    
    
    -------------------------- EXAMPLE 2 --------------------------
    
    C:\PS>$s = new-pssession -ConnectionUri http://exchange.microsoft.com/mailb
    ox -credential [email protected] -authentication negotiate
    
    C:\PS> export-pssession -session $r -module exch* -commandname get-*, set-*
     -formattypename * -outputModule $pshome\Modules\Exchange -encoding ASCII
    
    
    Description
    -----------
    These commands export the Get and Set commands from a Microsoft Exchange Se
    rver snap-in on a remote computer to an Exchange module in the $pshome\Modu
    les directory on the local computer.
    
    Placing the module in the $pshome\Module directory makes it accessible to a
    ll users of the computer.
    
    
    
    
    
    -------------------------- EXAMPLE 3 --------------------------
    
    C:\PS>$s = new-pssession -computerName Server01 -credential Server01\User01
    
    C:\PS> export-pssession -session $s -outputModule TestCmdlets -type cmdlet 
    -commandname *test* -formattypename *
    
    C:\PS> remove-pssession $s
    
    C:\PS> import-module TestCmdlets
    
    C:\PS> get-help test*
    
    C:\PS> test-files
    
    
    Description
    -----------
    These commands export cmdlets from a PSSession on a remote computer and sav
    e them in a module on the local computer. Then, the commands add the cmdlet
    s from the module to the current session so that they can be used.
    
    The first command creates a PSSession on the Server01 computer and saves it
     in the $s variable.
    
    The second command exports the cmdlets whose names begin with "Test" from t
    he PSSession in $s to the TestCmdlets module on the local computer.
    
    The third command uses the Remove-PSSession cmdlet to delete the PSSession 
    in $s from the current session. This command shows that the PSSession need 
    not be active to use the commands that were imported from it.
    
    The fourth command, which can be run in any session at any time, uses the I
    mport-Module cmdlet to add the cmdlets in the TestCmdlets module to the cur
    rent session.
    
    The fifth command uses the Get-Help cmdlet to get help for cmdlets whose na
    mes begin with "Test." After the commands in a module are added to the curr
    ent session, you can use the Get-Help and Get-Command cmdlets to learn abou
    t the imported commands, just as you would use them for any command in the 
    session.
    
    The sixth command uses the Test-Files cmdlet, which was exported from the S
    erver01 computer and added to the session. 
    
    Although it is not evident, the Test-Files command actually runs in a remot
    e session on the computer from which the command was imported. Windows Powe
    rShell creates a session from information that is stored in the module.
    
    
    
    
    
    -------------------------- EXAMPLE 4 --------------------------
    
    C:\PS>export-pssession -session $s -AllowClobber -outputModule AllCommands
    
    
    Description
    -----------
    This command exports all commands and all formatting data from the PSSessio
    n in the $s variable into the current session. The command uses the AllowCl
    obber parameter to include commands with the same names as commands in the 
    current session.
    
    
    
    
    
    -------------------------- EXAMPLE 5 --------------------------
    
    C:\PS>$options = New-PSSessionOption -NoMachineProfile
    
    C:\PS> $s = new-pssession -computername Server01 -sessionoption $options
    
    C:\PS> export-pssession -session $s -outputModule Server01
    
    C:\PS> remove-pssession $s
    
    C:\PS> new-pssession -computername Server01 -sessionoption $options
    
    C:\PS> import-module Server01
    
    
    Description
    -----------
    This example shows how to run the exported commands in a session with parti
    cular options when the PSSession from which the commands were exported is c
    losed.
    
    When you use Export-PSSession, it saves information about the original PSSe
    ssion in the module that it creates. When you import the module, if the ori
    ginal remote session is closed, the module will use any open remote session
     that connects to originating computer. 
    
    If the current session does not include a remote session to the originating
     computer, the commands in the module will re-establish a session to that c
    omputer. However, Export-PSSession does not save special options, such as t
    hose set by using the SessionOption parameter of New-PSSession, in the modu
    le. 
    
    Therefore, if you want to run the exported commands in a remote session wit
    h particular options, you need to create a remote session with the options 
    that you want before you import the module.
    
    The first command uses the New-PSSessionOption cmdlet to create a PSSession
    Option object, and it saves the object in the $options variable.
    
    The second command creates a PSSession that includes the specified options.
     The command uses the New-PSSession cmdlet to create a PSSession on the Ser
    ver01 computer. It uses the SessionOption parameter to submit the option ob
    ject in $options. 
    
    The third command uses the Export-PSSession cmdlet to export commands from 
    the PSSession in $s to the Server01 module.
    
    The fourth command uses the Remove-PSSession cmdlet to delete the PSSession
     in the $s variable.
    
    The fifth command uses the New-PSSession cmdlet to create a new PSSession t
    hat connects to the Server01 computer. This PSSession also uses the session
     options in the $options variable.
    
    The sixth command uses the Import-Module cmdlet to import the commands from
     the Server01 module. The commands in the module run in the PSSession on th
    e Server01 computer.
    
    
    
    
    
    
RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=135213
    about_Command_Precedence 
    Import-PSSession 
    New-PSSession 
    Import-Module 
    Invoke-Command 
    about_PSSessions 




NAME
    Export-Clixml
    
SYNOPSIS
    Creates an XML-based representation of an object or objects and stores it i
    n a file.
    
SYNTAX
    Export-Clixml [-Path]  -InputObject  [-Depth ] [-Enc
    oding ] [-Force] [-NoClobber] [-Confirm] [-WhatIf] []
    
    
DESCRIPTION
    The Export-Clixml cmdlet creates an XML-based representation of an object o
    r objects and stores it in a file. You can then use the Import-CLIXML cmdle
    t 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 t
    he resulting XML in a file. ConvertTo-XML returns the XML, so you can conti
    nue to process it in Windows PowerShell.
    

PARAMETERS
    -Depth 
        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.ps
        1xml files. For more information, see about_Types.ps1xml.
        
        Required?                    false
        Position?                    named
        Default value                2
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -Encoding 
        Specifies the type of encoding for the target file. Valid values are AS
        CII, UTF8, UTF7, UTF32, Unicode, BigEndianUnicode, Default, and OEM. UT
        F8 is the default.
        
        Required?                    false
        Position?                    named
        Default value                UTF8
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -Force []
        Causes the cmdlet to clear the read-only attribute of the output file i
        f 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 
        Specifies the object to be converted. Enter a variable that contains th
        e objects, or type a command or expression that gets the objects. You c
        an also pipe objects to Export-Clixml.
        
        Required?                    true
        Position?                    named
        Default value                
        Accept pipeline input?       true (ByValue)
        Accept wildcard characters?  false
        
    -NoClobber []
        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 
        Specifies the path to the file where the XML representation of the obje
        ct will be stored.
        
        Required?                    true
        Position?                    1
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -Confirm []
        Prompts you for confirmation before executing the command.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -WhatIf []
        Describes what would happen if you executed the command without actuall
        y executing the command.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    
        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 a
    n 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 descri
    ptor to Export-Clixml, which stores an XML-based representation of the obje
    ct in a file named FileACL.xml. 
    
    The second command uses the Import-Clixml cmdlet to create an object from t
    he XML in the FileACL.xml file. Then, it saves the object in the $FileAcl v
    ariable.
    
    
    
    
    
    
RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113297
    Import-Clixml 
    ConvertTo-XML 
    Export-Csv 
    ConvertTo-Html 

Copy and Try it