Tag Archives: WarningVariable

Out-Null

NAME
    Out-Null

SYNOPSIS
    Deletes output instead of sending it to the console.

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

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

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

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

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

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

OUTPUTS
    None
        Out-Null does not generate any output.

NOTES

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

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

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

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

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

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

Out-Printer

NAME
    Out-Printer

SYNOPSIS
    Sends output to a printer.

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

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

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

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

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

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

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

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

OUTPUTS
    None
        Out-Printer does not return any objects.

NOTES

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Out-String

NAME
    Out-String

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

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

DESCRIPTION
    The Out-String cmdlet converts the objects that Windows PowerShell manages into an array of strings. By default, Out-String accumulates the strings and returns them as a single string, but you can use the stream parameter to direct Out-String to return one string at a time. This cmdlet lets you search and manipulate string output as you would in traditional shells when object manipulation is less convenient.

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

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

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

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

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

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

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

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

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

NOTES

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

New-PSDrive

NAME
    New-PSDrive

SYNOPSIS
    Creates a Windows PowerShell drive in the current session.

SYNTAX
    New-PSDrive [-Name] <string> [-PSProvider] <string> [-Root] <string> [-Credential <PSCredential>] [-Description <string>] [-Scope <string>] [-Confirm] [-WhatIf] [-UseTransaction] [<CommonParameters>]

DESCRIPTION
    The New-PSDrive cmdlet creates a Windows PowerShell drive that is “mapped” to or associated with a location in a data store, such as a network drive, a directory on the local computer, or a Registry key.

    You can use the Windows PowerShell drives that you create to access data in the associated data store, just like you would do with any mapped drive. You can change locations into the drive (using “Set-Location“, “cd”, or “chdir”) and access the contents of the drive (using “Get-Item“, “Get-ChildItem“, or “dir”).

    However, the Windows PowerShell drives are known only to Windows PowerShell. You cannot access them by using Windows Explorer, Windows Management Instrumentation (WMI), Component Object Model (COM), or the Microsoft .NET Framework, or by using tools such as Net Use.

     Windows PowerShell drives exist only in the current Windows PowerShell session. To make the drive persistent, you can export the session to which you have added the drive, or you can save a New-PSDrive command in your Windows PowerShell profile.

    To delete a drive that was created by New-PSDrive, use the Remove-PSDrive cmdlet.

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

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

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

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

    -Description <string>
        Specifies a brief text description of the drive. Type any string.

        To see the descriptions of all of the Windows PowerShell drives on your system, type “Get-PSDrive | format name, description”. To see the description of a particular Windows PowerShell drives, type “(Get-PSDrive <DriveName>).description”.

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

    -Name <string>
        Specifies a name for the new drive. You can use any valid string for the name. You are not limited to drive letters. Windows PowerShell drives names are case-sensitive.

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

    -PSProvider <string>
        Specifies the Windows PowerShell provider that supports drives of this type.

        For example, if the Windows PowerShell drives is associated with a network share or file system directory, the Windows PowerShell provider is “FileSystem”. If the Windows PowerShell drive is associated with a Registry key, the provider is “Registry”.

        To see a list of the providers in your Windows PowerShell session, type “Get-PSProvider“.

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

    -Root <string>
        Specifies the data store location that the Windows PowerShell drive is mapped to.

        For example, specify a network share (such as \\Server01\Public), a local directory (such as C:\Program Files), or a Registry key (such as HKLM:\Software\Microsoft).

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

    -Scope <string>
        Specifies a scope for the drive. 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

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

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

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

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

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

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

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

INPUTS
    None
        You cannot pipe input to this cmdlet.

OUTPUTS
    System.Management.Automation.PSDriveInfo

NOTES

        The New-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>New-PSDrive -Name P -PSProvider FileSystem -Root \\Server01\Public

    Name     Provider     Root
    —-     ——–     —-
    P         FileSystem    \\Server01\Public

    Description
    ———–
    This command creates a Windows PowerShell drive that Functions like a mapped network drive in Windows. The command creates a Windows PowerShell drive named P: that is mapped to the \\Server01\Public network share.

    It uses the Name parameter to specify a name for the drive, the PSProvider parameter to specify the Windows PowerShell FileSystem provider, and the Root parameter to specify the network share.

    When the command completes, the contents of the \\Server01\Public share appear in the P: drive. To see them, type: “dir p:”.

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

    C:\PS>New-PSDrive -Name MyDocs -PSProvider FileSystem -Root “C:\Documents and Settings\User01\My Documents” -Description “Maps to my My Documents folder.”

    Name     Provider     Root
    —-     ——–     —-
    MyDocs     FileSystem    C:\Documents and Settings\User01\My Documents

    Description
    ———–
    This command creates a Windows PowerShell drive that provides quick access to a local directory. It creates a drive named MyDocs: that is mapped to the
    “C:\Documents and Settings\User01\My Documents” directory on the local computer.

    It uses the Name parameter to specify a name for the drive, the PSProvider parameter to specify the Windows PowerShell FileSystem provider, the Root parameter to specify the path to the My Documents folder, and the Description parameter to create a description of the drive.

    When the command completes, the contents of the My Documents folder appear in the MyDocs: drive. To see them, type: “dir mydocs:”.

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

    C:\PS>New-PSDrive -Name MyCompany -PSProvider Registry -Root HKLM:\Software\MyCompany

    Name     Provider     Root
    —-     ——–     —-
    MyCompany Registry     HKEY_LOCAL_MACHINE\Software\MyCo…

    Description
    ———–
    This command creates a Windows PowerShell drive that provides quick access to a frequently checked Registry key. It creates a drive named MyCompany that is mapped to the HKLM\Software\MyCompany Registry key.

    It uses the Name parameter to specify a name for the drive, the PSProvider parameter to specify the Windows PowerShell Registry provider, and the Root parameter to specify the Registry key.

    When the command completes, the contents of the MyCompany key appear in the MyCompany: drive. To see them, type: “dir MyCompany:”.

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

    C:\PS>New-PSDrive -Name PsDrive -PSProvider FileSystem -Root \\Server01\Public

    C:\PS> $drive = New-Object -com wscript.network
    C:\PS> $drive.MapNetworkDrive(“X:”, “\\Server01\Public”)

    C PS:\> Get-PSDrive public, x

    Name     Provider     Root
    —-     ——–     —-
    PsDrive    FileSystem    \\Server01\public
    X         FileSystem    X:\

    C:\PS>Get-PSDrive psdrive, x | Get-Member

     TypeName: System.Management.Automation.PSDriveInfo
    Name                MemberType Definition
    —-                ———- ———-
    CompareTo         Method     System.Int32 CompareTo(PSDriveInfo drive),
    Equals             Method     System.Boolean Equals(Object obj),
    GetHashCode         Method     System.Int32 GetHashCode()
    …

    C:\PS> net use
    Status     Local     Remote                    Network
    —————————————————————————
                 X:        \\server01\public         Microsoft Windows Network

    C:\PS> Get-WmiObject win32_logicaldisk | ft deviceid
    deviceid
    ——–
    C:
    D:
    X:

    C:\PS> Get-WmiObject win32_networkconnection
    LocalName                     RemoteName                    ConnectionState             Status
    ———                     ———-                    —————             ——
    X:                            \\products\public             Disconnected                 Unavailable

    Description
    ———–
    This example shows the difference between a Windows drive that is mapped to a network share and a Windows PowerShell drive that is mapped to the same network share.

    The first command uses the New-PSDrive cmdlet to create a Windows PowerShell drive called PSDrive: that is mapped to the \\Server01\Public network share.

    The second set of commands uses the New-Object cmdlet to create a Wscript.Network COM object and then use its MapNetworkDrive method to map the \\Server01\Public network share to the X: drive on the local computer.

    Now, you can examine the two drives. Using a Get-PSDrive drive command, the drives appear to be the same, although the network share name appears only in the root of the PSDrive: drive.

    Sending the drive objects to Get-Member shows that they have the same object type, System.Management.Automation.PSDriveInfo.

    However, a “net use” command, a Get-WmiObject command to the Win32_LogicalDisk class, and a Get-WmiObject command to the Win32_NetworkConnection class find only the X: drive that was created by using the Wscript.Network object. That is because Windows PowerShell drives are known only to Windows PowerShell.

    If you close the Windows PowerShell session and then open a new one, the PSDrive: drive is gone, and the X: drive persists.

    Therefore, when deciding which method to use to map network drives, consider how you will use the drive, whether it needs to be persistant, and whether the drive needs to be visible to other Windows features.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113357
    about_providers
    Get-PSDrive
    Remove-PSDrive

