Category Archives: Get

Get-Transaction

NAME
    Get-Transaction

SYNOPSIS
    Gets the current (active) transaction.

SYNTAX
    Get-Transaction [<CommonParameters>]

DESCRIPTION
    The Get-Transaction cmdlet gets an object that represents the current transaction in the session.

    This cmdlet never returns more than one object, because only one transaction is active at a time. If you start one or more independent transactions (by using the Independent parameter of Start-Transaction), the most recently started transaction is active, and that is the transaction that Get-Transaction returns.

    When all active transactions have either been rolled back or committed, Get-Transaction shows the transaction that was most recently active in the session.

    The Get-Transaction cmdlet is one of a set of cmdlets that support the transactions feature in Windows PowerShell. For more information, see about_transactions.

PARAMETERS
    <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
    System.Management.Automation.PSTransaction
        Get-Transaction returns an object that represents the current transaction.

NOTES

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

    C:\PS>Start-Transaction

    C:\PS> Get-Transaction

    RollbackPreference SubscriberCount Status
    —————— ————— ——
    Error                1                 Active

    Description
    ———–
    This command uses the Get-Transaction cmdlet to get the current transaction.

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

    C:\PS>Get-Transaction | Get-Member

    Name             MemberType Definition
    —-             ———- ———-
    Dispose            Method     System.Void Dispose(), System.Void Dispose(Boolean disposing)
    Equals             Method     System.Boolean Equals(Object obj)
    GetHashCode        Method     System.Int32 GetHashCode()
    GetType            Method     System.Type GetType()
    ToString         Method     System.String ToString()
    IsCommitted        Property System.Boolean IsCommitted {get;}
    IsRolledBack     Property System.Boolean IsRolledBack {get;}
    RollbackPreference Property System.Management.Automation.RollbackSeverity RollbackPreference {get;}
    SubscriberCount    Property System.Int32 SubscriberCount {get;set;}

    Description
    ———–
    This command uses the Get-Member cmdlet to show the properties and methods of the transaction object.

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

    C:\PS>cd hklm:\software
    HKLM:\SOFTWARE> Start-Transaction
    HKLM:\SOFTWARE> New-Item MyCompany -UseTransaction
    HKLM:\SOFTWARE> Undo-Transaction
    HKLM:\SOFTWARE> Get-Transaction

    RollbackPreference SubscriberCount Status
    —————— ————— ———-
    Error                0                 RolledBack

    Description
    ———–
    This command shows the property values of a transaction object for a transaction that has been rolled back.

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

    C:\PS>cd hklm:\software
    HKLM:\SOFTWARE> Start-Transaction
    HKLM:\SOFTWARE> New-Item MyCompany -UseTransaction
    HKLM:\SOFTWARE> Complete-Transaction
    HKLM:\SOFTWARE> Get-Transaction

    RollbackPreference SubscriberCount Status
    —————— ————— ———
    Error                1                 Committed

    Description
    ———–
    This command shows the property values of a transaction object for a transaction that has been committed.

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

    C:\PS>cd hklm:\software
    HKLM:\SOFTWARE> Start-Transaction
    HKLM:\SOFTWARE> New-Item MyCompany -UseTransaction

    HKLM:\SOFTWARE> Start-Transaction
    HKLM:\SOFTWARE> New-Item MyCompany2 -UseTransaction

    HKLM:\SOFTWARE> Get-Transaction

    RollbackPreference SubscriberCount Status
    —————— ————— ——
    Error                2                 Active

    HKLM:\SOFTWARE> Complete-Transaction
    HKLM:\SOFTWARE> Get-Transaction

    RollbackPreference SubscriberCount Status
    —————— ————— ——
    Error                1                 Active

    HKLM:\SOFTWARE> Complete-Transaction
    HKLM:\SOFTWARE> Get-Transaction

    RollbackPreference SubscriberCount Status
    —————— ————— ———
    Error                1                 Committed

    Description
    ———–
    This example shows the effect on the transaction object of starting a transaction while another transaction is in progress. Typically, this happens when a script that runs a transaction includes a Function or calls a script that contains another complete transaction.

    Unless the second Start-Transaction command includes the Independent parameter, Start-Transaction does not create a new transaction. Instead, it adds a second subscriber to the original transaction.

    The first Start-Transaction command starts the transaction. A New-Item command with the UseTransaction parameter is part of the transaction.

    A second Start-Transaction command adds a subscriber to the transaction. The next New-Item command is also part of the transaction.

    The first Get-Transaction command shows the multi-subscriber transaction. Notice that the subscriber count is 2.

    The first Complete-Transaction command does not commit the transaction, but it reduces the subscriber count to 1.

    The second Complete-Transaction command commits the transaction.

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

    C:\PS>HKLM:\SOFTWARE> Start-Transaction

    HKLM:\SOFTWARE> Get-Transaction

    RollbackPreference SubscriberCount IsRolledBack IsCommitted
    —————— ————— ———— ———–
    Error                1                 False         False

    HKLM:\SOFTWARE> Start-Transaction -Independent
    HKLM:\SOFTWARE> Get-Transaction

    RollbackPreference SubscriberCount IsRolledBack IsCommitted
    —————— ————— ———— ———–
    Error                1                 False         False

    HKLM:\SOFTWARE> Complete-Transaction
    HKLM:\SOFTWARE> Get-Transaction

    HKLM:\SOFTWARE> Complete-Transaction
    HKLM:\SOFTWARE> Get-Transaction

    Description
    ———–
    This example shows the effect on the transaction object of starting an independent transaction while another transaction is in progress.

    The first Start-Transaction command starts the transaction. A New-Item command with the UseTransaction parameter is part of the transaction.

    A second Start-Transaction command adds a subscriber to the transaction. The next New-Item command is also part of the transaction.

    The first Get-Transaction command shows the multi-subscriber transaction. Note that the subscriber count is 2.

    The Complete-Transaction command reduces the subscriber count to 1, but it does not commit the transaction.

    The second Complete-Transaction command commits the transaction.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=135220
    about_transactions
    about_providers
    Start-Transaction
    Complete-Transaction
    Undo-Transaction
    Use-Transaction

Get-PSSessionConfiguration

NAME
    Get-PSSessionConfiguration

