me again lol
right after a bit more fiddling it now logs ram as well
to get it working as a startup script i created a group and added all the pcs in ad to it. I then used delegate control at domain level to give that group access to read/write the description aribute of active directory. Then i assigned it as a startup script and on reboot ad starts to populate with a quick pc inventory looks like this
Make: FUJITSU SIEMENS Model: ESPRIMO Edition Ram: 959 MB Serial No: xxxxxxxxxx MAC Addresses: 12:12:12:12:12:12
Code:
Option Explicit
On Error Resume Next
Dim objRootDSE, objNetwork, objWMIService, objComputer, objWMIServiceRam
Dim strComputer, strMake, strModel, strSerialNumber, strMacAddresses, strMsgRam
Dim colBIOS, objBIOS
Dim colNetworkAdapterConfiguration, objNetworkAdapterConfiguration
Dim colComputerSystem, objComputerSystem
Dim adoConnection, adoRecordset
dim wbemServices, wbemObjectSet, wbemObject
strComputer = "."
strMsgRam = ""
strMake = ""
strModel = ""
strSerialNumber = ""
strMacAddresses = ""
Set objRootDSE = GetObject("LDAP://RootDSE")
Set objNetwork = WScript.CreateObject("WScript.Network")
Set objWMIService = GetObject("Winmgmts:\\" & strComputer & "\root\cimv2")
Set objWMIServiceRam = GetObject( "winmgmts://" & strComputer & "/root/cimv2" )
Set wbemServices = GetObject( "winmgmts://" & strComputer )
Set wbemObjectSet = wbemServices.InstancesOf( "Win32_LogicalMemoryConfiguration" )
Set colComputerSystem = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem")
If Not colComputerSystem Is Nothing Then
For Each objComputerSystem In colComputerSystem
strMake = objComputerSystem.Manufacturer
strModel = objComputerSystem.Model
Next
End If
Set colBIOS = objWMIService.ExecQuery("Select * From Win32_BIOS")
If Not colBIOS Is Nothing Then
For Each objBIOS in colBIOS
strSerialNumber = objBIOS.SerialNumber
Next
End If
Set colNetworkAdapterConfiguration = objWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
strMacAddresses = ""
If Not colNetworkAdapterConfiguration Is Nothing Then
For Each objNetworkAdapterConfiguration in colNetworkAdapterConfiguration
If strMacAddresses <> "" Then
strMacAddresses = strMacAddresses & ", "
End If
strMacAddresses = strMacAddresses & objNetworkAdapterConfiguration.MACAddress
Next
End If
Set adoConnection = CreateObject("ADODB.Connection")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
If Err.Number <> 0 Then
MsgBox "Connect Error: " & Err.Description
WScript.Quit
End If
Set adoRecordset = adoConnection.Execute("<LDAP://" & objRootDSE.Get("defaultNamingContext") & ">;(&(objectCategory=Computer)(name=" & objNetwork.Computername & "));adspath;subtree")
If Err.Number <> 0 Then
MsgBox "Query Error: " & Err.Description
WScript.Quit
End If
For Each wbemObject In wbemObjectSet
strMsgRam = Int( ( wbemObject.TotalPhysicalMemory + 1023 ) / 1024 ) & " MB"
'WScript.Echo strMsgRam
Next
If Not adoRecordset.EOF Then
Set objComputer = GetObject(adoRecordset.Fields(0).Value)
objComputer.Put "description", "Make: " & strmake & " Model: " &strModel & " Ram: " & strMsgRam & " Serial No: " & strSerialNumber & " MAC Addresses: " & strMACAddresses
objComputer.SetInfo
End If
If Err.Number <> 0 Then
MsgBox "Write Error: " & Err.Description
WScript.Quit
End If