New-PSSession

NAME
    New-PSSession

SYNOPSIS
    Creates a persistent connection to a local or remote computer.

SYNTAX
    New-PSSession [[-ComputerName] <string[]>] [-ApplicationName <string>] [-Authentication {Default | Basic | Negotiate | NegotiateWithImplicitCredential | Credssp | Digest | Kerberos}] [-CertificateThumbprint <string>] [-ConfigurationName <string>] [-Credential <PSCredential>] [-Name <string[]>] [-Port <int>] [-SessionOption <PSSessionOption>] [-UseSSL] [-ThrottleLimit <int>] [<CommonParameters>]

    New-PSSession [[-Session] <PSSession[]>] [-Name <string[]>] [-ThrottleLimit <int>] [<CommonParameters>]

    New-PSSession [-ConnectionURI] <Uri[]> [-AllowRedirection] [-Authentication {Default | Basic | Negotiate | NegotiateWithImplicitCredential | Credssp | Digest | Kerberos}] [-CertificateThumbprint <string>] [-ConfigurationName <string>] [-Credential <PSCredential>] [-Name <string[]>] [-SessionOption <PSSessionOption>] [-ThrottleLimit <int>] [<CommonParameters>]

DESCRIPTION
    The New-PSSession cmdlet creates a Windows PowerShell session (PSSession) on a local or remote computer. When you create a PSSession, Windows PowerShell establishes a persistent connection to the remote computer.

    Use a PSSession to run multiple commands that share data, such as a Function or the value of a Variable. To run commands in a PSSession, use the Invoke-Command cmdlet. To use the PSSession to interact directly with a remote computer, use the Enter-PSSession cmdlet. For more information, see about_pssessions.

    You can run commands on a remote computer without creating a PSSession by using the ComputerName parameters of Enter-PSSession or Invoke-Command. When you use the ComputerName parameter, Windows PowerShell creates a temporary connection that is used for the interactive session or for a single command and is then closed.