SYNOPSIS
    Gets the registered session configurations on the computer.

SYNTAX
    Get-PSSessionConfiguration [[-Name] <string[]>] [<CommonParameters>]

DESCRIPTION
    The Get-PSSessionConfiguration cmdlet gets the session configurations that have been registered on the local computer. This is an advanced cmdlet that is designed to be used by system administrators to manage customized session configurations for their users.

    To create and register a session configuration, use the Register-PSSessionConfiguration cmdlet.

PARAMETERS
    -Name <string[]>
        Gets only the session configurations with the specified name or name pattern. Enter one or more session configuration names. Wildcards are permitted.

        Required?                    false
        Position?                    1
        Default value                All session configurations on the local computer
        Accept pipeline input?     false
        Accept wildcard characters? true

    <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
    Microsoft.PowerShell.Commands.PSSessionConfigurationCommands#PSSessionConfiguration

NOTES

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

        To view the session configurations on the computer, you must be a member of the Administrators group on the computer.

        To run a Get-PSSessionConfiguration command on a remote computer, Credential Security Service Provider (CredSSP) authentication must be enabled in the client settings on the local computer (by using the Enable-WSManCredSSP cmdlet) and in the service settings on the remote computer, and you must use the CredSSP value of the Authentication parameter when establishing the remote session. Otherwise, access is denied.

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

    C:\PS>Get-PSSessionConfiguration

    Description
    ———–
    This command gets the session configurations on the computer.

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

    C:\PS>Get-PSSessionConfiguration -Name Microsoft*

    Name                     PSVersion StartupScript        Permission
    —-                     ——— ————-        ———-
    microsoft.powershell     2.0                             BUILTIN\Administrators AccessAll…
    microsoft.powershell32    2.0                             BUILTIN\Administrators AccessAll…

    Description
    ———–
    This command uses the Name parameter of Get-PSSessionConfiguration to get only the session configurations with names that begin with “Microsoft”.

    This command gets the two default session configurations that come with Windows PowerShell.

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

    C:\PS>Get-PSSessionConfiguration -Name microsoft.powershell | Get-Member

     TypeName: Microsoft.PowerShell.Commands.PSSessionConfigurationCommands#PSSessionConfiguration

    Name                 MemberType     Definition
    —-                 ———-     ———-
    Equals                 Method         bool Equals(System.Object obj)
    GetHashCode            Method         int GetHashCode()
    GetType                Method         type GetType()
    ToString             Method         string ToString()
    Capability             NoteProperty System.Object[] Capability=System.Object[]
    ExactMatch             NoteProperty System.String ExactMatch=False
    Filename             NoteProperty System.String Filename=%windir%\system32\pwrshplugin.dll
    lang                 NoteProperty System.String lang=en-US
    Name                 NoteProperty System.String Name=microsoft.powershell
    PSVersion             NoteProperty System.String PSVersion=2.0
    ResourceUri            NoteProperty System.String ResourceUri=http://schemas.microsoft.com/powershell/microsoft.powershell
    SDKVersion             NoteProperty System.String SDKVersion=1
    SecurityDescriptorSddl NoteProperty System.String SecurityDescriptorSddl=O:NSG:BAD:P(A;;GA;;;BA)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)
    SupportsOptions        NoteProperty System.String SupportsOptions=true
    Uri                    NoteProperty System.String Uri=http://schemas.microsoft.com/powershell/microsoft.powershell
    xmlns                 NoteProperty System.String xmlns=http://schemas.microsoft.com/wbem/wsman/1/config/PluginConfiguration
    XmlRenderingType     NoteProperty System.String XmlRenderingType=text
    Permission             ScriptProperty System.Object Permission {get=trap { continue; }…

    C:\PS> Get-PSSessionConfiguration -Name microsoft.powershell | Format-List -property *

    Name                 : microsoft.powershell
    Filename             : %windir%\system32\pwrshplugin.dll
    SDKVersion             : 1
    XmlRenderingType     : text
    lang                 : en-US
    PSVersion             : 2.0
    ResourceUri            : http://schemas.microsoft.com/powershell/microsoft.powershell
    SupportsOptions        : true
    Capability             : {Shell}
    Uri                    : http://schemas.microsoft.com/powershell/microsoft.powershell
    SecurityDescriptorSddl : O:NSG:BAD:P(A;;GA;;;BA)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)
    ExactMatch             : False
    xmlns                 : http://schemas.microsoft.com/wbem/wsman/1/config/PluginConfiguration
    Permission             : BUILTIN\Administrators AccessAllowed

    Description
    ———–
    These commands examine the PSSessionConfiguration object that Get-PSSessionConfiguration returns.

    The first command uses the Get-PSSessionConfiguration cmdlet to get the Microsoft.PowerShell default configuration.

    The second command uses a pipeline operator (|) to send the object that Get-PSSessionConfiguration returns to the Get-Member cmdlet. The output shows the properties and methods of the object.

    The third command sends the same object to the Format-List cmdlet. The Property parameter with a value of * (all) directs Format-List to display all of the properties and property values of the object in a list.

    The output of this command has very useful information, including the location of the .dll that implements the configuration type, the resource Uniform Resource Identifier (URI) for the endpoint that is created, and the Security Descriptor Definition Language (SDDL) for the configuration.

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

    C:\PS>dir WSMan:\localhost\plugin

     WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\Plugin

    Name                     Type                 Keys
    —-                     —-                 —-
    Event Forwarding Plugin Container            {Name=Event Forwarding Plugin}
    MaintenanceShell         Container            {Name=MaintenanceShell}
    microsoft.powershell     Container            {Name=microsoft.powershell}
    microsoft.powershell32    Container            {Name=microsoft.powershell32}
    WMI Provider             Container            {Name=WMI Provider}

    Description
    ———–
    This command uses the Get-ChildItem cmdlet (alias = dir) in the WSMan: provider drive to look at the content of the Plugin node.

    This is another way to look at the session configurations on the computer.

    The PlugIn node contains ContainerElement objects (Microsoft.WSMan.Management.WSManConfigContainerElement) that represent the registered Windows PowerShell session configurations, along with other plug-ins for WS-Management.

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

    C:\PS>Enable-WSManCredSSP -delegate server02

    C:\PS> Connect-WSMan server02

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

    C:\PS> Invoke-Command -scriptblock {Get-PSSessionConfiguration} -computername Server02 -authentication CredSSP -credential Domain01\Admin01

    Name                     PSVersion StartupScript        Permission                         PSComputerName
    —-                     ——— ————-        ———-                         ————–
    microsoft.powershell     2.0                             BUILTIN\Administrators AccessAll… server02.corp.fabrikam.com
    microsoft.powershell32    2.0                             BUILTIN\Administrators AccessAll… server02.corp.fabrikam.com
    MyX86Shell                2.0        c:\test\x86Shell.ps1 BUILTIN\Administrators AccessAll… server02.corp.fabrikam.com

    Description
    ———–
    This example shows how to run a Get-PSSessionConfiguration command on a remote computer. The command requires that CredSSP delegation be enabled in the client settings on the local computer and in the service settings on the remote computer. To run the commands in this example, you must be a member of the Administrators group on the local computer and the remote computer.

    The first command uses the Enable-WSManCredSSP cmdlet to enable CredSSP delegation from the Server01 local computer to the Server02 remote computer. This configures the CredSSP client setting on the local computer.

    The second command uses the Connect-WSMan cmdlet to connect to the Server02 computer. This action adds a node for the Server02 computer to the WSMan: drive on the local computer, allowing you to view and change the WS-Management settings on the Server02 computer.

    The third command uses the Set-Item cmdlet to change the value of the CredSSP item in the Service node of the Server02 computer to True. This configures the service settings on the remote computer.

    The fourth command uses the Invoke-Command cmdlet to run a Get-PSSessionConfiguration command on the Server02 computer. The command uses the Credential parameter, and it uses the Authentication parameter with a value of CredSSP.

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

    C:\PS>(Get-PSSessionConfiguration -Name CustomShell).resourceURI

    http://schemas.microsoft.com/powershell/microsoft.CustomShell

    Description
    ———–
    This command uses the Get-PSSessionConfiguration cmdlet to get the resource URI of a session configuration.

    This command is useful when setting the value of the $PSSessionConfigurationName preference Variable, which takes a resource URI.

    The $PSSessionConfiguationName Variable specifies the default configuration that is used when you create a session. This Variable is set on the local computer, but it specifies a configuration on the remote computer. For more information about the $PSSessionConfiguration Variable, see about_preference_variables.

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

