' ********************************* ' Machine MAC and UUID Collection Script ' Purpose: ' To create importable csv files for use with SCCM 2012 ' Laurie Rhodes 2014 with code from Frank-Peter Schultz ' ' version 1.0 ' ' ********************************************** ' **************************** ' Declare Objects ' **************************** Dim WMI, oFSO, oNetwork set oWMI = GetObject("winmgmts:\\.\root\cimv2") set oFSO = CreateObject("Scripting.FileSystemObject") Set oNetwork = CreateObject( "WScript.Network" ) 'Create the Text File Set oFile = oFSO.OpenTextFile(oFSO.GetParentFolderName(WScript.ScriptFullName) &"\MachineImport.csv", 8, True) oFile.Write oNetwork.ComputerName & "," & GetUUID() & "," & GetMAC() & chr(13) & chr(10) oFile.Close Set oWMI = Nothing Set oFSO = Nothing Set oNetwork = Nothing ' **************************** ' Functions ' **************************** Function GetMAC() Dim MacAddress Dim Nads: set Nads = oWMI.ExecQuery("Select * from Win32_NetworkAdapter where physicaladapter=true") Dim nad for each Nad in Nads if not isnull(Nad.MACAddress) then MacAddress = Nad.MACAddress 'Wscript.Echo Nad.description, Nad.MACAddress next GetMAC = MacAddress End Function ' Functon provided by Frank-Peter Schultze ' http://www.out-web.net/modules/smartfaq/faq.php?faqid=261 Function GetUUID() Dim colItems, objItem, strUUID, blnValidUUID Set colItems = oWMI.ExecQuery("Select * from Win32_ComputerSystemProduct") strUUID = "" blnValidUUID = False For Each objItem in colItems strUUID = objItem.UUID If Not IsEmpty(strUUID) OR Not IsNull(strUUID) Then If (strUUID <> "00000000-0000-0000-0000-000000000000") AND _ (strUUID <> "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF") Then blnValidUUID = True Exit For End If End If Next If Not blnValidUUID Then Set colItems = GetObject("winmgmts:" & strComputer & "\root\cimv2").InstancesOf("Win32_NetworkAdapter") For Each objItem In colItems If (objItem.AdapterType = "Ethernet 802.3") Then If (objItem.Description <> "Packet Scheduler Miniport") Then strUUID = "00000000-0000-0000-0000-" & Replace(objItem.MACAddress, ":", "") Exit For End If End If Next Set NicSet = Nothing End If GetUUID = strUUID End Function