{"id":2771,"date":"2016-02-03T15:30:08","date_gmt":"2016-02-03T14:30:08","guid":{"rendered":"http:\/\/wordpress.networknet.nl\/?p=2771"},"modified":"2016-02-03T15:30:08","modified_gmt":"2016-02-03T14:30:08","slug":"powershell-hyper-v-switch-set-to-public-network","status":"publish","type":"post","link":"https:\/\/www.networknet.nl\/apps\/wp\/archives\/2771","title":{"rendered":"PowerShell: Hyper-V switch set to public network"},"content":{"rendered":"<p>\n\tWhen troubleshooting backup agent\/server communication I found the following situation on my Windows Server 2012 R2 Hyper-V host:\n<\/p>\n<p>\n\t<a href=\"https:\/\/www.networknet.nl\/apps\/wp\/wp-content\/uploads\/2016\/02\/Public-network-Hyper-V-switch.png\" rel=\"attachment wp-att-2774\"><img loading=\"lazy\" decoding=\"async\" alt=\"Public network - Hyper-V switch\" class=\"alignnone size-full wp-image-2774\" height=\"134\" src=\"https:\/\/www.networknet.nl\/apps\/wp\/wp-content\/uploads\/2016\/02\/Public-network-Hyper-V-switch.png\" width=\"609\" \/><\/a>\n<\/p>\n<p>\n\tMy virtual NIC adapter for Hyper-V switch and ManagementOS was set to &quot;<strong>Public network&quot;\/&quot;Unidentified network<\/strong>&quot;. I want to change this to <b>Domain<\/b> as there are several windows firewall rules that only allow inbound communication from internal domain network.\n<\/p>\n<h3>\n\tHow to resolve &quot;Unidentified network&quot;?<br \/>\n<\/h3>\n<p>\n\tOpen elevated PowerShell prompt\n<\/p>\n<pre class=\"brush:powershell\">\r\nGet-NetConnectionProfile<\/pre>\n<p>\n\tMy current setup shows NetworkCategory:Public. I want to change this to Domain.\n<\/p>\n<pre class=\"brush:powershell\">\r\nSet-NetConnectionProfile -InterfaceAlias &quot;vEthernet (vSwitch)&quot; -NetworkCategory Domain<\/pre>\n<div class=\"messageBox icon\"><span>Set-NetConnectionProfile : Unable to set NetworkCategory to &#39;DomainAuthenticated&#39;.&nbsp; This NetworkCategory type will be&nbsp;set automatically when authenticated to a domain network.\n<\/p>\n<p>\n\tAt line:1 char:1<br \/>\n\t+ Set-NetConnectionProfile -InterfaceAlias &quot;vEthernet (vSwitch)&quot; -NetworkCategory&nbsp; &#8230;+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br \/>\n\t+ CategoryInfo : InvalidArgument: (MSFT_NetConnect&#8230;A858C82FCC55}&quot;):root\/StandardCi&#8230;nnectionProfile) [Set-NetConnectionProfile], CimException<br \/>\n\t&nbsp;+ FullyQualifiedErrorId : MI RESULT 4,Set-NetConnectionProfile<\/span><\/div>\n<p>\n\tSoon I realized I could not change this and opened services.msc console from Run. I restart&nbsp;&quot;Network Location Awareness&quot; service and my problem was solved.\n<\/p>\n<p>\n\tThis issue probably started when I created new Hyper-V virtual switch. Reboot also may have helped to resolve this nevertheless the following command should be added to make sure &quot;NLA&quot; service finds the domain controller and sets the Network Profile properly.\n<\/p>\n<p>\n\tPowerShell command to restart the service:\n<\/p>\n<pre class=\"brush:powershell\">\r\nRestart-Service -Name NlaSvc -Force<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>When troubleshooting backup agent\/server communication I found the following situation on my Windows Server 2012 R2 Hyper-V host: My virtual NIC adapter for Hyper-V switch and ManagementOS was set to &quot;Public network&quot;\/&quot;Unidentified network&quot;. I want to change this to Domain as there are several windows firewall rules that only allow inbound communication from internal domain network. How to resolve &quot;Unidentified network&quot;? Open elevated PowerShell prompt Get-NetConnectionProfile My current setup shows NetworkCategory:Public. I want to change this to Domain. Set-NetConnectionProfile -InterfaceAlias &quot;vEthernet (vSwitch)&quot; -NetworkCategory Domain Soon I realized I could not change this and opened services.msc console from Run. I restart&nbsp;&quot;Network Location Awareness&quot; service and my problem was solved. This issue probably started when I created new Hyper-V virtual switch. Reboot also may have helped to resolve this nevertheless the following command should be added to make sure &quot;NLA&quot; service finds the domain controller and sets the Network Profile properly. PowerShell command to restart the service: Restart-Service -Name NlaSvc -Force<\/p>\n","protected":false},"author":2,"featured_media":1270,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[515],"tags":[787,398,822,821,42,820],"class_list":["post-2771","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell-microsoft","tag-hyper-v","tag-network","tag-network-location-awareness","tag-nlasvc","tag-powershell","tag-unidentified"],"_links":{"self":[{"href":"https:\/\/www.networknet.nl\/apps\/wp\/wp-json\/wp\/v2\/posts\/2771","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.networknet.nl\/apps\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.networknet.nl\/apps\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.networknet.nl\/apps\/wp\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.networknet.nl\/apps\/wp\/wp-json\/wp\/v2\/comments?post=2771"}],"version-history":[{"count":7,"href":"https:\/\/www.networknet.nl\/apps\/wp\/wp-json\/wp\/v2\/posts\/2771\/revisions"}],"predecessor-version":[{"id":2783,"href":"https:\/\/www.networknet.nl\/apps\/wp\/wp-json\/wp\/v2\/posts\/2771\/revisions\/2783"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.networknet.nl\/apps\/wp\/wp-json\/wp\/v2\/media\/1270"}],"wp:attachment":[{"href":"https:\/\/www.networknet.nl\/apps\/wp\/wp-json\/wp\/v2\/media?parent=2771"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.networknet.nl\/apps\/wp\/wp-json\/wp\/v2\/categories?post=2771"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.networknet.nl\/apps\/wp\/wp-json\/wp\/v2\/tags?post=2771"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}