New-WSManSessionOption

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

Syntax
      New-WSManSessionOption [-NoEncryption] [-OperationTimeout Int32]
         [-ProxyAccessType ProxyAccessType] [-ProxyAuthentication ProxyAuthentication]
            [-ProxyCredential PSCredential] [-SkipCACheck] [-SkipCNCheck]
               [-SkipRevocationCheck] [-SPNPort Int32] [-UseUTF16] [CommonParameters]
    
Key
   -NoEncryption
        Do not use encryption when doing remote operations over HTTP.
        Unencrypted traffic is not allowed by default and must be enabled in the local configuration.

    -OperationTimeout Int32
        The timeout in milliseconds for the WS-Management operation.
        
    -ProxyAccessType ProxyAccessType
        Specifies the mechanism by which the proxy server is located.
        Possible values are:
        
          ProxyIEConfig - Use the Internet Explorer proxy configuration for the current user.
                          This is the default setting.
        
          ProxyWinHttpConfig - The WSMan client uses the proxy settings configured for WinHTTP,
                               using the ProxyCfg.exe utility.
        
          ProxyAutoDetect - Force auto-detection of a proxy server.
        
          ProxyNoProxyServer - Do not use a proxy server.
                               All 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.

   -ProxyCredential PSCredential
       Specifies a user account that has permission to gain access through an intermediate web proxy.

   -SPNPort Int32
       Specifies a port number to append to the connection Service Principal Name SPN of the
       remote server.  An SPN is used when the authentication mechanism is Kerberos or Negotiate.

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

   -SkipRevocationCheck
       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.

   -UseUTF16
       Encode the request in UTF16 format rather than UTF8 format. The default is UTF8 encoding.

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 PowerShell Cmdlets

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 © 1999-2024 SS64.com
Some rights reserved