Get-PSSnapin

NAME
    Get-PSSnapin

SYNOPSIS
    Gets the Windows PowerShell snap-ins on the computer.

SYNTAX
    Get-PSSnapin [[-Name] <string[]>] [-Registered] [<CommonParameters>]

DESCRIPTION
    The Get-PSSnapin cmdlet gets the Windows PowerShell snap-ins that have been added to the current session or that have been registered on the system. The snap-ins are listed in the order in which they are detected.

    Get-PSSnapin gets only registered snap-ins. To register a Windows PowerShell snap-in, use the InstallUtil tool included with the Microsoft .NET Framework 2.0. For more information, see “How to Register Cmdlets, Providers, and Host Applications” in the MSDN (Microsoft Developer Network) library at http://go.microsoft.com/fwlink/?LinkId=143619.

PARAMETERS
    -Name <string[]>
        Gets only the specified Windows PowerShell snap-ins. Enter the names of one or more Windows PowerShell snap-ins. Wildcards are permitted.

        The parameter name (“Name”) is optional.

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

    -Registered [<SwitchParameter>]
        Gets the Windows PowerShell snap-ins that have been registered on the system (even if they have not yet been added to the session).

        The snap-ins that are installed with Windows PowerShell do not appear in this list.

        Without this parameter, Get-PSSnapin gets the Windows PowerShell snap-ins that have been added to the session.

        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 Get-PSSnapin.

OUTPUTS
    System.Management.Automation.PSSnapInInfo
        Get-PSSnapin returns an object for each snap-in that it gets.

NOTES

        You can refer to Get-PSSnapin by its built-in Alias, “psnp”. For more information, see about_aliases.

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

    C:\PS>Get-PSSnapin

    Description
    ———–
    This command gets the Windows PowerShell snap-ins that are currently loaded in the session. This includes the snap-ins that are installed with Windows PowerShell and those that have been added to the session.

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

    C:\PS>Get-PSSnapin -Registered

    Description
    ———–
    This command gets the Windows PowerShell snap-ins that have been registered on the computer, including those that have already been added to the session. The output does not include snap-ins that are installed with Windows PowerShell or Windows PowerShell snap-in dynamic-link libraries (DLLs) that have not yet been registered on the system.

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

    C:\PS>Get-PSSnapin smp*

    Description
    ———–
    This command gets the Windows PowerShell snap-ins in the current session that have names that begin with “smp”.

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

Get-PSSession

NAME
    Get-PSSession

SYNOPSIS
    Gets the Windows PowerShell sessions (PSSessions) in the current session.

SYNTAX
    Get-PSSession [[-ComputerName] <string[]>] [<CommonParameters>]

    Get-PSSession [-Id] <Int32[]> [<CommonParameters>]

    Get-PSSession [-InstanceId <Guid[]>] [<CommonParameters>]

    Get-PSSession [-Name <string[]>] [<CommonParameters>]

DESCRIPTION
    The Get-PSSession cmdlet gets the Windows PowerShell sessions (PSSessions) that were created in the current session.

    Without parameters, Get-PSSession gets all of the PSSessions created in the current session. You can use the parameters of Get-PSSession to get the sessions that are connected to particular computers, or you can identify sessions by their names, IDs, or instance IDs.

    For more information about Windows PowerShell sessions, see about_pssessions.

