Hi
I can't seem to find any features where it is possible to get the MAC address. Is there anything, or does anyone know of any other method?
Thanks
Adam
Get MAC Address
-
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: Get MAC Address
Dear Adam,
unfortunately InstallAware doesn't have any built-in command for that.
You may try to use the "GetAdaptersInfo" WIN API to programatically Get MAC address.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa365917(v=vs.85).aspx
Regards
unfortunately InstallAware doesn't have any built-in command for that.
You may try to use the "GetAdaptersInfo" WIN API to programatically Get MAC address.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa365917(v=vs.85).aspx
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Re: Get MAC Address
Adam,
I just noticed your post. If you're interested I wrote a plugin to get the MAC address. If you want it let me know.
I just noticed your post. If you're interested I wrote a plugin to get the MAC address. If you want it let me know.
Peter. Smartly dressed, he still resembles an unmade bed.
InstallAware MVP
InstallAware MVP
Re: Get MAC Address
Peter,
I am interested in your plugin to get MAC address.
Thank you.
-edan
I am interested in your plugin to get MAC address.
Thank you.
-edan
Re: Get MAC Address
Edan,
Give me a little time to recompile it and test it. For some reason, it's throwing an access violation. I'll need to do some debugging to see what's causing it. I'll come back to you hopefully tomorrow.
Give me a little time to recompile it and test it. For some reason, it's throwing an access violation. I'll need to do some debugging to see what's causing it. I'll come back to you hopefully tomorrow.
Peter. Smartly dressed, he still resembles an unmade bed.
InstallAware MVP
InstallAware MVP
Re: Get MAC Address
Peter,
Thank you for looking in to it. However,...
I found a way to do it using vbscript to write the MAC to an INI format file. From within my IA script I use "Run Program" to run the vbs script. I then use the IA "Get INI File Settings" command to pull the MAC into my install script.
The basics of the vbs script are as follows. If there is more than one enabled network adapter you need to figure out which MAC you want from the other information available within the colItems object.
Dim ObjWMI: Set ObjWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Dim colItems : Set colItems = ObjWMI.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
Dim adapterCFG, MACAddress
Dim objFSO, objFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
For each adapterCFG in colitems
objFile.WriteLine("[NetworkAdapter_" & adapterCFG.Index & "]")
objFile.WriteLine("Description=" & adapterCFG.Description)
objFile.WriteLine("MACAddress=" & adapterCFG.MACAddress)
Next
objFile.Close
Thank you for looking in to it. However,...
I found a way to do it using vbscript to write the MAC to an INI format file. From within my IA script I use "Run Program" to run the vbs script. I then use the IA "Get INI File Settings" command to pull the MAC into my install script.
The basics of the vbs script are as follows. If there is more than one enabled network adapter you need to figure out which MAC you want from the other information available within the colItems object.
Dim ObjWMI: Set ObjWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Dim colItems : Set colItems = ObjWMI.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
Dim adapterCFG, MACAddress
Dim objFSO, objFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
For each adapterCFG in colitems
objFile.WriteLine("[NetworkAdapter_" & adapterCFG.Index & "]")
objFile.WriteLine("Description=" & adapterCFG.Description)
objFile.WriteLine("MACAddress=" & adapterCFG.MACAddress)
Next
objFile.Close
Re: Get MAC Address
Edan,
Happy to read you did it using vbscript. In my plugin (c#) I use this namespace:
using System.Net.NetworkInformation
and I iterate through the collection using:
foreach(string pa in from ni in NetworkInterface.GetAllNetworkInterfaces() where ni.OperationalStatus == OperationalStatus.Up select ni.GetPhysicalAddress().ToString().Trim())
{
...
}
Otherwise, wmi works just as well.
Happy to read you did it using vbscript. In my plugin (c#) I use this namespace:
using System.Net.NetworkInformation
and I iterate through the collection using:
foreach(string pa in from ni in NetworkInterface.GetAllNetworkInterfaces() where ni.OperationalStatus == OperationalStatus.Up select ni.GetPhysicalAddress().ToString().Trim())
{
...
}
Otherwise, wmi works just as well.
Peter. Smartly dressed, he still resembles an unmade bed.
InstallAware MVP
InstallAware MVP
Who is online
Users browsing this forum: Bing [Bot] and 148 guests