5

I have a collection of Windows 8.1 machines that run Hyper-V for unit testing. We often use PowerShell to script changes to these systems to ease our administration. However, we've been having trouble enabling powershell remoting on these machines.

We run the following command on these machines to attempt powershell remoting enabling

Enable-PSRemoting -force

But we always get the following error:

WinRM firewall exception will not work since one of the network connection types on this machine is set to Public. Change the network connection type to either Domain or Private and try again.

The network adapters Are as follows:

Name             : Network  2
InterfaceAlias   : vEthernet (Broadcom NetXtreme Gigabit Ethernet)
InterfaceIndex   : 13
NetworkCategory  : Private
IPv4Connectivity : Internet
IPv6Connectivity : LocalNetwork

Name             : Unidentified network
InterfaceAlias   : vEthernet (Windows Phone Emulator Internal Switch)
InterfaceIndex   : 10
NetworkCategory  : Public
IPv4Connectivity : NoTraffic
IPv6Connectivity : NoTraffic

I tried running the following scripts to set the unidentified network to be private

Set-NetConnectionProfile -name "Network  2" -NetworkCategory private
Set-NetConnectionProfile -name "Unidentified Network" -NetworkCategory private 

However these scripts work for the duration of the machine's uptime, but when the machine reboots, the Unidentified network reverts back to the public.

Why is this resetting, and how can I get the scripted change to persist?

Thanks!

3
  • 2
    "Unidentified Network" is why. Windows sees it as a new network each time and doesn't remember that it is the same "Unidentified" one that was there before. Easiest workaround it just to run a startup script that will rerun these commands.
    – Moshe Katz
    Jan 16, 2014 at 19:51
  • If all you really want to do is to enable psremoting you could use add the -Force parameter to the Enable-PSRemoting cmdlet, even though the firewall rule won't open up to traffic with the emulator switch. Jan 20, 2014 at 15:20
  • I am using the -Force flag w/ PSRemoting cmdlet, still get the error.
    – Richthofen
    Jan 21, 2014 at 14:25

2 Answers 2

4

You can exclude certain nics from NLA (Network Location Awareness). Very common to do this in VMware workstation scenarios since the VMware nics always end up as unidentified/public. Here's how:

  1. Navigate to:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}
  2. You will find enumerated keys like 0000, 0001, 0002 and so on.
  3. Expend them one by one and look for DriverDesc REG_SZ value data.
  4. In the same registry key where you found the name of the nic to exclude (DriverDesc value), create another new DWORD Value, name it *NdisDeviceType (it Case Sensitive!!). Double click on this value and in "Value Data" field put 1 as Decimal data

(snipped from) http://www.petri.co.il/forums/showthread.php?t=45181

0
3

You can set all unidentified networks as private via Group Policy:

gpedit.msc > Computer Configuration > Windows Settings > Security Settings > Network List Manager Policies > Unidentified Networks > Location type: Private

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .