Windows firewall against PowerShellUniversal service don't work

I’m trying to open port 80 and 443 to the PowerShellUniversal service but it don’t seem to work - am I missing something here?

PSU 2.7.4

Hi rstolpe,

Are you running the service on the default port of 5000? If so, have you added that port to incoming connections for Universal.Server.exe?

That’s done in appsettings.json

If I open port 443 and 80 it works but I want to isolate it to the PSU service

Yes. I was able to make this work on port 80. However, please be sure that you don’t have any other applications which might be occupying those ports.

  1. Edited appsettings.json to set the port to 80.
  2. Restarted the PowerShellUniversal service.
  3. Created below firewall rule for the ‘Private’ network profile. Without this rule in place, I was not able to connect.
New-NetFirewallRule -Name 'Allow PWU' -DisplayName 'Allow PWU' -Direction Inbound -Program 'C:\Program Files (x86)\Universal\Universal.Server.exe' -Protocol TCP -Localport 80 -Profile Private

  1. Connected with web browser using http[:]//ip_address without needing to specify the port

I see it was to the program and not the service that you did

My mistake. After taking a closer look, I was able to recreate your issue. It turns out we need to set the security identifier of the service to unrestricted[1] per below. Please let me know if this helps.

sc sidtype PowershellUniversal UNRESTRICTED

New-NetFirewallRule -Name 'Allow PWU' -DisplayName 'Allow PWU' -Direction Inbound -Service 'PowershellUniversal' -Protocol TCP -Localport 80 -Profile Private

[1] Create an Inbound Program or Service Rule (Windows) - Windows security | Microsoft Docs


1 Like