PARAMETERS
    -AllowRedirection [<SwitchParameter>]
        Allows redirection of this connection to an alternate Uniform Resource Identifier (URI).

        When you use the ConnectionURI parameter, the remote destination can return an instruction to redirect to a different URI. By default, Windows PowerShell does not redirect connections, but you can use the AllowRedirection parameter to allow it to redirect the connection.

        You can also limit the number of times that the connection is redirected by setting the MaximumConnectionRedirectionCount property of the $PSSessionOption preference Variable, or the MaximumConnectionRedirectionCount property of the value of the SessionOption parameter.
        The default value is 5. For more information, see the description of the SessionOption parameter, and see New-PSSessionOption.

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

    -ApplicationName <string>
        Specifies the application name segment of the connection URI. Use this parameter to specify the application name when you are not using the ConnectionURI parameter in the command.

        The default value is the value of the $PSSessionApplicationName preference Variable on the local computer. If this preference Variable is not defined, the default value is “WSMAN”. This value is appropriate for most uses. For more information, see about_preference_variables.

        The WinRM service uses the application name to select a listener to service the connection request. The value of this parameter should match the value of the URLPrefix property of a listener on the remote computer.

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

    -Authentication <AuthenticationMechanism>
        Specifies the mechanism that is used to authenticate the user’s credentials. Valid values are “Default”, “Basic”, “Credssp”, “Digest”, “Kerberos”, “Negotiate”, and “NegotiateWithImplicitCredential”. The default value is “Default”.

        CredSSP authentication is available only in Windows Vista, Windows Server 2008, and later versions of Windows.

        For more information about the values of this parameter, see the description of the System.Management.Automation.Runspaces.AuthenticationMechanism enumeration in the MSDN (Microsoft Developer Network) library at http://go.microsoft.com/fwlink/?LinkID=144382.

        Caution: Credential Security Service Provider (CredSSP) authentication, in which the user’s credentials are passed to a remote computer to be authenticated, is designed for commands that require authentication on more than one resource, such as accessing a remote network share. This mechanism increases the security risk of the remote operation. If the remote computer is compromised, the credentials that are passed to it can be used to control the network session.

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

    -CertificateThumbprint <string>
        Specifies the digital public key Certificate (X509) of a user account that has permission to perform this action. Enter the Certificate thumbprint of the Certificate.

        Certificates are used in client Certificate-based authentication. They can be mapped only to local user accounts; they do not work with domain accounts.

        To get a Certificate thumbprint, use the Get-Item or Get-ChildItem command in the Windows PowerShell Cert: drive.

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

    -ComputerName <string[]>
        Creates a persistent connection (PSSession) to the specified computer. If you enter multiple computer names, New-PSSession creates multiple PSSessions, one for each computer. The default is the local computer.

        Type the NetBIOS name, an IP address, or a fully qualified domain name of one or more remote computers. To specify the local computer, type the computer name, “localhost”, or a dot (.). When the computer is in a different domain than the user, the fully qualified domain name is required. You can also pipe a computer name (in quotes) to New-PSSession.

        To use an IP address in the value of the ComputerName parameter, the command must include the Credential parameter. Also, the computer must be configured for HTTPS transport or the IP address of the remote computer must be included in the WinRM TrustedHosts list on the local computer. For instructions for adding a computer name to the TrustedHosts list, see “How to Add a Computer to the Trusted Host List” in about_remote_TroubleShooting.

        Note: In Windows Vista and later versions of Windows, to include the local computer in the value of the ComputerName parameter, you must start Windows PowerShell with the “Run as administrator” option.

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

    -ConfigurationName <string>
        Specifies the session configuration that is used for the new PSSession.

        Enter a configuration name or the fully qualified resource Uniform Resource Identifier (URI) for a session configuration. If you specify only the configuration name, the following schema URI is prepended: http://schemas.microsoft.com/powershell.

        The session configuration for a session is located on the remote computer. If the specified session configuration does not exist on the remote computer, the command fails.

        The default value is the value of the $PSSessionConfigurationName preference Variable on the local computer. If this preference Variable is not set, the default is Microsoft.PowerShell. For more information, see about_preference_variables.

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

    -ConnectionURI <Uri[]>
        Specifies a Uniform Resource Identifier (URI) that defines the connection endpoint. The URI must be fully qualified.

        The format of this string is as follows:
            <Transport>://<ComputerName>:<Port>/<ApplicationName>

        The default value is as follows:
            http://localhost:80/WSMAN

        Valid values for the Transport segment of the URI are HTTP and HTTPS. If you do not specify a ConnectionURI, you can use the UseSSL, ComputerName, Port, and ApplicationName parameters to specify the URI values.

        If the destination computer redirects the connection to a different URI, Windows PowerShell prevents the redirection unless you use the AllowRedirection parameter in the command.

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

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

        Type a user name, such as “User01”, “Domain01\User01”, or “User@Domain.com”, or enter a PSCredential object, such as one returned by the Get-Credential cmdlet.

        When you type a user name, you will be prompted for a password.

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

    -Name <string[]>
        Specifies a friendly name for the PSSession.

        You can use the name to refer to the PSSession when using other cmdlets, such as Get-PSSession and Enter-PSSession. The name is not required to be unique to the computer or the current session.

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

    -Port <int>
        Specifies the network port on the remote computer that is used for this command. The default is port 80 (the HTTP port).

        Before using an alternate port, you must configure the WinRM listener on the remote computer to listen at that port. Use the following commands to configure the listener:

        1. winrm delete winrm/config/listener?Address=*+Transport=HTTP
        2. winrm create winrm/config/listener?Address=*+Transport=HTTP @{Port="<port-number>"}

        Do not use the Port parameter unless you must. The port setting in the command applies to all computers and sessions in which the command runs. An alternate port setting might prevent the command from running on all computers.

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

    -Session <PSSession[]>
        Uses the specified PSSession as a model for the new PSSession. This parameter creates new PSSessions with the same properties as the specified PSSessions.

        Enter a Variable that contains the PSSessions or a command that creates or gets the PSSessions, such as a New-PSSession or Get-PSSession command.

        The resulting PSSessions have the same computer name, application name, connection URI, port, configuration name, throttle limit, and Secure Sockets Layer (SSL) value as the originals, but they have a different display name, ID, and instance ID (GUID).

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

    -SessionOption <PSSessionOption>
        Sets advanced options for the session. Enter a SessionOption object that you create by using the New-PSSessionOption cmdlet.

        The default values for the options are determined by the value of the $PSSessionOption preference Variable, if it is set. Otherwise, the session uses the system defaults.

        For a description of the session options, including the default values, see New-PSSessionOption. For information about the $PSSessionOption preference Variable, see about_preference_variables.

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

    -ThrottleLimit <int>
        Specifies the maximum number of concurrent connections that can be established to run this command. If you omit this parameter or enter a value of 0 (zero), the default value, 32, is used.

        The throttle limit applies only to the current command, not to the session or to the computer.

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

    -UseSSL [<SwitchParameter>]
        Uses the Secure Sockets Layer (SSL) protocol to establish a connection to the remote computer. By default, SSL is not used.

        WS-Management encrypts all Windows PowerShell content transmitted over the network. UseSSL is an additional protection that sends the data across an HTTPS connection instead of an HTTP connection.

        If you use this parameter, but SSL is not available on the port used for the command, the command fails.

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

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

INPUTS
    System.String, System.URI, System.Management.Automation.Runspaces.PSSession
        You can pipe a ComputerName (string), ConnectionURI (URI), or Session (PSSession) object to New-PSSession.

OUTPUTS
    System.Management.Automation.Runspaces.PSSession

