Tome's Land of IT

IT Notes from the Powertoe – Tome Tanasovski

Enable Powershell Remoting While Running VMWare Workstation in a Domain

Ugh…. What a headache.  I attempted to enable Powershell remoting on my workstation this morning in order to test out some deployment scripts I have ideas for.  Unfortunately while doing this I received the below message:

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. At line:50 char:33 + Set-WSManQuickConfig <<<< -force + CategoryInfo : InvalidOperation: (:) [Set-WSManQuickConfig], InvalidOperationException + FullyQualifiedErrorId : WsManError,Microsoft.WSMan.Management.SetWSManQuickConfigCommand 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. At line:50 char:33+ Set-WSManQuickConfig <<<< -force + CategoryInfo : InvalidOperation: (:) [Set-WSManQuickConfig], InvalidOperationException + FullyQualifiedErrorId : WsManError,Microsoft.WSMan.Management.SetWSManQuickConfigCommand

It appears that the VMWare Workstation NICs that get added to your system take on the public network profile.  One would think this would be easy to fix…. load up control panel->network-> and make the switch.  It is that easy unless you are on a domain.  When you are on a domain the option is not available to you.  After some digging I found this article that discusses how to change these settings using a COM object through Powershell, but the script does a check to ensure that the computer is not on the domain before it makes the change.  I decided to go head first and try it out on the non-domain connected NICs, and I found that it worked like a charm.

Here is the script that will change all public profile NICs to become Work Network NICs:

$nlm = [Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]"{DCB00C01-570F-4A9B-8D69-199FDBA5723B}"))
$connections = $nlm.getnetworkconnections()
$connections |foreach {
    if ($_.getnetwork().getcategory() -eq 0)
    {
        $_.getnetwork().setcategory(1)
    }
}

Afterwards I was able to enable remoting with no problem.

About these ads

18 responses to “Enable Powershell Remoting While Running VMWare Workstation in a Domain

  1. IonutN March 27, 2010 at 3:24 pm

    Oh boy, was this post like music to my ears. thanks for sharing, most useful

  2. mradios October 22, 2010 at 3:18 pm

    Beautiful, I was almost to give up. Thanks for sharing. @_@

  3. Simon Lampen November 4, 2010 at 4:24 pm

    Thanks Tome, worked a treat!

  4. Martin April 20, 2011 at 9:51 am

    Good fix. Thanks for posting it.

  5. Boracay July 30, 2011 at 2:10 am

    I’m not sure where you’re getting your information, but good topic. I needs to spend some time learning more or understanding more. Thanks for wonderful info I was looking for this info for my mission.

  6. billywiz January 3, 2012 at 12:38 pm

    Worked like a charm, thanks for sharing

  7. pppp May 3, 2012 at 10:17 am

    more than 2 years later…still usefu :-)

  8. NickC May 19, 2012 at 4:15 am

    Thank you SO much for this! Massive help and works a treat.

  9. fussmonkey June 26, 2012 at 2:11 pm

    First result in my first search to resolve the problem… thanks for the post!

  10. knutkj August 7, 2012 at 8:57 am

    You may also disable all the VMware network adapters. Open | Control Panel | Network and Internet | Network Connections | . Right click all VMware network adapters and click disable.

  11. Trevor Sullivan August 22, 2012 at 4:41 pm

    Thanks — this worked for me!

  12. Abs August 24, 2012 at 5:22 am

    I was loosing my mind over this! Thanks a lot for posting the code.

  13. Todd September 20, 2012 at 7:40 am

    Cool, this worked like a charm, thank you sir.

    T

  14. Tom Strader October 10, 2012 at 12:57 pm

    Excellent, thank you for sharing.

  15. Maxx Velocity January 3, 2014 at 3:11 pm

    This is awesome, thank you!

  16. Steve Rackham March 2, 2014 at 5:36 pm

    Hi All, you can also use the -SkipNetworkProfileCheck switch.
    Introduced in PS 3.0..

    Enable-PSRemoting -SkipNetworkProfileCheck

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 33 other followers

%d bloggers like this: