Using Windows PowerShell to change the VM-Switch assigned to Virtual Machine’s (Windows 2012, Windows 8)

Recently I’ve been trying to do some lab setup for a demonstration. One of the constant changes I do is creating and deleting VM’s in my laptop and creating various Network switches for VM’s. Now assigning a VM-Switch to a virtual machine can be easy task by using GUI but it can be painful it you’ve to go through each VM’s settings page and selecting the correct VM-Switch. You’ll get the idea if you’ve been managing more than 10-15 VM’s in your lab setup like I do Smile


(My HYPER-V console in the laptop)


(VM-Switch I’ve created for various labs)


Now using PowerShell we can assign VM-Switch to selected number of VM’s in one parameter or to entire VM’s in my laptop in one go. Now this reminds me the famous quote in Spiderman movie “Great power comes with great responsibilities” Smile Anyway we’ll use the power carefully in the PowerShell.

Now assuming I want to change only selected VM’s VM-Switch to “PrivateNetwork” I can run the PS command as follows,

Connect-VMNetworkAdapter -VMName Demo-WIN2008R2-DC,Demo-WIN2008R2-SRV1,DEMO-WIN2008R2-SRV2 –Switch PrivateNetwork


Assuming I want to change all VM’s VM-Switch name to “VMSW01” all I have to do is type the following command,

Connect-VMNetworkAdapter –VMName * –SwitchName VMSW01 

Note: I found out in your VM-Switch naming convention if you keep spaces and use that VMM-Switch name in PowerShell it won’t work. This is something I yet to find out.

Active Directory monitoring and health checkup

As system administrators most of us spend time on end user problem troubleshooting and forget to oversee the Active Directory services. We only concern about the AD server when we’re getting problems and then we see all sort of problems related to DNS, replications…etc. This guide is focus on providing proactive monitoring of the Active Directory so as system administrators you will have better understanding of your infrastructure.

Is it best recommended to do the following test once a month and keep the log files for trend analysis as well. To make thing easier I’ve provided the necessary urls of individual commands pointing to the TechNet so you can get more compressive details,

Dcdiag.exe /v >> c:\temp\pre_dcdiag.txt

This is a must and will always tell you if there is trouble with your DCs and/or services associated with it

Netdiag.exe /v >> c:\temp\pre_Netdiag.txt

This will let us know if there are issues with the networking components on the DC. This along with the post test also is a quick easy way to ensure the patches installed is really installed (just check the top of the log)

Repadmin /showreps >> c:\temp\pre_rep_partners.txt

This shows all the replication and if it was successful or not. Just be aware that Global Catalogs will have more info here than a normal domain controller.

repadmin /replsum /errorsonly >> c:\temp\pre_repadmin_err.txt

This is the one that always takes forever but will let you know who you are having issues replicating with.

Apart from that Microsoft offers another tool called MPSRPT_DirSvc.exe. You can run this tool in the dc’s and it’ll run most of the above mention commands and provide you the output into log files. Very handy I would say. You can download it from here.

Hopefully this helps you when you troubleshoot your domain controllers but by no way is this all encompassing list of things to do. These are the standard steps normally I take but I would love to hear what you all do as well.

Adding workgroup HYPER-V host to SCVMM console

I have been actively engaging with a customer for a HYPER-V project. One of the key requirements is to test the features in the SCVMM. So first task is to install the SCVMM. Piece of cake went smoothly inside a HYPER-V guest OS.  Now adding the physical host to the SCVMM console. Well it supposed to be few easy clicks and finish the job right?…..well no it isn’t if you have your HYPER-V host in a workgroup environment.  In my scenario customer had several HYPER-V guest pc’s in domain environment but the physical PC itself in workgroup environment.

Finally found workgroup mode HYPER-V host can be added to the SCVMM console by selecting perimeter network mode. Under this mode you’ll need to create a secret shared key between the host and the SCVMM console. This might be a typical scenario if a customer wants to host several HYPER-V guests in DMZ zone. (Eg: WEB servers, DNS servers…etc)

The step by step guide article is located here

Windows 2012 data de-duplication

Windows 2012 (aka Windows 8) has been making big buzz in the IT industry and seems like Microsoft want it to be like that. Personally I feels like every Windows version always gives the new excitement feeling and curiosity.

Anyway back to the track to talk about one of the feature in the upcoming Windows 2012 which I find really cool “Data de-duplication” Now I can keep on writing more and more words about it but again I guess a video would do the work with little bit of info here and there through a PPT.

You can download the PPT file from here. Video can be access from here.

Apart from that always refer this link for the up-to-date information.