NOTES

        This cmdlet uses the Windows PowerShell remoting infrastructure. To use this cmdlet, the local computer and any remote computers must be configured for Windows PowerShell remoting. For more information, see about_remote_requirements.

        In Windows Vista and later versions of Windows, to create a PSSession on the local computer, you must start Windows PowerShell with the “Run as administrator” option.

        When you are finished with the PSSession, use the Remove-PSSession cmdlet to delete the PSSession and release its resources.

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

    C:\PS>$s = New-PSSession

    Description
    ———–
    This command creates a new PSSession on the local computer and saves the PSSession in the $s Variable.

    You can now use this PSSession to run commands on the local computer.

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

    C:\PS>$Server01 = New-PSSession -ComputerName Server01

    Description
    ———–
    This command creates a new PSSession on the Server01 computer and saves it in the $Server01 Variable.

    When creating multiple PSSessions, assign them to Variables with useful names. This will help you manage the PSSessions in subsequent commands.

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

    C:\PS>$s1, $s2, $s3 = new-session -ComputerName server1,server2,server3

    Description
    ———–
    This command creates three new PSSessions, one on each of the computers specified by the ComputerName parameter.

    The command uses the assignment operator (=) to assign the new PSSessions to an array of Variables: $s1, $s2, $s3. It assigns the Server01 PSSession to $s1, the Server02 PSSession to $s2, and the Server03 PSSession to $s3.

    When you assign multiple objects to an array of Variables, Windows PowerShell assigns each object to a Variable in the array respectively. If there are more objects than Variables, all remaining objects are assigned to the last Variable. If there are more Variables than objects, the remaining Variables are empty (null).

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

    C:\PS>New-PSSession -ComputerName Server01 -Port 8081 -UseSSL -ConfigurationName E12

    Description
    ———–
    This command creates a new PSSession on the Server01 computer that connects to server port 8081 and uses the SSL protocol. The new PSSession uses an alternate session configuration called “E12”.

    Before setting the port, you must configure the WinRM listener on the remote computer to listen on port 8081. For more information, see the description of the Port parameter.

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

    C:\PS>New-PSSession -session $s -Credential domain01\user01

    Description
    ———–
    This command creates a new PSSession with the same properties as an existing PSSession. You can use this command format when the resources of an existing PSSession are exhausted and a new PSSession is needed to offload some of the demand.

    The command uses the Session parameter of New-PSSession to specify the PSSession saved in the $s Variable. It uses the credentials of the Domain1\Admin01 user to complete the command.

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

    C:\PS>$global:s = New-PSSession -ComputerName server1.domain44.corpnet.fabrikam.com -Credential domain01\admin01

    Description
    ———–
    This example shows how to create a PSSession with a global scope on a computer in a different domain.

    By default, PSSessions created at the command line are created with local scope and PSSessions created in a script have script scope.

    To create a PSSession with global scope, create a new PSSession and then store the PSSession in a Variable that is cast to a global scope. In this case, the $s Variable is cast to a global scope.

    The command uses the ComputerName parameter to specify the remote computer. Because the computer is in a different domain than the user account, the full name of the computer is specified along with the credentials of the user.

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

    C:\PS>$rs = Get-Content c:\test\servers.txt | New-PSSession -ThrottleLimit 50

    Description
    ———–
    This command creates a PSSession on each of the 200 computers listed in the Servers.txt file and it stores the resulting PSSession in the $rs Variable. The PSSessions have a throttle limit of 50.

    You can use this command format when the names of computers are stored in a database, spreadsheet, text file, or other text-convertible format.

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

    C:\PS>$s = New-PSSession -URI http://Server01:91/NewSession -Credential domain01\user01

    Description
    ———–
    This command creates a PSSession on the Server01 computer and stores it in the $s Variable. It uses the URI parameter to specify the transport protocol, the remote computer, the port, and an alternate session configuration. It also uses the Credential parameter to specify a user account with permission to create a session on the remote computer.

    ————————– EXAMPLE 9 ————————–

    C:\PS>$s = New-PSSession -ComputerName (Import-Csv servers.csv) -Credential domain01\admin01 -ThrottleLimit 16

    C:\PS> Invoke-Command -session $s -scriptblock {Get-Process powershell} -AsJob

    Description
    ———–
    These commands create a set of PSSessions and then run a background job in each of the PSSessions.

    The first command creates a new PSSession on each of the computers listed in the Servers.csv file. It uses the New-PSSession cmdlet to create the PSSession. The value of the ComputerName parameter is a command that uses the Import-Csv cmdlet to import the Servers.csv file and read its contents.

    The command uses the Credential parameter to create the PSSessions with the permission of a domain administrator, and it uses the ThrottleLimit parameter to limit the command to 16 concurrent connections. The command saves the PSSessions in the $s Variable.

    The second command uses the AsJob parameter of Invoke-Command to start a background job that runs a “Get-Process PowerShell” command in each of the PSSessions in $s.

    For more information about background jobs, see about_jobs and about_remote_Jobs.

    ————————– EXAMPLE 10 ————————–

    C:\PS>New-PSSession -ConnectionURI https://management.exchangelabs.com/Management

    Description
    ———–
    This command creates a new PSSession that connects to a computer that is specified by a URI instead of a computer name.

    ————————– EXAMPLE 11 ————————–

    C:\PS>$so = New-WSManSessionOption -SkipCACheck

    PS C:\> New-PSSession -ConnectionUri https://management.exchangelabs.com/Management -SessionOption $so -Credential server01\admin01

    Description
    ———–
    This example shows how to create and use a SessionOption parameter.

    The first command uses the New-WSManSessionOption cmdlet to create a session option. It saves the resulting SessionOption object in the $so parameter.

    The second command uses the option in a new session. The command uses the New-PSSession cmdlet to create a new session. The value of the SessionOption parameter is the SessionOption object in the $so Variable.

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

New-PSSessionOption

NAME
    New-PSSessionOption

SYNOPSIS
    Creates an object that contains advanced options for a PSSession.

SYNTAX
    New-PSSessionOption [-ApplicationArguments <PSPrimitiveDictionary>] [-CancelTimeout <int>] [-Culture <CultureInfo>] [-IdleTimeout <int>] [-MaximumReceivedDataSizePerCommand <int>] [-MaximumReceivedObjectSize <int>] [-MaximumRedirection <int>] [-NoCompression] [-NoEncryption] [-NoMachineProfile] [-OpenTimeout <int>] [-OperationTimeout <int>] [-ProxyAccessType {None | IEConfig | WinHttpConfig | AutoDetect | NoProxyServer}] [-ProxyAuthentication {Default | Basic | Negotiate | NegotiateWithImplicitCredential | Credssp | Digest | Kerberos}] [-ProxyCredential <PSCredential>] [-SkipCACheck] [-SkipCNCheck] [-SkipRevocationCheck] [-UICulture <CultureInfo>] [-UseUTF16] [<CommonParameters>]

DESCRIPTION
    The New-PSSessionOption cmdlet creates an object that contains advanced options for a PSSession. You can use the object as the value of the SessionOption parameter of cmdlets that create a PSSession, such as New-PSSession, Enter-PSSession, and Invoke-Command.

    Without parameters, New-PSSessionOption generates an object that contains the default values for all of the options. Because all of the properties can be edited, you can use the resulting object as a template, and create standard option objects for your enterprise.