PARAMETERS
    -ComputerName <string[]>
        Gets only the PSSessions that are connected to the specified computers. Wildcards are permitted.

        Type the NetBIOS name, an IP address, or a fully-qualified domain name of one or more computers. To specify the local computer, type the computer name, “localhost”, or a dot (.).

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

    -Id <Int32[]>
        Gets only the PSSessions with the specified IDs. Type one or more IDs (separated by commas), or use the range operator (..) to specify a range of IDs.

        An ID is an integer that uniquely identifies the PSSession in the current session. It is easier to remember and type than the InstanceId, but it is unique only within the current session. To find the ID of a PSSession, use Get-PSSession without parameters.

        Required?                    true
        Position?                    1
        Default value                All sessions in the shell
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -InstanceId <Guid[]>
        Gets only the PSSessions with the specified instance IDs.

        The instance ID is a GUID that uniquely identifies a PSSession on a local or remote computer. The InstanceID is unique, even when you have multiple sessions running in Windows PowerShell.

        The InstanceID is stored in the InstanceID property of the object that represents a PSSession. To find the InstanceID of the PSSessions in the current session, type “Get-PSSession | Format-Table Name, ComputerName, InstanceId”.

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

    -Name <string[]>
        Gets only the PSSessions with the specified friendly names. Wildcards are permitted.

        To find the names of the PSSessions in the current session, type “Get-PSSession” without parameters.

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

    <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.Management.Automation.Runspaces.PSSession
        Get-PSSession returns a PSSession object for each PSSession that it gets.

NOTES

        Get-PSSession gets the PSSessions that were created in the current session. It does not get the session that is created when you open Windows PowerShell, and it does not get PSSessions that were created in other sessions or on other computers, even if they connect to the local computer.

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

    C:\PS>Get-PSSession

    Description
    ———–
    This command gets all of the PSSessions that were created in the current session.

    It does not get PSSessions that were created in other sessions or on other computers, even if they connect to this computer.

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

    C:\PS>$s = Get-PSSession -ComputerName Server02

    Description
    ———–
    This command gets the PSSessions that are connected to the Server02 computer and saves them in the $p Variable.

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

    C:\PS>New-PSSession -ComputerName Server01, Server02, Server03

    C:\PS> $s1, $s2, $s3 = Get-PSSession

    Description
    ———–
    This example shows how to save the results of a Get-PSSession command in multiple Variables.

    The first command uses the New-PSSession cmdlet to create PSSessions on three remote computers.

    The second command uses a Get-PSSession cmdlet to get the three PSSessions. It then saves each of the PSSessions in a separate Variable.

    When Windows PowerShell assigns an array of objects to an array of Variables, it assigns the first object to the first Variable, the second object to the second Variable, and so on. If there are more objects than Variables, it assigns all remaining objects to the last Variable in the array. If there are more Variables than objects, the extra Variables are not used.

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

    C:\PS>Get-PSSession | Format-Table -property computername, InstanceID

    C:\PS> $s = Get-PSSession -InstanceID a786be29-a6bb-40da-80fb-782c67f7db0f

    C:\PS> Remove-PSSession -session $s

    Description
    ———–
    This example shows how to get a PSSession by using its instance ID, and then to delete the PSSession.

    The first command gets all of the PSSessions on the local computer. It sends the PSSessions to the Format-Table cmdlet, which displays the ComputerName and InstanceID properties of each PSSession.

    The second command uses the Get-PSSession cmdlet to get a particular PSSession and to save it in the $s Variable. The command uses the InstanceID parameter to identify the PSSession.

    The third command uses the Remove-PSSession cmdlet to delete the PSSession in the $s Variable.

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

    C:\PS>Get-PSSession -ComputerName Serv*

    Description
    ———–
    This command gets all the PSSessions that connect to computers that have computer names that begin with “Serv”.

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

    C:\PS>Get-PSSession -name Test*, Ux*

    Description
    ———–
    This command gets PSSessions that have names that begin with “Test” or “Ux”.

    ————————– EXAMPLE 7 ————————–

    C:\PS>Get-PSSession 2

    Description
    ———–
    This command gets the PSSession with ID 2.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=135219
    about_pssessions
    about_remote
    New-PSSession
    Remove-PSSession
    Enter-PSSession
    Exit-PSSession
    Invoke-Command

Get-PSProvider

NAME
    Get-PSProvider

SYNOPSIS
    Gets information about the specified Windows PowerShell provider.

SYNTAX
    Get-PSProvider [[-PSProvider] <string[]>] [<CommonParameters>]

DESCRIPTION
    The Get-PSProvider cmdlet gets the Windows PowerShell providers in the current session. You can get a particular drive or all drives in the session.

    Windows PowerShell providers let you access a variety of data stores as though they were file system drives. For information about Windows PowerShell providers, see about_providers.

PARAMETERS
    -PSProvider <string[]>
        Specifies the name or names of the Windows PowerShell providers about which to retrieve information.

        Required?                    false
        Position?                    1
        Default value
        Accept pipeline input?     true (ByPropertyName)
        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
    System.Management.Automation.ProviderInfo
        Get-PSProvider returns objects that represent the Windows PowerShell providers in the session.

NOTES

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

    C:\PS>Get-PSProvider

    Description
    ———–
    This command displays a list of all available Windows PowerShell providers.

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

    C:\PS>Get-PSProvider f*, r* | Format-List

    Description
    ———–
    This command displays a list of all Windows PowerShell providers with names that begin with the letter “f” or “r”.

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

    C:\PS>Get-PSProvider | Format-Table name, module, pssnapin -auto

    Name        Module     PSSnapIn
    —-        ——     ——–
    Test        TestModule
    WSMan                    Microsoft.WSMan.Management
    Alias                    Microsoft.PowerShell.Core
    Environment             Microsoft.PowerShell.Core
    FileSystem             Microsoft.PowerShell.Core
    Function                 Microsoft.PowerShell.Core
    Registry                 Microsoft.PowerShell.Core
    Variable                 Microsoft.PowerShell.Core
    Certificate             Microsoft.PowerShell.Security

    C:\PS> Get-PSProvider | where {$_.pssnapin -eq “Microsoft.PowerShell.Security”}

    Name            Capabilities     Drives
    —-            ————     ——
    Certificate     ShouldProcess     {cert}

    Description
    ———–
    These commands find the Windows PowerShell snap-ins or modules that added providers to your session. All Windows PowerShell elements, including providers, originate in a snap-in or in a module.

    These commands use the PSSnapin and Module properties of the ProviderInfo object that Get-PSProvider returns. The values of these properties contain the name of the snap-in or module that adds the provider.

    The first command gets all of the providers in the session and formats them in a table with the values of their Name, Module, and PSSnapin properties.

    The second command uses the Where-Object cmdlet to get the providers that come from the Microsoft.PowerShell.Security snap-in.

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

Get-PSBreakpoint

NAME
    Get-PSBreakpoint

