Tag: Windows

DNS commands (Command Prompt vs PowerShell)

Recently I discovered Windows PowerShell has the ability to clear the local DNS on a machine, just like the traditional Command Prompt. Below is a table of the most common commands I personally use on a day-to-day basis and its PowerShell equivalent(s). Of course there are more PowerShell cmdlets, see the URL below for the complete list.

Command Prompt PowerShell Description
ipconfig /flushdns Clear-DnsClientCache Clears the contents of the DNS client cache.
ipconfig /registerdns Register-DnsClient Registers all of the IP addresses on the computer onto the configured DNS server.
ipconfig /displaydns Get-DnsClientCache Retrieves the contents of the DNS client cache.
 

(more…)

Advertisements

Flush DNS Cache with PowerShell

For years I have always been using Windows’s command prompt to flush the DNS cache on a local machine. As we know, that command is pretty well known, “ipconfig /flushdns“. Turns out there is an equivalent command we can run within the PowerShell console, and that is, “Clear-DnsClientCache“. Clear-DnsClientCache does exactly what it states, it clears the contents of the DNS client cache/local machine. Consider this next time you need to flush the local machine’s DNS cache.

Clear-DnsClientCache

Exporting and Importing VMs in Hyper-V 2012R2

Let’s say you have a Virtual Machine on one Hyper-V server, and need to migrate it over to another Hyper-V server. For whatever reasons, end of life on the existing server, different data center, etc. Of course this is one of the many good reasons why having a clustered Hyper-V environment is the way to go, but this post is not about that. So, let’s get to it.

 

  • First, shutdown your VM and determine a destination to store the VM. Simply shutdown the VM within the Hyper-V console, and right-click and select Export. Once you define this, you can track its progress. Depending on your storage, how big the VM is, Hyper-V server specs, etc. this could take a few minutes…

1

2

3

  • Next, copy the VM data (you just exported) to the new Hyper-V server or some storage location. Again, based on your environment, network, server etc., this could take a few minutes.

4

  • Next, on your (new) Hyper-V server, launch the Hyper-V console, and select Import. Browse to the location where the VM being imported resides.

5

6

  • When selecting the Import Type, I chose the third option (Copy the virtual machine (create a new unique ID))

8

  • Now you can set the location of the VMs properties, or leave them defaulted to your Hyper-V servers settings.

9

  • Depending on your VM/Hyper-V server, you may have had some fancy properties, like a virtual switch. In my case I did, and on the new Hyper-V server I did not have the same virtual switch, or at least not the same name. You can either create the Network Switch your VM requires, or select “Not Connected” and finish this task later.

10

  • Now you can go ahead and finish the import process, and allow the new machine to be officially imported on your new Hyper-V hypervisor. Again, based on your environment, this may take a few moments, so go get another coffee, and enjoy!

11