Set WSManInstance - PowerShell


Overview

Set-WSManInstance manages WS-Management (WSMan) instances, which represent remote server connections. It allows you to modify connection settings, configure authentication, and specify proxy settings for effective remote management.

Syntax

Set-WSManInstance [-Name] <string> [-ConnectionUri] <string> [-AuthMechanism] <string> [-Authentication] <WSManAuthentication>
[-ProxyUri] <string> [-ProxyAuthentication] <WSManProxyAuthentication> [-EnableProxy] <bool> [-UseSiteRedirect] <bool>
[-Confirm] [-WhatIf] [-ThrottleLimit] <int> [-Credential] <PSCredential>

Options/Flags

  • -Name: Specifies the name of the WSMan instance to configure.
  • -ConnectionUri: Sets the connection URI for the instance.
  • -AuthMechanism: Specifies the authentication mechanism (Basic, Negotiate, Kerberos, or CredSSP).
  • -Authentication: Configures authentication settings for the instance.
  • -ProxyUri: Sets the proxy URI for the instance.
  • -ProxyAuthentication: Specifies the proxy authentication method.
  • -EnableProxy: Enables or disables the use of a proxy.
  • -UseSiteRedirect: Controls whether to use site redirection.
  • -Confirm: Prompts for confirmation before modifying the instance.
  • -WhatIf: Shows what would happen without actually modifying the instance.
  • -ThrottleLimit: Sets the maximum number of concurrent operations for the instance.
  • -Credential: Specifies the credentials to use for authentication.

Examples

Example 1: Modify Connection Settings

Set-WSManInstance -Name MyInstance -ConnectionUri https://myServer:5985/wsman

Example 2: Configure Authentication

Set-WSManInstance -Name MyInstance -AuthMechanism CredSSP -Authentication Digest

Example 3: Set Proxy Settings

Set-WSManInstance -Name MyInstance -EnableProxy -ProxyUri http://myProxy:8080 -ProxyAuthentication Basic

Common Issues

  • Authentication Failures: Ensure the credentials and authentication mechanism are correct.
  • Connection Errors: Verify network connectivity and that the remote server is listening on the specified port.
  • Proxy Misconfiguration: Check that the proxy server is reachable and configured properly.

Integration

  • Invoke-Command: Remotely execute commands on the server using the configured WSMan instance.
  • Get-WSManInstance: Retrieve information about the configured WSMan instances.
  • New-PSDrive: Create a drive mapped to the remote server using the WSMan instance.
  • Invoke-WSManCommand
  • Connect-WSMan
  • WSMan module