Jump to content


smmccarthy

Established Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by smmccarthy

  1. Intel provide a script as part of their vPro offering that can be used to automatically import the details into an SCCM collection from a target PC. This is available here: SCCMauto I have modded the script to allow the details to be appended to a csv file as I was having firewall issues when automatically importing the details into SCCM. Just insert the code into a .vbs file and run from a command prompt using the cscript command 'Create an object to connect to the local WMI provider Set objService = GetObject("winmgmts:\root\cimv2") 'Update the status on the screen wscript.echo "Looking up host name, FQDN, MAC & UUID..." 'Get the MAC, hostname & DNS information Set objNetwork = objService.ExecQuery ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled = True") for each objItem in objNetwork strMAC = objItem.MACAddress 'If the computer name was not passed as a command line argument, read it from the local WMI interface if strHostName="" then strHostName = Ucase(objItem.DNSHostName) end if if strDNSSuffix="" then strDNSSuffix = Ucase(objItem.DNSDomain) end if strDNSDomain = objItem.DNSDomain next 'Combine the computer name and DNS suffix to create the computer's FQDN strFQDN = Ucase(strHostName & "." & strDNSSuffix) 'Get the UUID Set objSysComps = objService.ExecQuery("Select * from Win32_ComputerSystemProduct") set objSysUUID = objService.ExecQuery ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled = True") for each objItem in objSysComps strUUID = objItem.UUID next 'Echo the values that will be added to the SCCM server wscript.echo wscript.echo "Host Name: " & strHostname wscript.echo "FQDN: " & strFQDN wscript.echo "MAC: " & strMAC wscript.echo "UUID: " & strUUID wscript.echo Dim Filename Dim OutputFile Filename = "PC-Details.csv" 'File to output results to Set objFSO = CreateObject("Scripting.FileSystemObject") If not objFSO.FileExists(Filename) then Set objFile = objFSO.CreateTextFile(Filename) Wscript.sleep(2000) 'Pause while file is being created End If 'If objFSO.FileExists(Filepath & Filename) then 'Set objFile = objFSO.GetFile(Filepath & Filename) 'Lastmodifieddate = objFile.DateLastModified Const ForAppending = 8 Set outputFile = objFSO.OpenTextFile(Filename, ForAppending, true) ' Open file for writing OutputFile.WriteLine strHostname & "," & strUUID & "," & strMAC'Write filename and last modified date to output file OutputFile.Close 'End If set objFSO = Nothing
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.