SYNOPSIS
    Gets the breakpoints that are set in the current session.

SYNTAX
    Get-PSBreakpoint [[-Script] <string[]>] [<CommonParameters>]

    Get-PSBreakpoint -Command <string[]> [-Script <string[]>] [<CommonParameters>]

    Get-PSBreakpoint [-Id] <Int32[]> [<CommonParameters>]

    Get-PSBreakpoint [-Type] <BreakpointType[]> [-Script <string[]>] [<CommonParameters>]

    Get-PSBreakpoint -Variable <string[]> [-Script <string[]>] [<CommonParameters>]

DESCRIPTION
    The Get-PSBreakpoint cmdlet gets the breakpoints that are set in the current session. You can use the cmdlet parameters to get particular breakpoints.

    A breakpoint is a point in a command or script where execution stops temporarily so that you can examine the instructions. Get-PSBreakpoint is one of several cmdlets designed for debugging Windows PowerShell scripts and commands. For more information about the Windows PowerShell debugger, see about_debuggers.

PARAMETERS
    -Command <string[]>
        Gets command breakpoints that are set on the specified command names. Enter the command names, such as the name of a cmdlet or Function.

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

    -Id <Int32[]>
        Gets the breakpoints with the specified breakpoint IDs. Enter the IDs in a comma-separated list. You can also pipe breakpoint IDs to Get-PSBreakpoint.

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

    -Script <string[]>
        Gets only the breakpoints in the specified scripts. Enter the path (optional) and names of one or more script files. The default location is the current directory.

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

    -Type <BreakpointType[]>
        Gets only breakpoints of the specified types. Enter one or more types. Valid values are Line, Command, and Variable. You can also pipe breakpoint types to Get-PSBreakpoint.

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

    -Variable <string[]>
        Gets Variable breakpoints that are set on the specified Variable names. Enter the Variable names without dollar signs.

        Required?                    true
        Position?                    named
        Default value                All breakpoints
        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.Int32, Microsoft.PowerShell.Commands.BreakpointType
        You can pipe breakpoint IDs and breakpoint types to Get-PSBreakpoint.

OUTPUTS
    Breakpoint object (System.Management.Automation.LineBreakpoint, System.Management.Automation.VariableBreakpoint, System.Management.Automation.CommandBreakpoint)
        Get-PSBreakpoint returns objects that represent the breakpoints in the session.

NOTES

        You can use Get-PSBreakpoint or its Alias, “gbp”.

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

    C:\PS>Get-PSBreakpoint

    Description
    ———–
    This command gets all breakpoints set on all scripts and Functions in the current session.

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

    C:\PS>Get-PSBreakpoint -Id 2

    Function : Increment
    Action     :
    Enabled    : True
    HitCount : 0
    Id         : 2
    Script     : C:\ps-test\sample.ps1
    ScriptName : C:\ps-test\sample.ps1

    Description
    ———–
    This command gets the breakpoint with breakpoint ID 2.

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

    C:\PS>$b = Set-PSBreakpoint -Script sample.ps1 -function increment

    C:\PS> $b.Id | Get-PSBreakpoint

    Description
    ———–
    These commands show how to get a breakpoint by piping a breakpoint ID to Get-PSBreakpoint.

    The first command uses the Set-PSBreakpoint cmdlet to create a breakpoint on the Increment Function in the Sample.ps1 script. It saves the breakpoint object in the $b Variable.

    The second command uses the dot operator (.) to get the Id property of the breakpoint object in the $b Variable. It uses a pipeline operator (|) to send the ID to the Get-PSBreakpoint cmdlet.

    As a result, Get-PSBreakpoint gets the breakpoint with the specified ID.

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

    C:\PS>Get-PSBreakpoint -Script Sample.ps1, SupportScript.ps1

    Description
    ———–
    This command gets all of the breakpoints in the Sample.ps1 and SupportScript.ps1 files.

    This command does not get other breakpointS that might be set in other scripts or on Functions in the session.

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

    C:\PS>Get-PSBreakpoint -command Read-Host, Write-Host -Script Sample.ps1

    Description
    ———–
    This command gets all Command breakpoints that are set on Read-Host or Write-Host commands in the Sample.ps1 file.

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

    C:\PS>Get-PSBreakpoint -type Command -Script Sample.ps1

    Description
    ———–
    This command gets all Command breakpoints in the Sample.ps1 file.

    ————————– EXAMPLE 7 ————————–

    C:\PS>Get-PSBreakpoint -variable Index, Swap

    Description
    ———–
    This command gets breakpoints that are set on the $index and $swap Variables in the current session.

    ————————– EXAMPLE 8 ————————–

    C:\PS>Get-PSBreakpoint -type line, Variable -Script Sample.ps1

    Description
    ———–
    This command gets all line and Variable breakpoints in the Sample.ps1 script.

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

Get-PSCallStack

NAME
    Get-PSCallStack

SYNOPSIS
    Displays the current call stack.

SYNTAX
    Get-PSCallStack [<CommonParameters>]

DESCRIPTION
    The Get-PSCallStack cmdlet displays the current call stack.

    Although it is designed to be used with the Windows PowerShell debugger, you can use this cmdlet to display the call stack in a script or Function outside of the debugger.

    To run a Get-PSCallStack command while in the debugger, type “k” or “Get-PSCallStack“.

PARAMETERS
    <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
    System.Management.Automation.CallStackFrame
        Get-PSCallStack returns an object that represents the items in the call stack.

