Set objSysInfo = CreateObject(“ADSystemInfo”) Model = trim(replace(objComputer.Model, “,”, “.”)) Manufacturer = replace(objSMBIOS.Manufacturer, “,”, “.”)įor Each objComputer in objWMI.ExecQuery(“Select * from Win32_ComputerSystem”) ServiceTag = replace(objSMBIOS.SerialNumber, “,”, “.”) ‘ Get service tag and computer manufacturerįor Each objSMBIOS in objWMI.ExecQuery(“Select * from Win32_SystemEnclosure”) Set objWMIService = GetObject("winmgmts:" _ StrDescription = strDescription & " Monitor " & intMon + 1 & ": " & arrMonitors(intMon) So if you are tired of manually doing an inventory, let’s automate some stuff!įor intMon = LBound(arrMonitors) To UBound(arrMonitors)
This makes it incredibly easy to find serial numbers in Active Directory! As a final result, you can look at any computer in your domain and see the information in the Description field. It will then store both pieces of information in that computer’s Active Directory account. This script will query for our computer’s serial number (or service tag) and will also grab the unique ID associated with an attached monitor. Now that Active Directory can tell us what computer models we have (and how many we own), it is time to extend our inventory! Today, we are going to implement one shutdown that script with Group Policy.
Creating an Inventory with Active Directory