Posts

Showing posts with the label Network Testing

Script to Move a VM to a New Portgroup and Update its Network Identity

Hey everyone - I recently put together a script to make it easier to move a VM around between various networks.  It moves the VM onto the specified Port Group and then uses VMTools to run a PowerShell script in the guest (this is for Windows VMs only, sorry!) to update its IP/DNS/Gateway/etc.  Since my old Gist'ing technique isn't working any more, so it's below as simple text (and it's on my GitHub if you want to grab it that way). But first, let's break it down a little bit!  The bulk of this script is really straight-forward.  The most interesting bit is using the PowerCLI Invoke-VMScript cmdlet to do the work inside the target VM's OS (since this operation will break network connectivity).  Invoke-VMScript is, on the surface, similar to the core PowerShell cmdlet Invoke-Command... but they way that they operate is completely different under the covers!  The practical difference that made the most impact for me is that Invoke-Command allows access to th...

ESXi Host vSwitch Network Connectivity Validation

One of my customers is standing up a lot of new resources.  The Distributed vSwitch makes it really easy to configure the ESXi hosts correctly with all of the necessary VLANs, but how do you know that they're fully plumbed end to end?  The best thing that I can think of is to simply test it; stand up a VM on each Port Group and validate its network connectivity.  Of course, you've only got two or three VLANs to test, right?  Yeah, right.  This customer has a few dozen Port Groups to validate, and since I'm not interested in wearing out my mouse, I decided to script things. To accomplish this particular task, I actually wrote two scripts.  One of them is designed to run on a test VM and changes its network identity (IP Address and Default Gateway) and runs the ping test, the other runs on an administrator's workstation and changes the Port Group that the test VM is using.  After each script makes its required change, it prompts the administrator to pr...