troubleshooting Question

Problems with logon in windows 2008 when trying to run a VBS script

Avatar of eltel-it-nor
eltel-it-norFlag for Norway asked on
Microsoft Legacy OSMicrosoft Server OS
3 Comments1 Solution661 ViewsLast Modified:
Greetings!

This script worked without problems in a 2003 R2 Domain, But when trying to run it in a 2008 domain nothing seems to happen.

On a client when gpresult /R is run Model.vbs is an applied Group Policy Object


Model.vbs :

'-----------------------------------------------------------------------
' Created 3/29/2011
' When used as login script it will populate the Computer Description
' in Active Directory with UserName, Serial Number & Computer Model
' ----------------------------------------------------------------------
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 & " / " & GetSerialNumber & " / " & Getcomputersystem
objComputer.Description = strMessage
objComputer.SetInfo
ASKER CERTIFIED SOLUTION
Miguel Angel Perez Muñoz

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros