Product: PowerShell Studio 2021 (64 Bit)
Build: v5.8.192
OS: Windows 10 Enterprise (64 Bit)
Build: v10.0.19041.0
PS Version: 5.1.19041.1023
I have a simple script with a GUI front end that runs as me, it runs when I package to an EXE as me, or runs if I login as the Service Account and run it. It does not run when I put the "Run As Account" option in the Packager Build under alternate credentials, run mode - RunAs user. I have successfully used this option on other scripts.
On this script I get the following error when trying to use the RunAs user. The script works when I am logged in as the user, but not when running under another user account with this RunAs option. Here is the error:
[localhost] Connecting to remote server localhost failed with the following error message : The WSMan service could not launch a host process to process the given request. Make sure the WSMan provider host server and proxy are properly registered. For more information, see the about_Remote_Troubleshooting Help topic.
Using Alternate Credentials with RunAs user mode results in WSMan service error
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
Re: Using Alternate Credentials with RunAs user mode results in WSMan service error
Apologies, but we cannot investigate or solve local permission problems.
Your problem is likely related to this:
https://devblogs.microsoft.com/powershe ... owershell/
Your problem is likely related to this:
https://devblogs.microsoft.com/powershe ... owershell/
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Using Alternate Credentials with RunAs user mode results in WSMan service error
I appreciate your reply, but I am confused that I am getting this error because I am not using any ps remoting commands.
The only commands I am using in the script are:
Get-RDConnectionBrokerHighAvailability
Set-RDSessionCollectionConfiguration
Get-RDSessionCollectionConfiguration
The script works when I don't use the RunAs run mode under Output settings. When I add the RunAs user Run Mode, that's when I'm getting this error.
The only commands I am using in the script are:
Get-RDConnectionBrokerHighAvailability
Set-RDSessionCollectionConfiguration
Get-RDSessionCollectionConfiguration
The script works when I don't use the RunAs run mode under Output settings. When I add the RunAs user Run Mode, that's when I'm getting this error.
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
Re: Using Alternate Credentials with RunAs user mode results in WSMan service error
Once again, apologies, but we do not have access to your script, packaged or unpackaged, the profile of the user in question, your group policies, login scripts etc.
Your local event logs maybe of some more help. There is also PowerShell's script block logging, which would indicate if any PowerShell remoting commands are executed from somewhere.
Needless to say, we also do not have access to your event logs
Your local event logs maybe of some more help. There is also PowerShell's script block logging, which would indicate if any PowerShell remoting commands are executed from somewhere.
Needless to say, we also do not have access to your event logs
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Using Alternate Credentials with RunAs user mode results in WSMan service error
As you can see you are using remoting and local loopback as the article link from Alex references. The RD Connection manager is a remoting method which can use the loopback connector. Also various filters like AV net filters may force all remote connections through the loopback connector and the session broker is likely acquired by polling the fist time it is executed in a new user session.jmrusnak wrote: ↑Fri Aug 13, 2021 11:30 am I appreciate your reply, but I am confused that I am getting this error because I am not using any ps remoting commands.
The only commands I am using in the script are:
Get-RDConnectionBrokerHighAvailability
Set-RDSessionCollectionConfiguration
Get-RDSessionCollectionConfiguration
The script works when I don't use the RunAs run mode under Output settings. When I add the RunAs user Run Mode, that's when I'm getting this error.
There may even be more nuances to how the remote session is built so I suggest that you proceed by inspecting the patch.
Clearly the issue is not the code usage at least as you have described it. The PS engine you are using is the PowerShell host engine which is the same as PowerShell CLI with your script as the interface presentation and just some security wrappers and checks.
Good luck.