New-WSManSessionOption

Configure options (session input parameters) for WSMan cmdlets: Connect-WSMan, Invoke-WSManAction, Get-WSManInstance, Set-WSManInstance.

Syntax
      New-WSManSessionOption [-NoCompression] [-NoProxy]
         [-ProxyAuthentication] [-ProxyPassword string] [-ProxyUserName string]
            [-SkipCACheck] [-SkipCNCheck] [-SkipRevocation] [-SPNPort int]
               [-Timeout int] [-UnEncrypted] [-UseIEProxyconfig] [-UseProxyAutoDetection]
                  [-UseWinHTTPProxyConfig] [-UTF16] [CommonParameters]
    
Key
   -NoCompression
       Turn off packet compression in the session.
       Compression is enabled by default and the packets sent between the client and server
       are compressed. Compression uses more processor cycles, but it makes transmission faster.

-NoProxy Do not use a proxy server. All host names will be resolved locally. -ProxyAuthentication string
The authentication method to use at the proxy. Possible values are:

Basic The user name and password are sent in clear-text.
Digest A challenge-response scheme that uses a server-specified data string for the challenge.
Negotiate A challenge-response scheme that negotiates with the server or proxy to determine which scheme to use for authentication.(default) Examples are the Kerberos protocol and NTLM.

-ProxyPassword string A password to to be used for proxy authentication.

-ProxyUserName string A user name to to be used for proxy authentication.

-SkipCACheck Do not validate that the server certificate is signed by a trusted certificate authority (CA) when connecting over HTTPS. Use this option only when the remote computer is trusted by other means, for example, if 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 the WS-Management configuration.

-SkipCNCheck Specifies that the certificate common name (CN) of the server does not need to match the hostname of the server. This is used only in remote operations using HTTPS. This option should only be used for trusted computers.

-SkipRevocation Do not validate the revocation status on the server certificate.

-SPNPort int A port number to append to the connection Service Principal Name SPN of the remote server. An SPN is used with Kerberos or Negotiate authentication.

-Timeout int The timeout in milliseconds for the WS-Management operation.

-UnEncrypted Do not use encryption when doing remote operations over HTTP.
Note: Unencrypted traffic is not allowed by default and must be enabled in the local configuration.

-UseIEProxyconfig Use the Internet Explorer proxy configuration for the current user. This is the default setting.

-UseProxyAutoDetection Force auto-detection of a proxy.

-UseWinHTTPProxyConfig Use the proxy settings configured for WinHTTP.

-UTF16 Encode the request in UTF16 format rather than UTF8 format. The default is UTF8 encoding. CommonParameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable, -OutBuffer -OutVariable.

New-WSManSessionOption reduces the number of parameters required by other cmdlets and allows the settings to be stored in a variable and reused.

Examples

Copy a file from server64 to the local machine using SSL and skipping the CA check:

PS C:\> $skip = New-WSManSessionOption -SkipCACheck
PS C:\> invoke-command -useSSL -SessionOption $skip server64 {get-content -encoding byte -ReadCount 0 "E:\makecert.exe"} | set-content -encoding byte C:\Documents\makecert.exe

“In photography, the smallest thing can be a great subject. The little, human detail can become a Leitmotiv” ~ Henri Cartier-Bresson

Related:

Connect-WSMan Connect to the WinRM service on a remote computer
Invoke-WSManAction - Invoke an action on a specified object
Get-WSManInstance Display management information (XML or value)
Set-WSManInstance
- Modify the management information related to a resource


© Copyright SS64.com 1999-2013
Some rights reserved