Because Windows PowerShell remoting uses the HTTP protocol, it is affected by HTTP proxy settings. In enterprises that have proxy servers, users cannot access a Windows PowerShell remote computer directly.

To resolve this problem, use proxy setting options in your remote command. The following settings are available:

When the proxy settings are not correctly configured, Windows PowerShell generates the following error.

  Copy Code
ERROR: The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests.

To configure proxy settings for a remote command

  1. Use the ProxyAccessType, ProxyAuthentication, and ProxyCredential parameters of the New-PSSessionOption cmdlet to create a session option object with the proxy settings for your enterprise. Save the option object in a variable.

    For example, the following command creates a session option object with proxy session options and saves it in a $proxyOptions variable.

      Copy Code
    $proxyOptions = New-PSSessionOption -ProxyAccessType IEConfig -ProxyAuthentication Negotiate -ProxyCredential Domain01\User01
    
  2. Use the variable that contains the option object as the value of the SessionOption parameter of a New-PSSession, Enter-PSSession, or Invoke-Command command.

    The following remote command uses the session option object in the $proxyOptions variable.

      Copy Code
    New-PSSession -ConnectionURI https://www.fabrikam.com -SessionOption $proxyOptions
    

To configure proxy settings for all remote commands in a session

  • To make the proxy options the default for all remote commands in the current session, set the value of the $PSSessionOption preference variable to include the proxy setting options.

    For example, the following command sets the value of the $PSSessionOption preference variable to a session option object that contains the proxy settings for an enterprise.

      Copy Code
    $PSSessionOption = New-PSSessionOption -ProxyAccessType IEConfig -ProxyAuthentication Negotiate -ProxyCredential Domain01\User01
    

    For more information about the $PSSessionOption preference variable, see about_Preference_Variables.

To configure proxy settings for all remote commands in all sessions

  • To set these proxy session options for all remote commands all Windows PowerShell sessions on the local computer, add the command that sets the $PSSessionOption preference variable to your Windows PowerShell profile. For more information about Windows PowerShell profiles, see about_Profiles.

See Also