PARAMETERS
    -ApplicationArguments <PSPrimitiveDictionary>
        Specifies a hash table that is sent directly to the session configuration without interpretation. This hash table is available to the session configuration as a property of the PSSenderInfo class.

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

    -CancelTimeout <int>
        Determines how long Windows PowerShell waits for a cancel operation (CTRL + C) to complete before terminating it. Enter a value in milliseconds.

        The default value is 60000 (one minute). A value of 0 (zero) means no timeout; the command continues indefinitely.

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

    -Culture <CultureInfo>
        Specifies the culture to use for the PSSession. Enter a culture name in <languagecode2>-<country/regioncode2> format, such as “ja-jP”, a Variable that contains a CultureInfo object, or a command that gets a CultureInfo object, such as “Get-Culture“.

        The default value is $null, and the culture that is set in the operating system when the PSSession is created is used in the PSSession.

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

    -IdleTimeout <int>
        Determines how long the PSSession stays open if the remote computer does not receive any communication from the local computer, including the heartbeat signal. When the interval expires, the PSSession closes.

        Enter a value in milliseconds. The default value is 240000 (4 minutes). The minimum value is 60000 (1 minute).

        If both the local and remote computers specify an idle timeout value, the PSSession uses the shorter timeout value. The local computer can set an idle timeout value by using this parameter or by setting an idle timeout in the $PSSessionOption preference Variable. The remote computer can specify an idle timeout value in the WS-Management configuration (WSMAN:\localhost\shell\idletimeout).

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

    -MaximumReceivedDataSizePerCommand <int>
        Specifies the maximum number of bytes that the local computer can receive from the remote computer in a single command. Enter a value in bytes. By default, there is no data size limit.

        This option is designed to protect the resources on the client computer.

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

    -MaximumReceivedObjectSize <int>
        Specifies the maximum size of an object that the local computer can receive from the remote computer. Enter a value in bytes. By default, there is no data size limit.

        This option is designed to protect the resources on the client computer.

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

    -MaximumRedirection <int>
        Determines how many times Windows PowerShell redirects a connection to an alternate Uniform Resource Identifier (URI) before the connection fails. The default value is 5. A value of 0 (zero) prevents all redirection.

        This option is used in the PSSession only when the AllowRedirection parameter is used in the command that creates the PSSession.

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

    -NoCompression [<SwitchParameter>]
        Turns off packet compression in the PSSession. Compression uses more processor cycles, but it makes transmission faster.

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

    -NoEncryption [<SwitchParameter>]
        Turns off data encryption.

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

    -NoMachineProfile [<SwitchParameter>]
        Prevents loading the user’s Windows user profile. As a result, the PSSession might be created faster, but user-specific Registry settings, items such as Environment Variables, and Certificates are not available in the PSSession.

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

    -OpenTimeout <int>
        Determines how long the client computer waits for the session connection to be established. When the interval expires, the command to establish the connection fails. Enter a value in milliseconds.

        The default value is 180000 (3 minutes). A value of 0 (zero) means no time-out; the command continues indefinitely.

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

    -OperationTimeout <int>
        Determines the maximum time that any operation in the PSSession can run. When the interval expires, the operation fails. Enter a value in milliseconds.

        The default value is 180000 (3 minutes). A value of 0 (zero) means no time-out; the operation continues indefinitely.

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

    -ProxyAccessType <ProxyAccessType>
        Determines which mechanism is used to resolve the host name. Valid values are IEConfig, WinHttpConfig, AutoDetect, NoProxyServer and None. The default value is None.

        For information about the values of this parameter, see the description of the System.Management.Automation.Remoting.ProxyAccessType enumeration in the MSDN (Microsoft Developer Network) Library at http://go.microsoft.com/fwlink/?LinkId=144756.

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

    -ProxyAuthentication <AuthenticationMechanism>
        Specifies the authentication method that is used for proxy resolution. Valid values are Basic, Digest, and Negotiate. The default value is Negotiate.

        For information about the values of this parameter, see the description of the System.Management.Automation.Runspaces.AuthenticationMechanism enumeration in the MSDN library at http://go.microsoft.com/fwlink/?LinkID=144382.

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

    -ProxyCredential <PSCredential>
        Specifies the credentials to use for proxy authentication. Enter a Variable that contains a PSCredential object or a command that gets a PSCredential object, such as Get-Credential. If this option is not set, no credentials are specified.

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

    -SkipCACheck [<SwitchParameter>]
        Specifies that when connecting over HTTPS, the client does not validate that the server Certificate is signed by a trusted Certificate authority (CA).

        Use this option only when the remote computer is trusted by using another mechanism, such as when the remote computer is part of a network that is physically secure and isolated, or the remote computer is listed as a trusted host in a WinRM configuration.

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

    -SkipCNCheck [<SwitchParameter>]
        Specifies that the Certificate common name (CN) of the server does not need to match the hostname of the server. This option is used only in remote operations that use the HTTPS protocol.

        Use this option only for trusted computers.

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

    -SkipRevocationCheck [<SwitchParameter>]
        Does not validate the revocation status of the server Certificate.

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

    -UICulture <CultureInfo>
        Specifies the UI culture to use for the PSSession.

        Enter a culture name in <languagecode2>-<country/regioncode2> format, such as “ja-jP”, a Variable that contains a CultureInfo object, or a command that gets a CultureInfo object, such as Get-Culture.

        The default value is $null, and the UI culture that is set in the operating system when the PSSession is created is used in the PSSession.

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

    -UseUTF16 [<SwitchParameter>]
        Encode the request in UTF16 format rather than UTF8 format.

        Required?                    false
        Position?                    named
        Default value                False (UTF8 encoding)
        Accept pipeline input?     false
        Accept wildcard characters? false

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

INPUTS
    None
        You cannot pipe input to this cmdlet.

OUTPUTS
    System.Management.Automation.Remoting.PSSessionOption

