0

I want to intercept PowerShell remote traffic. I want to use Titanium because I need to do some intermediate processing on the requests. When I launch the Titanium.Web.Proxy.Examples.Wpf app, out-of-the-box it intercepts all the browser traffic, but not PowerShell remote (Enter-PSSession -ConnectionUri http://localhost:5985/WSMAN/... etc.). I have found that I can see this traffic using Fiddler (requires a bit of tweaking), so I know the traffic can be intercepted. What needs to be done for or in Titanium that isn't happening "out-of-the-box"?

EDIT:

Additional notes:

  • I had seen Fiddler capture the WSMAN traffic on one occasion, but have been unable to reproduce it for reasons as yet unknown.

  • The final implementation will be in a C# assembly, using RunspaceFactory and WSManConnectionInfo, not PowerShell scripting; the Enter-PSSession command above was for illustrative purposes only.

  • When uri is specified as http://127.0.0.1:5985/WSMAN and ProxyAccessType of anything other than None is specified for WSManConnectionInfo, the following exception is thrown: System.Management.Automation.Remoting.PSRemotingTransportException: 'Connecting to remote server 127.0.0.1 failed with the following error message : The WinRM client cannot process the request. Setting proxy information is not valid when the HTTP transport is specified.

C Robinson
  • 411
  • 4
  • 18
  • After the application has started, try `$session = New-PSSession ... -SessionOption (New-PSSessionOption -ProxyAccessType AutoDetect)` (try `IEConfig` as the `-ProxyAccessType` option if auto detect doesn't work) – Mathias R. Jessen Sep 01 '20 at 17:17
  • @MathiasR.Jessen Actual usage is from C# where we do: `new WSManConnectionInfo(psUriBuilder.Uri, ExchangeShellSchema, credentials) { AuthenticationMechanism = AuthenticationMechanism.Basic}`; if I add `ProxyAccessType = ProxyAccessType.AutoDetect` (or anything other than `None`), I get System.Management.Automation.Remoting.PSRemotingTransportException: 'Connecting to remote server 127.0.0.1 failed with the following error message : The WinRM client cannot process the request. Setting proxy information is not valid when the HTTP transport is specified. (for Uri ttp://127.0.0.1:5985/WSMAN) – C Robinson Sep 01 '20 at 18:54

0 Answers0