NOTES

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

    C:\PS>function my-alias {
     $p = $args[0]
     Get-Alias | where {$_.definition -like “*$p”} | ft definition, name -auto
    }

    PS C:\ps-test> Set-PSBreakpoint -command my-alias

    Command    : my-alias
    Action     :
    Enabled    : True
    HitCount : 0
    Id         : 0
    Script     : prompt

    PS C:\ps-test> my-alias Get-Content
    Entering debug mode. Use h or ? for help.

    Hit Command breakpoint on ‘prompt:my-alias’

    my-alias Get-Content

    [DBG]: PS C:\ps-test> s
    $p = $args[0]

    DEBUG: Stepped to ‘:    $p = $args[0]    ‘

    [DBG]: PS C:\ps-test> s
    Get-Alias | Where {$_.Definition -like “*$p*”} | ft Definition,

    [DBG]: PS C:\ps-test>Get-PSCallStack

    Name        CommandLineParameters         UnboundArguments             Location
    —-        ———————         —————-             ——–
    prompt     {}                            {}                            prompt
    my-alias    {}                            {Get-Content}                 prompt
    prompt     {}                            {}                            prompt

    [DBG]: PS C:\ps-test> o

    Definition Name
    ———- —-
    Get-Content gc
    Get-Content cat
    Get-Content type

    Description
    ———–
    This command uses the Get-PSCallStack cmdlet to display the call stack for My-Alias, a simple Function that gets the Aliases for a cmdlet name.

    The first command enters the Function at the Windows PowerShell prompt. The second command uses the Set-PSBreakpoint cmdlet to set a breakpoint on the My-Alias Function. The third command uses the My-Alias Function to get all of the Aliases in the current session for the Get-Content cmdlet.

    The debugger breaks in at the Function call. Two consecutive step-into (s) commands begin executing the Function line by line. Then, a Get-PSCallStack command is used to retrieve the call stack.

    The final command is a Step-Out command (o) that exits the debugger and continues executing the script to completion.

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

Get-PSDrive

NAME
    Get-PSDrive

SYNOPSIS
    Gets the Windows PowerShell drives in the current session.

SYNTAX
    Get-PSDrive [-LiteralName] <string[]> [-PSProvider <string[]>] [-Scope <string>] [-UseTransaction] [<CommonParameters>]

    Get-PSDrive [[-Name] <string[]>] [-PSProvider <string[]>] [-Scope <string>] [-UseTransaction] [<CommonParameters>]

DESCRIPTION
    The Get-PSDrive cmdlet gets the Windows PowerShell drives in the current session. You can get a particular drive or all drives in the console.

    Get-PSDrive gets the following drives:

    — Windows logical drives on the computer, including drives mapped to network shares.

    — Drives exposed by Windows PowerShell providers (such as the Certificate:, Function:, and Alias: drives) and the HKLM: and HKCU: drives that are exposed by the Windows PowerShell Registry provider.

    — Drives that you create by using New-PSDrive.

    Get-PSDrive does not get Windows mapped drives that are added or created after the Windows PowerShell console is opened.

PARAMETERS
    -LiteralName <string[]>
        Specifies the name of the Windows PowerShell drive.

        The value of LiteralName is used exactly as it is typed. No characters are interpreted as wildcards. If the name 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[]>
        Gets only the specified drives. Type the drive name or letter without a colon (:).

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

    -PSProvider <string[]>
        Gets only the drives supported by the specified Windows PowerShell provider. Type the name of a provider, such as FileSystem, Registry, or Certificate.

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

    -Scope <string>
        Gets only the Windows PowerShell drives in the specified scope. 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
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

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

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

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

INPUTS
    None
        You cannot pipe objects to Get-PSDrive.

OUTPUTS
    System.Management.Automation.PSDriveInfo
        Get-PSDrive returns objects that represent the Windows PowerShell drives in the session.

NOTES

        The Get-PSDrive 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>Get-PSDrive

    Name     Provider     Root
    —-     ——–     —-
    Alias     Alias
    C         FileSystem    C:\
    cert     Certificate \
    D         FileSystem    D:\
    Env        Environment
    Function Function
    HKCU     Registry     HKEY_CURRENT_USER
    HKLM     Registry     HKEY_LOCAL_MACHINE
    Variable Variable
    X         FileSystem    X:\

    Description
    ———–
    This command gets the Windows PowerShell drives in the current session.

    The output shows the hard drive (C:) and CD-ROM drive (D:) on the computer, the drives exposed by the Windows PowerShell providers (Alias:, Cert:, Env:, Function:, HKCU:, HKLM:, and Variable:), and a drive mapped to a network share (X:).

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

    C:\PS>Get-PSDrive d

    Name     Provider     Root
    —-     ——–     —-
    D         FileSystem    D:\

    Description
    ———–
    This command displays the D: drive on the computer. Note that the drive letter is not followed by a colon.

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

    C:\PS>Get-PSDrive -PSProvider FileSystem

    Name     Provider     Root
    —-     ——–     —-
    C         FileSystem    C:\
    D         FileSystem    D:\
    X         FileSystem    X:\
    Y         FileSystem    \\Server01\Public
    Z         FileSystem    C:\Windows\System32

    Description
    ———–
    This command displays all of the drives that are supported by the Windows PowerShell FileSystem provider. This includes fixed drives, logical partitions, mapped network drives, and drives that you create by using New-PSDrive that are mapped to the file system drives.

    This example shows that drives created by New-PSDrive have the name of the mapped location in the value of the Root property. Windows drives just have the root of the drive letter.

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

    C:\PS>if (!(Get-PSDrive X)) {
        New-PSDrive -Name X -PSProvider Registry -root HKLM:\Network
    }
    else { Write-Host “The X: drive is already in use.” }

    Description
    ———–
    This command checks to see whether the X drive is already in use as the Windows PowerShell drive name. If it is not, the command uses the New-PSDrive cmdlet to create a Windows PowerShell drive that is mapped to the HKLM:\Network Registry key.

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

    C:\PS>Get-PSDrive -provider FileSystem

    C:\PS> Get-PSDrive -provider FileSystem

    Name     Provider     Root
    —-     ——–     —-
    C         FileSystem    C:\
    D         FileSystem    D:\
    X         FileSystem    X:\
    Y         FileSystem    \\Server01\Public
    Z         FileSystem    C:\Windows\System32

    C:\PS> net use
    New connections will be remembered.

    Status     Local     Remote                    Network
    ——————————————————————————-
                 X:        \\Server01\Public         Microsoft Windows Network

    C:\PS> [System.IO.DriveInfo]::getdrives()

    Name             : C:\
    DriveType         : Fixed
    DriveFormat        : NTFS
    IsReady            : True
    AvailableFreeSpace : 39831498752
    TotalFreeSpace     : 39831498752
    TotalSize         : 79900368896
    RootDirectory     : C:\
    VolumeLabel        :
    Name             : D:\
    DriveType         : CDRom
    DriveFormat        :
    IsReady            : False
    AvailableFreeSpace :
    TotalFreeSpace     :
    TotalSize         :
    RootDirectory     : D:\
    VolumeLabel        :
    Name             : X:\
    DriveType         : Network
    DriveFormat        : NTFS
    IsReady            : True
    AvailableFreeSpace : 36340559872
    TotalFreeSpace     : 36340559872
    TotalSize         : 36413280256
    RootDirectory     : X:\
    VolumeLabel        : D_Drive

    C:\PS> Get-WmiObject win32_logicaldisk

    DeviceID     : C:
    DriveType    : 3
    ProviderName :
    FreeSpace    : 39831252992
    Size         : 79900368896
    VolumeName :
    DeviceID     : D:
    DriveType    : 5
    ProviderName :
    FreeSpace    :
    Size         :
    VolumeName :
    DeviceID     : X:
    DriveType    : 4
    ProviderName : \\server01\public
    FreeSpace    : 36340559872
    Size         : 36413280256
    VolumeName : D_Drive

    C:\PS> Get-WmiObject win32_networkconnection
    LocalName                     RemoteName
    ————–             ————
    x:                            \\server01\public

    Description
    ———–
    This example compares the types of file system drives that are displayed by Get-PSDrive to those displayed by using other methods. This example demonstrates different ways to display drives in Windows PowerShell, and it shows that the drives created by using New-PSDrive are accessible only in Windows PowerShell.

    The first command uses Get-PSDrive to get all of the file system drives in the Windows PowerShell console. This includes the fixed drives (C: and D:), the mapped network drive (X:), and two Windows PowerShell drives (Y: and Z:) that were created by using New-PSDrive.

    A “net use” command, which displays Windows mapped network drives, displays only the X drive. It does not display drives that are created by New-PSDrive. It shows that the X: drive is also mapped to \\Server01\Public.

    The third command uses the GetDrives method of the Microsoft .NET Framework System.IO.DriveInfo class. This command gets the Windows file system drives, including drive X:, but it does not get the drives created by New-PSDrive.

    The fourth command uses the Get-WmiObject cmdlet to display the instances of the Win32_LogicalDisk class. It returns the C:, D:, and X: drives, but not the drives created by New-PSDrive.

    The last command uses the Get-WmiObject cmdlet to display the instances of the Win32_NetworkConnection class. Like “net use”, it returns only the X: drive.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113327
    about_providers
    New-PSDrive
    Remove-PSDrive
    Get-Help
    Get-Command
    Get-Member

