Eanable-PSRemoting -Force

Howtogeek.com states that the command Enable-PSRemoting -Force starts the WinRM service and creates a firewall rule that allows incoming connections. Is the statement wrong?
I had to manualy enable port 5985 in the Windows Defender Firewall to get remoting working.

The statement on howtogeek.com is correct, there must be something else wrong with your PC

	<# MSDN: The Enable-PSRemoting cmdlet performs the following operations:
	Runs the Set-WSManQuickConfig cmdlet, which performs the following tasks:
	1. Starts the WinRM service.
	2. Sets the startup type on the WinRM service to Automatic.
	3. Creates a listener to accept requests on any IP address.
	4. Enables a firewall exception for WS-Management communications.
	5. Creates the simple and long name session endpoint configurations if needed.
	6. Enables all session configurations.
	7. Changes the security descriptor of all session configurations to allow remote access.
	Restarts the WinRM service to make the preceding changes effective.
	#>

That list do not include opening port 5985 for TCP communication.

Wsman is http port 5985 by default

Are you using windows firewall in control panel or in GPO?

I am changing the firewall using the Windows 10 Control Panel

Is your current network profile public or private?

Keep in mind that it won’t work on public profile with default setup.

1 Like

And to further complicate matters, there are multiple Firewall Polcy “Store” locations. I put together a script a while back to punch the right holes in the firewall for both WMI and PSRemoting and was amazed to find all these locations for firewall settings.

-PolicyStore

Targets the policy store from which to retrieve the rules to be enabled. A policy store is a container for firewall and IPsec policy. The acceptable values for this parameter are:

    PersistentStore: Sometimes called static rules, this store contains the persistent policy for the local computer. This policy is not from GPOs, and has been created manually or programmatically (during application installation) on the computer. Rules created in this store are attached to the ActiveStore and activated on the system immediately.
    ActiveStore: This store contains the currently active policy, which is the sum of all policy stores that apply to the computer. This is the resultant set of policy (RSOP) for the local computer (the sum of all GPOs that apply to the computer), and the local stores (the PersistentStore, the static Windows service hardening (WSH), and the configurable WSH). ---- GPOs are also policy stores. Computer GPOs can be specified as follows. ------ -PolicyStore hostname. ---- Active Directory GPOs can be specified as follows. ------ -PolicyStore domain.fqdn.com\GPO_Friendly_Namedomain.fqdn.comGPO_Friendly_Name. ------ Such as the following. -------- -PolicyStore localhost -------- -PolicyStore corp.contoso.com\FirewallPolicy ---- Active Directory GPOs can be created using the New-GPO cmdlet or the Group Policy Management Console.
    RSOP: This read-only store contains the sum of all GPOs applied to the local computer.
    SystemDefaults: This read-only store contains the default state of firewall rules that ship with Windows Server® 2012.
    StaticServiceStore: This read-only store contains all the service restrictions that ship with Windows Server 2012. Optional and product-dependent features are considered part of Windows Server 2012 for the purposes of WFAS.
    ConfigurableServiceStore: This read-write store contains all the service restrictions that are added for third-party services. In addition, network isolation rules that are created for Windows Store application containers will appear in this policy store. The default value is PersistentStore. The Set-NetFirewallRule cmdlet cannot be used to add an object to a policy store. An object can only be added to a policy store at creation time with the Copy-NetFirewallRule cmdlet or with the New-NetFirewallRule cmdlet.

Type:	String
Position:	Named
Default value:	None
Accept pipeline input:	False
Accept wildcard characters:	False
1 Like

My network profile is Private