Retrieve MAC Address from SCVMM

Posted by Christian Jung on Mon, Nov 20, 2017

Purpose of this document

To provision Virtual Machines from CloudForms or ManageIQ by utilizing the Foreman, the MAC Address of the new system has to be specified. Due to this Bugzilla, the MAC address is unfortunately not in the VMDB right now.

I wrote a small script which uses WinRM and PowerShell to retrieve the MAC address and store it in the State Machine. How to store and retrieve variables has been documented before in the article Preserve data in ManageIQ state machines A modified version of the register_foreman script fetches the MAC address from the variable, instead of the actual Virtual Machine.

An Automate Domain containing both changes can be found on GitLab.

How it works

The provided method is supposed to be part of the VM provisioning state machine for SCVMM. It will retrieve the MAC address from the SCVMM provider by using PowerShell. The returned MAC address is stored in a state variable so it can be retrieved later.

The VM Provisioning state machine has the following modifications:

  • Disable VM auto start (microsoft_CustomizeRequest)

  • Retrieve MAC Address from SCVMM (get_mac)

  • Register VM in Foreman/Satellite 6 (register_foreman)

As said before, after the Bugzilla is fixed, the get_mac method should not be necessary anymore.