Hi Guys,
I'm complete newbie in scripts......
I'm trying to complete the description field in AD with some relevant information, so can you help me?
I've got this script from "https://4sysops.com/archives/automatically-fill-the-computer-description-field-in-active-directory/"
And i need to complete with Ethernet Mac Address Wi-Fi Mac Address, Date and time....
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
' Get service tag and computer manufacturer
For Each objSMBIOS in objWMI.ExecQuery("Select * from Win32_SystemEnclosure")
serviceTag = replace(objSMBIOS.SerialNumber, ",", ".")
manufacturer = replace(objSMBIOS.Manufacturer, ",", ".")
Next
' Get computer model
For Each objComputer in objWMI.ExecQuery("Select * from Win32_ComputerSystem")
model = trim(replace(objComputer.Model, ",", "."))
Next
' Get computer object in AD
Set objSysInfo = CreateObject("ADSystemInfo")
Set objComputer = GetObject("LDAP://" & objSysInfo.ComputerName)
' Build up description field data and save into computer object if different from current description
' We also do not update computers with a description that starts with an underscore (_)
newDescription = WshNetwork.UserName & "|" & manufacturer & "|" & model & "|" & serviceTag & ""
if not objComputer.Description = newDescription and not left(objComputer.Description,1) = "_" then
objComputer.Description = newDescription
objComputer.SetInfo
end if