EC Does Not Work When PowerShell Profile Configured for All Users

Prev Next

Issue

EC was successfully installed and had initial communication with Control over HTTPS and updated Host and version details to Control. However, EC state is still Offline in the Control.  

Initial Findings

  • All the required Ports and Protocols are in place between EC and Control 

  • EC is not able to create a secure WebSocket connection with Control for further communication.  

Troubleshooting 

During troubleshooting, we identified that for every PowerShell script executed by EC, EC was getting additional data which was not relevant as a result EC was unable to perform operations as expected.  

As an Example

EC was trying to generate a Secure WebSocket URL and expects the URL as: wss://control.workspot.com/ws/openPresigned?token=e00d90e0-9522-41e8-8664-7ab2ca879 to create a connection with Control.  

However, because of the PowerShell Profile, the EC was getting other information (because of the PowerShell profile) and the out URL had other data not relevant to EC to build wss connection with Control.

Reason

The Windows server where EC service was installed had PowerShell Profile ($PSHOME\Profile.ps1) configured for All Users and all Hosts and as a result, every PowerShell script executed by EC to perform those operations has unwanted data from the PowerShell profile. A PowerShell profile script runs as a startup script when PowerShell starts, interactive or non-interactive. For more details, please refer to the below link.  

https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-7.4 

Solutions

Delete the Profile.ps1 from $PSHOME (C:\Windows\System32\WindowsPowerShell\v1) location.