Get-Module

NAME
    Get-Module

SYNOPSIS
    Gets the modules that have been imported or that can be imported into the current session.

SYNTAX
    Get-Module [-All] [-ListAvailable] [-Name <string[]>] [<CommonParameters>]

    Get-Module [[-Name] <string[]>] [<CommonParameters>]

DESCRIPTION
    The Get-Module cmdlet gets the modules that have been imported, or that can be imported, into the session.

    Get-Module only gets modules; it does not import them. To import the modules into your session, use Import-Module.

PARAMETERS
    -All [<SwitchParameter>]
        Gets module objects for all module files.

        Without the All parameter, Get-Module gets only the module object for the default module file. The cmdlet selects file types in the following order: manifest (.psd1) files, script module (.psm1) files, and binary module (.dll) files.

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

    -ListAvailable [<SwitchParameter>]
        Gets all of the modules that can be imported into the session. Get-Module gets the modules in the paths specified by the $env:PSModulePath Environment Variable.

        Without this parameter, Get-Module gets only the modules that have been imported into the session.

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

    -Name <string[]>
        Gets only modules with the specified names or name patterns. Wildcards are permitted. You can also pipe the names to Get-Module.

        Required?                    false
        Position?                    1
        Default value                All imported or available modules.
        Accept pipeline input?     true (ByValue)
        Accept wildcard characters? true

    <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 module names to Get-Module.

OUTPUTS
    System.Management.Automation.PSModuleInfo
        Get-Module returns objects that represent the modules.