NOTES

        If the SessionOption parameter is not used in a command to create a PSSession, the session options are determined by the property values of the $PSSessionOption preference Variable, if it is set. For more information about the $PSSessionOption Variable, see about_preference_variables.

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

    C:\PS>New-PSSessionOption

    MaximumConnectionRedirectionCount : 5
    NoCompression                     : False
    NoMachineProfile                 : False
    ProxyAccessType                 : IEConfig
    ProxyAuthentication             : Negotiate
    ProxyCredential                 :
    SkipCACheck                     : False
    SkipCNCheck                     : False
    SkipRevocationCheck             : False
    OperationTimeout                 : 00:03:00
    NoEncryption                     : False
    UseUTF16                         : False
    Culture                         :
    UICulture                         :
    MaximumReceivedDataSizePerCommand :
    MaximumReceivedObjectSize         :
    ApplicationArguments             :
    OpenTimeout                     : 00:03:00
    CancelTimeout                     : 00:01:00
    IdleTimeout                     : 00:04:00

    Description
    ———–
    This command creates a session option object with all of the default values.

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

    C:\PS>$pso = New-PSSessionoption -Culture “fr-fr” -MaximumReceivedObjectSize 10MB

    C:\PS> New-PSSession -computerName Server01 -SessionOption $pso

    Description
    ———–
    This example shows how to use a session option object to configure a session.

    The first command creates a new session option object and saves it in the value of the $pso Variable.

    The second command uses the New-PSSession cmdlet to create a PSSession on the Server01 remote computer. The command uses the session option object in the value of the $pso Variable as the value of the SessionOption parameter of the command.

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

    C:\PS>Enter-PSSession -computername Server01 -sessionOption (New-PSSessionoption -NoEncryption -NoCompression)

    Description
    ———–
    This command uses the Enter-PSSession cmdlet to start an interactive session with the Server01 computer. The value of the SessionOption parameter is a New-PSSessionOption command with the NoEncryption and NoCompression switch parameters.

    The New-PSSessionOption command is enclosed in parentheses to make sure that it runs before the Enter-PSSession command.

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

    C:\PS>$a = New-PSSessionoption

    MaximumConnectionRedirectionCount : 5
    NoCompression                     : False
    NoMachineProfile                 : False
    ProxyAccessType                 : IEConfig
    ProxyAuthentication             : Negotiate
    ProxyCredential                 :
    SkipCACheck                     : False
    SkipCNCheck                     : False
    SkipRevocationCheck             : False
    OperationTimeout                 : 00:03:00
    NoEncryption                     : False
    UseUTF16                         : False
    Culture                         :
    UICulture                         :
    MaximumReceivedDataSizePerCommand :
    MaximumReceivedObjectSize         :
    ApplicationArguments             :
    OpenTimeout                     : 00:03:00
    CancelTimeout                     : 00:01:00
    IdleTimeout                     : 00:04:00

    C:\PS> $a.UICulture = (UIGet-Culture)
    C:\PS> $a.OpenTimeout = (New-TimeSpan -minutes 4)
    C:\PS> $a.MaximumConnectionRedirectionCount = 1

    C:\PS> $a

    MaximumConnectionRedirectionCount : 1
    NoCompression                     : False
    NoMachineProfile                 : False
    ProxyAccessType                 : IEConfig
    ProxyAuthentication             : Negotiate
    ProxyCredential                 :
    SkipCACheck                     : False
    SkipCNCheck                     : False
    SkipRevocationCheck             : False
    OperationTimeout                 : 00:03:00
    NoEncryption                     : False
    UseUTF16                         : False
    Culture                         :
    UICulture                         : en-US
    MaximumReceivedDataSizePerCommand :
    MaximumReceivedObjectSize         :
    ApplicationArguments             :
    OpenTimeout                     : 00:04:00
    CancelTimeout                     : 00:01:00
    IdleTimeout                     : 00:04:00

    Description
    ———–
    This example demonstrates that you can edit the session option object. All properties have read/write values.

    Use this method to create a standard session object for your enterprise, and then create customized versions of it for particular uses.

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

    C:\PS>$PSSessionOption = New-PSSessionOption -OpenTimeout 120000

    Description
    ———–
    This command creates a $PSSessionOption preference Variable.

    When the $PSSessionOption preference Variable exists in the session, it establishes default values for options in the PSSessions that are created by using the New-PSSession, Enter-PSSession, and Invoke-Command cmdlets.

    To make the $PSSessionOption Variable available in all sessions, add it to your Windows PowerShell session and to your Windows PowerShell profile.

    For more information about the $PSSessionOption Variable, see about_preference_variables. For more information about profiles, see about_profiles.

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

    C:\PS>$skipCN = New-PSSessionoption -SkipCNCheck

    C:\PS> New-PSSession -computername 171.09.21.207 -UseSSL -credential domain01\user01 -sessionOption $skipCN

    Description
    ———–
    This example shows how to use a SessionOption object to fulfill the requirements for a remote session configuration.

    The first command uses the New-PSSessionOption cmdlet to create a session option object with the SkipCNCheck property. The command saves the resulting session object in the $skipCN Variable.

    The second command uses the New-PSSession cmdlet to create a new PSSession on a remote computer. The $skipCN check Variable is used in the value of the SessionOption parameter.

    Because the computer is identified by its IP address, the value of the ComputerName parameter does not match any of the common names in the Certificate used for Secure Sockets Layer (SSL). As a result, the SkipCNCheck option is required.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=144305
    Enter-PSSession
    New-PSSession
    Invoke-Command

New-Service

NAME
    New-Service

SYNOPSIS
    Creates a new Windows service.

SYNTAX
    New-Service [-Name] <string> [-BinaryPathName] <string> [-Credential <PSCredential>] [-DependsOn <string[]>] [-Description <string>] [-DisplayName <string>] [-StartupType {Automatic | Manual | Disabled}] [-Confirm] [-WhatIf] [<CommonParameters>]

DESCRIPTION
    The New-Service cmdlet creates a new entry for a Windows service in the Registry and in the service database. A new service requires an executable file that executes during the service.

    The parameters of this cmdlet let you set the display name, description, startup type, and dependencies of the service.

PARAMETERS
    -BinaryPathName <string>
        Specifies the path to the executable file for the service. This parameter is required.

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

    -Credential <PSCredential>
        Specifies a user account that has permission to perform this action. Type a user name, such as “User01” or “Domain01\User01”. Or, enter a PSCredential object, such as one from the Get-Credential cmdlet. If you type a user name, you will be prompted for a password.

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

    -DependsOn <string[]>
        Specifies the names of other services upon which the new service depends. To enter multiple service names, use a comma to separate the names.

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

    -Description <string>
        Specifies a description of the service.

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

    -DisplayName <string>
        Specifies a display name for the service.

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

    -Name <string>
        Specifies the name of the service. This parameter is required.

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

    -StartupType <ServiceStartMode>
        Sets the startup type of the service. “Automatic” is the default.

        Valid values are:

        — Manual:     The service is started only manually, by a user (using the Service Control Manager) or by an application.

        — Automatic: The service is to be started (or was started) by the operating system, at system start-up. If an automatically started service depends on a manually started service, the manually started service is also started automatically at system startup.

        — Disabled: The service is disabled and cannot be started by a user or application.

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

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

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

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

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

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

INPUTS
    None
        You cannot pipe input to this cmdlet.

OUTPUTS
    System.ServiceProcess.ServiceController
        New-Service returns an object that represents the new service.

NOTES

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

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

    C:\PS>New-Service -Name TestService -BinaryPathName “C:\WINDOWS\System32\svchost.exe -k netsvcs”

    Description
    ———–
    This command creates a new service named “TestService”.

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

    C:\PS>New-Service -Name TestService -path “C:\WINDOWS\System32\svchost.exe -k netsvcs” -DependsOn NetLogon -DisplayName “Test Service” -StartupType Manual -Description “This is a test service.”

    Description
    ———–
    This command creates a new service named “TestService”. It uses the parameters of the New-Service cmdlet to specify a description, startup type, and display name for the new service.

    To specify the BinaryPathName parameter, the command uses the Path parameter Alias. You can also use “-bpn”.

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

    C:\PS>Get-WmiObject win32_service -filter “name=’testservice'”

    ExitCode : 0
    Name     : testservice
    ProcessId : 0
    StartMode : Auto
    State     : Stopped
    Status    : OK

    Description
    ———–
    This command uses the Get-WmiObject cmdlet to get the Win32_Service object for the new service. This object includes the start mode and the service description.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113359
    Get-Service
    Start-Service
    Stop-Service
    Restart-Service
    Resume-Service
    Set-Service
    Suspend-Service

