Set-VMNicAddress without user input?

Dec 22, 2011 at 9:42 PM



I just stumbled across this libary, and man is it fantastic!  My life is getting easer already!

But...Is there a way to use SetVMNicAddress without requiring user input?  I have several VMs that have multiple NICs, and I need to be able to change the mac on a specific NIC programatically. In other words, I am calling this command from my own program, and I just need it to execute without prompting for input.  The example in the manual says this:

Set-VMNICAddress $core (Select-vmNic $core) "00155D010101"

When the sub-component executes (Select-VmNic $core), it prompts me to choose which nic I want to modify.  I would like to be able to just hardcode which nic I want in the command structure, so no user input is required.  Is this possible?  If so, please provide an example of how. 

I am guessing that, if this IS possible, it would require specifying a GUID or something for the Nic.  If so, please advise on how to determine the guid for an existing Nic.  When I do the following:

Get-VMNic "VMName", I am returned the list of Nics, and there is a column for ID, but it only shows "{...", so I dunno.  :)



Dec 22, 2011 at 10:53 PM

Ok, so to add to my previous question, I did figure out how to get the ID of a given NIC, (looks like {d7c49b36-cdac-48ad-85a0-a2a33834c1c4}) but I can't figure out how to integrate that into the command line.  So, original question still stands.