esSJae's Virtualization Blog

Virtualization and other IT topics

Archive for February, 2016

Switching from Public to Private network via PowerShell

Posted by essjae on February 11, 2016

Here’s a quick way to get rid of the “public” network on Windows and switch it to a more usable private network type.

    1. Open a PowerShell Window.
    2. Get the list of network profiles on the system.  Note the InterfaceIndex number listed, you’ll need it for the final step.
      Get-NetConnectionProfile
    3. Change the network interface to private, use the network interface index number from the previous command.
Set-NetConnectionProfile -InterfaceIndex xx -NetworkCategory Private

Posted in Networking, Windows 2012 | Tagged: , , , | Leave a Comment »

Running Hyper-V Manager as a different user in Windows 10 (Runas)

Posted by essjae on February 10, 2016

I hit a small issue while working on building up a test SCCM/SCVMM lab in Hyper-V.

My primary system (call it One) has Windows 10 and is domain joined, but I’ve been doing the “Microsoft” thing and logging in with my “Microsoft” account instead of my local domain account.

I’ve got two Hyper-V hosts, one on Windows Server 2012 R2 and another running on Windows 10* (call it Two).  I’ve been able to launch my Hyper-V Manager on One and connect and manage the Hyper-V VMs on Server 2012.

However, I hit a roadblock trying to connect to Two.  The first thing I tried after failing and getting some error messages was to configure winrm.

On Two:

I opened an administrator PowerShell window and ran

winrm quickconfig

and followed the wizard and was able to start the winrm service and open the firewall.

On One:

Again in a administrator PowerShell window, I ran:

Enable-WSManCredSSP -role client -delegatecomputer two.mydomain.com

Failure!  I got a big text message in red that said to run winrm quickconfig.

This is odd, since I did none of this to connect to the Server 2012 Hyper-V instance.

I then shift+right-clicked on Hyper-V Manager and ran it with my domain credentials and it ran! Ah ha!  No problem, just create a runas shortcut for Hyper-V Manager.

C:\Windows\System32\runas.exe /user:mydomain\myusername /savecreds "%windir%\System32\mmc.exe "%windir%\System32\virtmgmt.msc""

Again, no joy.  Launching my new short-cut from a command prompt showed the error:

740: The requested operation requires elevation.

The command needs ADUC elevation, with some Googling** I finally found a solution, first launch a cmd prompt and then the command.  This allows you to receive the ADUC prompt and accept it.

C:\WINDOWS\system32\runas.exe /savecred /user:mydomain\myusername "cmd /c Start /B %windir%\System32\mmc.exe "%windir%\System32\virtmgmt.msc""

The path to the Hyper-V Manager icon is here:

%ProgramFiles%\Hyper-V\SnapInAbout.dll
...
*I don’t recall my logic in installing Windows 10 here instead of Server 2012…it may have just been laziness, an upgrade to Win10 from the previous Windows 8.1 OS that was installed.

 

**http://serverfault.com/questions/374342/run-active-directory-admin-center-as-another-user

Posted in Hyper-V, Uncategorized, Virtualization, Windows 10, Windows 2012 | Tagged: , , , , , , , | 1 Comment »