New-TimeSpan

NAME
    New-TimeSpan

SYNOPSIS
    Creates a TimeSpan object.

SYNTAX
    New-TimeSpan [[-Start] <DateTime>] [[-End] <DateTime>] [<CommonParameters>]

    New-TimeSpan [-Days <int>] [-Hours <int>] [-Minutes <int>] [-Seconds <int>] [<CommonParameters>]

DESCRIPTION
    The New-TimeSpan cmdlet creates a TimeSpan object that represents a time. interval You can use a TimeSpan object to add or subtract time from DateTime objects.

    Without parameters, a “New-TimeSpan” command returns a timespan object that represents a time interval of zero.

PARAMETERS
    -Days <int>
        Indicates the days in the time span. The default is 0.

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

    -End <DateTime>
        Indicates the end of a time span. The default is the current date and time.

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

    -Hours <int>
        Indicates the hours in the time span. The default is zero.

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

    -Minutes <int>
        Indicates the minutes in the time span. The default is 0.

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

    -Seconds <int>
        Indicates the length of the time span in seconds. The default is 0.

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

    -Start <DateTime>
        Indicates the start of a time span. Enter a string that represents the date and time, such as “3/15/09” or a DateTime object, such as one from a Get-Date command.

        The default is the current date and time.

        Required?                    false
        Position?                    1
        Default value                Current date and time
        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.DateTime
        You can pipe a DateTime object that represents that start time to New-TimeSpan.

OUTPUTS
    System.Timespan
        New-TimeSpan returns an object that represents the time span.

NOTES

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

    C:\PS>$timespan = New-TimeSpan -hour 1 -minute 25

    Description
    ———–
    This command creates a TimeSpan object with a duration of 1 hour and 25 minutes and stores it in a Variable named $timespan. It displays a representation of the TimeSpan object.

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

    C:\PS>New-TimeSpan -End (Get-Date -year 2010 -month 1 -day 1)

    Description
    ———–
    This example creates a new TimeSpan object that represents the interval between the time that the command is run and January 1, 2010.

    This command does not require the Start parameter, because the default value of the Start parameter is the current date and time.

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

    C:\PS>$90days = New-TimeSpan -days 90

    C:\PS> (Get-Date) + $90days

    Description
    ———–
    These commands return the date that is 90 days after the current date.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113360
    Set-Date
    Get-Date

New-Variable

NAME
    New-Variable

SYNOPSIS
    Creates a new Variable.

SYNTAX
    New-Variable [-Name] <string> [[-Value] <Object>] [-Description <string>] [-Force] [-Option {None | ReadOnly | Constant | Private | AllScope}] [-PassThru] [-Scope <string>] [-Visibility {Public | Private}] [-Confirm] [-WhatIf] [<CommonParameters>]

DESCRIPTION
    The New-Variable cmdlet creates a new Variable in Windows PowerShell. You can assign a value to the Variable while creating it or assign or change the value after it is created.

    You can use the parameters of New-Variable to set the properties of the Variable (such as those that create read-only or constant Variables), set the scope of a Variable, and determine whether Variables are public or private.

    Typically, you create a new Variable by typing the Variable name and its value, such as “$var = 3”, but you can use the New-Variable cmdlet to use its parameters.

PARAMETERS
    -Description <string>
        Specifies a description of the Variable.

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

    -Force [<SwitchParameter>]
        Allows you to create a new Variable with the same name as an existing read-only Variable.

        By default, you can overwrite a Variable unless the Variable has an option value of ReadOnly or Constant. For more information, see the Option parameter.

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

    -Name <string>
        Specifies a name for the new Variable.

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

    -Option <ScopedItemOptions>
        Sets the value of the Options property of the new Variable.

        Valid values are:

        — None: Sets no options. (“None” is the default.)

        — ReadOnly: The value of the Variable cannot be changed except by using the Force parameter. You can use Remove-Variable to delete the Variable.

        — Constant: The Variable cannot be deleted, and its properties cannot be changed. “Constant” is available only when you are creating an Alias. You cannot change the option of an existing Variable to “Constant”.

        — Private: The Variable is available only within the scope specified by the Scope parameter. It is inherited by child scopes. (This value is not related to the “Private” value of the Visibility parameter.)

        — AllScope: The Variable is copied to any new scopes that are created.

        To see the Options property of the Variables, type “Get-Variable| Format-Table -property name, options -autosize”.

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

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

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

    -Scope <string>
        Determines the scope of the new Variable. 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?     false
        Accept wildcard characters? false

    -Value <Object>
        Specifies the initial value of the Variable.

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

    -Visibility <SessionStateEntryVisibility>
        Determines whether the Variable is visible outside of the session in which it was created. This parameter is designed for use in scripts and commands that will be delivered to other users.

        Valid values are:

        — Public: The Variable is visible. (“Public” is the default.)
        — Private: The Variable is not visible.

        When a Variable is private, it does not appear in lists of Variables, such as those returned by Get-Variable, or in displays of the Variable: drive. Commands to read or change the value of a private Variable return an error. However, the user can run commands that use a private Variable if the commands were written in the session in which the Variable was defined.

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

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

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

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

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

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

INPUTS
    System.Object
        You can pipe a value to New-Variable.

OUTPUTS
    None or System.Management.Automation.PSVariable
        When you use the PassThru parameter, New-Variable generates a System.Management.Automation.PSVariable object representing the new Variable. Otherwise, this cmdlet does not generate any output.

NOTES

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

    C:\PS>New-Variable days

    Description
    ———–
    This command creates a new Variable named “days”. It has no value immediately following the command.

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

    C:\PS>New-Variable zipcode -Value 98033

    Description
    ———–
    This command creates a Variable named “zipcode” and assigns it the value “98033”.

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

    C:\PS>New-Variable -Name max -Value 256 -Option readonly

    New-Variable -Name max -Value 1024

    New-Variable -Name max -Value 1024 -Force

    C:\PS> New-Variable -Name max -Value 256 -Option readonly

    C:\PS> New-Variable -Name max -Value 1024
    New-Variable : A Variable with name ‘max’ already exists.
    At line:1 char:13
    + New-Variable <<<< -Name max -Value 1024

    C:\PS> New-Variable -Name max -Value 1024 -Force

    Description
    ———–
    This example shows how to use the ReadOnly option of New-Variable to protect a Variable from being overwritten.

    The first command creates a new Variable named Max and sets its value to “256”. It uses the Option parameter with a value of ReadOnly.

    The second command tries to create a second Variable with the same name. This command returns an error, because the read-only option is set on the Variable.

    The third command uses the Force parameter to override the read-only protection on the Variable. In this case, the command to create a new Variable with the same name succeeds.

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

    C:\PS>New-Variable -Name counter -Visibility private

    #Effect of private Variable in a module.

    C:\PS> Get-Variable c*

    Name                         Value
    —-                         —–
    Culture                        en-US
    ConsoleFileName
    ConfirmPreference             High
    CommandLineParameters         {}

    C:\PS> $counter
    “Cannot access the Variable ‘$counter’ because it is a private Variable

    C:\PS> Get-Counter
    Name         Value
    —-         —–
    Counter1     3.1415
    …

    Description
    ———–
    This command demonstrates the behavior of a private Variable in a module. The module contains the Get-Counter cmdlet, which has a private Variable named “Counter”. The command uses the Visibility parameter with a value of “Private” to create the Variable.

    The sample output shows the behavior of a private Variable. The user who has loaded the module cannot view or change the value of the Counter Variable, but the Counter Variable can be read and changed by the commands in the module.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113361
    Get-Variable
    Set-Variable
    Remove-Variable
    Clear-Variable

New-WebServiceProxy

NAME
    New-WebServiceProxy

SYNOPSIS
    Creates a Web service proxy object that lets you use and manage the Web service in Windows PowerShell.

SYNTAX
    New-WebServiceProxy [-Uri] <Uri> [[-Class] <string>] [[-Namespace] <string>] [<CommonParameters>]

    New-WebServiceProxy [-Uri] <Uri> [[-Class] <string>] [[-Namespace] <string>] [-Credential <PSCredential>] [<CommonParameters>]

    New-WebServiceProxy [-Uri] <Uri> [[-Class] <string>] [[-Namespace] <string>] [-UseDefaultCredential] [<CommonParameters>]

DESCRIPTION
    The New-WebServiceProxy cmdlet lets you use a Web service in Windows PowerShell. The cmdlet connects to a Web service and creates a Web service proxy object in Windows PowerShell. You can use the proxy object to manage the Web service.

    A Web service is an XML-based program that exchanges data over a network, particularly over the Internet. The Microsoft .NET Framework provides Web service proxy objects that represent the Web service as a .NET Framework object.

PARAMETERS
    -Class <string>
        Specifies a name for the proxy class that the cmdlet creates for the Web service. The value of this parameter is used with the Namespace parameter to provide a fully qualified name for the class. The default value is generated from the URI.

        Required?                    false
        Position?                    2
        Default value                Generated from the URI
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Credential <PSCredential>
        Specifies a user account that has permission to perform this action. The default is the current user. This is an alternative to using the UseDefaultCredential parameter.

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

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

    -Namespace <string>
        Specifies a namespace for the new class.

        The value of this parameter is used with the value of the Class parameter to generate a fully qualified name for the class. The default value is Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes plus a type that is generated from the URI.

        You can set the value of the Namespace parameter so that you can access multiple Web services with the same name.

        Required?                    false
        Position?                    3
        Default value                Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Uri <Uri>
        Specifies the URI of the Web service. Enter a URI or the path and file name of a file that contains a service description.

        The URI must refer to an .asmx page or to a page that returns a service description. To return a service description of a Web service that was created by using ASP.NET, append “?WSDL” to the URL of the Web service (for example, http://www.contoso.com/MyWebService.asmx?WSDL).

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

    -UseDefaultCredential [<SwitchParameter>]
        Sets the UseDefaultCredential parameter in the resulting proxy object to True. This is an alternative to using the Credential parameter.

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

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

INPUTS
    None
        This cmdlet does not take input from the pipeline.

OUTPUTS
    A Web service proxy object
        The namespace and class of the object are determined by the parameters of the command. The default is generated from the input Uniform Resource Identifier (URI).

NOTES

        New-WebServiceProxy uses the System.Net.WebClient class to load the specified Web service.

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

    C:\PS>$zip = New-WebServiceProxy -Uri http://www.webservicex.net/uszip.asmx?WSDL

    Description
    ———–
    This command uses the New-WebServiceProxy command to create a .NET Framework proxy of the US Zip Web service in Windows PowerShell.

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

    C:\PS>$URI = “http://www.webservicex.net/uszip.asmx?WSDL”

    C:\PS> $zip = New-WebServiceProxy -Uri $URI -Namespace WebServiceProxy -Class ZipClass

    Description
    ———–
    This command uses the New-WebServiceProxy cmdlet to create a .NET Framework proxy of the US Zip Web service.

    The first command stores the URI of the Web service in the $URI Variable.

    The second command creates the Web service proxy. The command uses the URI parameter to specify the URI and the Namespace and Class parameters to specify the namespace and class of the object.

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

    C:\PS>$zip | Get-Member -type method

     TypeName: WebServiceProxy.USZip

    Name                     MemberType Definition
    —-                     ———- ———-
    Abort                     Method     System.Void Abort(
    BeginGetInfoByAreaCode    Method     System.IAsyncResul
    BeginGetInfoByCity        Method     System.IAsyncResul
    BeginGetInfoByState     Method     System.IAsyncResul
    BeginGetInfoByZIP         Method     System.IAsyncResul
    CreateObjRef             Method     System.Runtime.Rem
    Discover                 Method     System.Void Discov
    Dispose                 Method     System.Void Dispos
    EndGetInfoByAreaCode     Method     System.Xml.XmlNode
    EndGetInfoByCity         Method     System.Xml.XmlNode
    EndGetInfoByState         Method     System.Xml.XmlNode
    EndGetInfoByZIP         Method     System.Xml.XmlNode
    Equals                    Method     System.Boolean Equ
    GetHashCode             Method     System.Int32 GetHa
    GetInfoByAreaCode         Method     System.Xml.XmlNode
    GetInfoByCity             Method     System.Xml.XmlNode
    GetInfoByState            Method     System.Xml.XmlNode
    GetInfoByZIP             Method     System.Xml.XmlNode
    GetLifetimeService        Method     System.Object GetL
    GetType                 Method     System.Type GetTyp
    InitializeLifetimeService Method     System.Object Init
    ToString                 Method     System.String ToSt

    Description
    ———–
    This command uses the Get-Member cmdlet to display the methods of the Web service proxy object in the $zip Variable. We will use these methods in the following example.

    Notice that the TypeName of the proxy object, WebServiceProxy, reflects the namespace and class names that were specified in the previous example.

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

    C:\PS>$zip.getinfobyzip(20500).table

    CITY     : Washington
    STATE     : DC
    ZIP     : 20500
    AREA_CODE : 202
    TIME_ZONE : E

    Description
    ———–
    This command uses the Web service proxy stored in the Zip Variable. The command uses the GetInfoByZip method of the proxy and its Table property.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=135238
    New-Service