• This guide will show you a quick way to see which Virtual Machine NIC is connected to which Virtual Switch in Hyper-V. This is particularly helpful for VMs that have two or more virtual network adapters.

  • Hi, David.

    If you have a list of servers and their NICs, you a command like below to rename the NICs you want to make changes to, and then run the function explained here based on that Interface Alias.

    Get-NetAdapter -CimSession ServerX | where MacAddress -Like AB-CD-EF* | Rename-NetAdapter -NewName "NoIpForYou"

    If you only want to disable DNS registration on certain Mac Addresses you already have, you could even ditch the function and do something like this:

     Set-DnsClient -InterfaceIndex $((Get-NetAdapter  -CimSession ServerY | where MacAddress -Like AB-CD-EF*).ifIndex) -RegisterThisConnectionsAddress $false

  • Hi, Checker33. Thank you for the feedback, I am glad you found this useful.

    Yes, you may include the function in a custom PowerShell Module that you can load manually or automatically in your PowerShell console, editor etc. If the previous sentence sounds intimidating, create a new file with the extension ".psm1" (like "MyCustomfunctions.psm1"). Paste the code from this post in the psm1 file, and save it. When you want to run the function, import the module (Import-Module 'C:tempMyCustomfunctions.psm1") and then the function will be available.

    You may also save as a normal PowerShell script file (PS1), and then reference it using the . (dot). Yes, the command begins with a dot followed by a space and then the path to the PS1 file.

    . "C:tempMyCustomfunctions.ps1"

    If you're interested in more details, I could write a post on how to do this (both manually or automatically).

    Cheers. Emanuel

  • Don't you hate it when you get to the office and discover you lost your house keys? You go desperately through all your pockets, but they are nowhere to be found. With a sigh, you are about to go digging through all the lost crannies in your bag when the boss pops in and reminds you that those application servers need their public-facing NICs moved to a new address space.

  • Emanuel Halapciuc changed their profile picture 1 year, 3 months ago

© 4sysops 2006 - 2021


Please ask IT administration questions in the forums. Any other messages are welcome.


Log in with your credentials


Forgot your details?

Create Account