FYI, this one will also do the Serial Number & Make/Model if interested.

-Sam

 

 

On Error Resume Next

strComputer = "." 

Set objWMIService = GetObject("winmgmts:" _ 

    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 

Set colcomputersystem = objWMIService.ExecQuery _ 

     ("Select * from Win32_computersystem") 

Set colBIOS = objWMIService.ExecQuery _

    ("Select * from Win32_BIOS")

For each objcomputersystem in colcomputersystem 

    Getcomputersystem = objcomputersystem.Model 

Next

    For each objBIOS in colBIOS

GetSerialNumber = objBIOS.SerialNumber

    Next        

Set objSysInfo = CreateObject("ADSystemInfo")

Set objUser = GetObject("LDAP://" & objSysInfo.UserName)

Set objComputer = GetObject("LDAP://" & objSysInfo.ComputerName)

strMessage = objUser.CN & " / " & month(Now()) & "." & Day(now()) & "." &
right(year(now()),4) & " / " & GetSerialNumber & " / " & Getcomputersystem 

objComputer.Description = strMessage

objComputer.SetInfo

 

From: David Lum [mailto:[email protected]] 
Sent: Wednesday, October 19, 2011 3:50 PM
To: NT System Admin Issues
Subject: RE: Script to fill in last user - ok real Q this time.

 

OK I'll try not to keep answering these myself, is there a way to make this
apply to just a specific OU? I would like it to NOT run in my OU with
servers in it. Can I just change the LDAP:// references to look at a
specific OU?

Sub DoADDescription

    Dim ad, objUser, objComputer

    

    Set ad = CreateObject("ADSystemInfo")

    Set objUser = GetObject("LDAP://" & ad.UserName)

    Set objComputer = GetObject("LDAP://" & ad.ComputerName)

 

    strMessage = objUser.Department & ", " & objUser.CN & ", " & Day(Now())
& "/" & month(now()) & "/" & right(year(now()),2)

 

    objComputer.Description = strMessage

    objComputer.SetInfo

End Sub

 

Dave

 

From: David Lum [mailto:[email protected]] 
Sent: Wednesday, October 19, 2011 1:44 PM
To: NT System Admin Issues
Subject: RE: Script to fill in last user

 

Of course I send this and then find it.thanks Mr. Hutchings! J

 

Dave

 

From: David Lum [mailto:[email protected]] 
Sent: Wednesday, October 19, 2011 1:41 PM
To: NT System Admin Issues
Subject: Script to fill in last user

 

One of you guys has a VBS script to populate the "Description" field in AD
with the last logged in user but I have lost that little tidbit...

David Lum 
Systems Engineer // NWEATM
Office 503.548.5229 // Cell (voice/text) 503.267.9764

 

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here:
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to [email protected]
with the body: unsubscribe ntsysadmin

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here:
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to [email protected]
with the body: unsubscribe ntsysadmin

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here:
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to [email protected]
with the body: unsubscribe ntsysadmin


~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to [email protected]
with the body: unsubscribe ntsysadmin

Reply via email to