We have a software license that locks it's use down to the mac address of the vmx file.In order to make deployments easier, a developer wrote a program that will edit the mac address in the vmx file to something taken from the host name and give us a way to track from that. The only issue is that the program works fine on a windows box (it just finds the vmx on your drive , makes the edit and closes) but the issue with that is we have 600 machines already deployed and copy the vmx files from vmfs to an ntfs drive, editing and send back would be painfull.
What I have suggested is if we could use a powershell script to run from the VC server, go through a list of machines and execute the previously written program . I just dont know how to accomplish this. any help is grealty appreciated!
Sounds like you are the sensible one
You should be able to do something similar to the following:
Get-VM 'MyVM' | Set-NetworkAdapter -NetworkAdapter "Network Adapter 1" -Mac "00:50:56:aa:aa:aa"
you will obviously want to read the mac addresses from a file or something similar to make sure you dont have a duplicate, I would suggest a csv file, let me know if you want the code for how to read the file and then set the mac from whats in there.
P.S. Im not infornt of a VI at the moment so make sure you test this
If you found this information useful, please consider awarding points for Correct or Helpful.
Alan Renouf
Alan, thanks for the advice - I knew there had to be a way to do it. So the was the developers program works is that it creates the mac address from the last digits of the machine name, for example if the machine's hostname is server06, then the mac becomes 00:50:56:aa:aa:06 server07 00:50:56:aa:aa:07 and so on...
Maybe I could run two scripts :
one to go down the list of servers and take their last digits and make new macs and add to a csv and one to add them? Its one thing that they have to be unique but they need to match the machine too for the proper license key.
Ahh, I see, then that should be quite easy, no need for 2 scripts. I will have a look at that and post an answer back, give me a few days as its now the weekend !
Alan Renouf
Alan,
That would be a great help to me.... it'll be a good learning exercise for me indeed!! I really appreciate the help.