NOTES

        You can also refer to Get-Module by its Alias, “gmo”. For more information, see about_aliases.

        The All parameter returns module objects for all files with a .dll file name extension, even if they do not implement cmdlets or providers.

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

    C:\PS>Get-Module

    Description
    ———–
    This command gets the modules that have been imported into the current session.

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

    C:\PS>Get-Module -listAvailable

    Description
    ———–
    This command gets the modules that can be imported into the current session.

    Get-Module looks for available modules in the path specified by the $env:PSModulePath Environment Variable. For more information about PSModulePath, see about_modules and about_environment_variables.

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

    C:\PS>Get-Module -listAvailable -All

    Description
    ———–
    This command gets all of the exported files for all available modules.

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

    C:\PS>Get-Module | Get-Member -type property

     TypeName: System.Management.Automation.PSModuleInfo

    Name             MemberType Definition
    —-             ———- ———-
    AccessMode        Property System.Management.Automation.ModuleAcc
    Description     Property System.String Description {get;set;}
    ExportedAliases Property System.Collections.Generic.Dictionary`
    ExportedCmdlets Property System.Collections.Generic.Dictionary`
    ExportedFunctions Property System.Collections.Generic.Dictionary`
    ExportedVariables Property System.Collections.Generic.Dictionary`
    Guid             Property System.Guid Guid {get;}
    ModuleBase        Property System.String ModuleBase {get;}
    ModuleType        Property System.Management.Automation.ModuleTyp
    Name             Property System.String Name {get;}
    NestedModules     Property System.Collections.ObjectModel.ReadOnl
    OnRemove         Property System.Management.Automation.ScriptBlo
    Path             Property System.String Path {get;}
    PrivateData     Property System.Object PrivateData {get;set;}
    SessionState     Property System.Management.Automation.SessionSt
    Version         Property System.Version Version {get;}

    Description
    ———–
    This command get the properties of the PSModuleInfo object that Get-Module returns. There is one object for each module file.

    You can use the properties to format and filter the module objects. For more information about the properties, see “PSModule Properties” in the MSDN (Microsoft Developer Network) library at http://go.microsoft.com/fwlink/?LinkId=143624.

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

    C:\PS>Get-Module -listAvailable -All | Format-Table -property name, moduletype, path -groupby name -auto

     Name: MyTestCmdlets

    Name         ModuleType Path
    —-         ———- —-
    MyTestCmdlets     Script C:\Windows\system32\WindowsPowerShell\v1.0\Modules\TestCmdlets\TestCmdlets.dll

     Name: PSDiagnostics

    Name         ModuleType Path
    —-         ———- —-
    PSDiagnostics Manifest C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSDiagnostics\PSDiagnostics.psd1
    PSDiagnostics     Script C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSDiagnostics\PSDiagnostics.psm1

     Name: FileTransfer

    Name         ModuleType Path
    —-         ———- —-
    FileTransfer Manifest C:\Windows\system32\WindowsPowerShell\v1.0\Modules\FileTransfer\FileTransfer.psd1

    Description
    ———–
    This command gets all module files (imported and available) and groups them by module name. This lets you see the module files that each script is exporting.

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

    C:\PS>$m = Get-Module -list -Name FileTransfer | where {$_.moduletype -eq “Manifest”}

    C:\PS> Get-Content $m.path

    @{
    GUID=”{8FA5064B-8479-4c5c-86EA-0D311FE48875}”
    Author=”Microsoft Corporation”
    CompanyName=”Microsoft Corporation”
    Copyright=”© Microsoft Corporation. All rights reserved.”
    ModuleVersion=”1.0.0.0″
    Description=”Windows Powershell File Transfer Module”
    PowerShellVersion=”2.0″
    CLRVersion=”2.0″
    NestedModules=”Microsoft.BackgroundIntelligentTransfer.Management”
    FormatsToProcess=”FileTransfer.Format.ps1xml”
    RequiredAssemblies=Join-Path $psScriptRoot “Microsoft.BackgroundIntelligentTransfer.Management.Interop.dll”
    }

    Description
    ———–
    These commands display the contents of the module manifest for the Windows PowerShell File Transfer module.

    The first command gets the PSModuleInfo object that represent the module manifest for the File Transfer module. It saves the object in the $m Variable.

    The second command uses dot notation to get the path to the manifest file, which is stored in the Path property of the object. Then, it uses the Get-Content cmdlet to get the content of the manifest file in the specified path.

    Modules are not required to have manifest files. When they do have a manifest file, a manifest is required only to include a version number. However, manifest files often provide useful information about a module, its requirements, and its contents.

    ————————– EXAMPLE 7 ————————–

    C:\PS>Get-Module -listAvailable -Name FileTransfer | Format-List -property *

    Name             : FileTransfer
    Path             : C:\Windows\system32\WindowsPowerShell\v1.0\Modules\FileTransfer\FileTransfer.psd1
    Description     : Powershell File Transfer Module
    Guid             : 8fa5064b-8479-4c5c-86ea-0d311fe48875
    ModuleBase        : C:\Windows\system32\WindowsPowerShell\v1.0\Modules\FileTransfer
    PrivateData     :
    Version         : 1.0.0.0
    ModuleType        : Manifest
    AccessMode        : ReadWrite
    ExportedFunctions : {}
    ExportedCmdlets : {}
    NestedModules     : {}
    ExportedVariables : {}
    ExportedAliases : {}
    SessionState     : System.Management.Automation.SessionState
    OnRemove         :

    Description
    ———–
    This command displays all of the properties of the FileTransfer module in a list.

    Because the module has not yet been imported into the session, the Exported* properties and the NestedModules property are not yet populated. These properties are populated only after the elements have been exported and the nested modules have been instantiated.

    ————————– EXAMPLE 8 ————————–

    C:\PS>dir (Get-Module -listavailable FileTransfer).modulebase

        Directory: C:\Windows\system32\WindowsPowerShell\v1.0\Modules\FileTransfer

    Mode                LastWriteTime     Length Name
    —-                ————-     —— —-
    d—-        12/16/2008 12:36 PM            en-US
    -a—        11/19/2008 11:30 PM     16184 FileTransfer.Format.ps1xml
    -a—        11/20/2008 11:30 PM     1044 FileTransfer.psd1
    -a—        12/16/2008 12:20 AM     108544 Microsoft.BackgroundIntelligentTransfer.Management.Interop.dll

    Description
    ———–
    This command lists the files in the module’s directory. This is another way to determine what is in a module before you import it. Some modules might have help files or ReadMe files that describe the module.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=141552
    Import-Module
    New-Module
    Remove-Module
    about_modules

Get-PfxCertificate

NAME
    Get-PfxCertificate

SYNOPSIS
    Gets information about .pfx Certificate files on the computer.

SYNTAX
    Get-PfxCertificate [-FilePath] <string[]> [<CommonParameters>]

DESCRIPTION
    The Get-PfxCertificate cmdlet gets an object representing each specified .pfx Certificate file. A .pfx file includes both the Certificate and a private key.

PARAMETERS
    -FilePath <string[]>
        The full path to the .pfx file of the secured file. The parameter name (“FilePath”) is optional.

        Required?                    true
        Position?                    1
        Default value
        Accept pipeline input?     true (ByValue, ByPropertyName)
        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 file path to Get-PfxCertificate.

OUTPUTS
    System.Security.Cryptography.X509Certificates
        Get-PfxCertificate returns an object for each Certificate that it gets.

NOTES

        When using the Invoke-Command cmdlet to run a Get-PfxCertificate command remotely, and the .pfx Certificate file is not password protected, the value of the Authentication parameter of Invoke-Command must be “CredSSP”.

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

    C:\PS>Get-PfxCertificate -FilePath C:\windows\system32\Test.pfx

    Password: ******
    Signer Certificate:     Matt Berg (Self Certificate)
    Time Certificate:
    Time Stamp:
    Path:                    C:\windows\system32\zap.pfx

    Description
    ———–
    This command gets information about the Test.pfx Certificate on the system.

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

    C:\PS>Invoke-Command -computername Server01 -scriptblock {Get-PfxCertificate -FilePath C:\Text\TestNoPassword.pfx} -authentication CredSSP

    Description
    ———–
    This command gets a .pfx Certificate file from the Server01 remote computer. It uses the Invoke-Command to run a Get-PfxCertificate command remotely.

    When the .pfx Certificate file is not password-protected, the value of the Authentication parameter of Invoke-Command must be “CredSSP”.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113323
    Get-AuthenticodeSignature
    Set-AuthenticodeSignature
    about_Signing