Tracking laptop asset tags/serial numbers using WMI and writing to Active Directory

Posted on 2008-11-06
Medium Priority
Last Modified: 2013-12-24
I have an Active Directory network. I need to keep track of my laptops. I already have used Group Policy to push a Login script that adds all the current printers to users computers when they log in. I know how to get the asset tags/serail numbers using vbscript and WMI from each laptop. Is there a way to update an Active Directory property using a login script?
Question by:gepeters
  • 2
LVL 65

Accepted Solution

RobSampson earned 1000 total points
ID: 22914687
Hi, as long as your users are able to update their own AD object, you can use code such as this to set the description of the user account to the serial number of the computer they are using.


Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT SerialNumber FROM Win32_BIOS", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
	strSerialNumber = objItem.SerialNumber
Set objSysInfo = CreateObject("ADSystemInfo")
Set objUser = GetObject("LDAP://" & objSysInfo.UserName
objUser.Description = strSerialNumber
Set objSysInfo = Nothing

Open in new window

LVL 65

Expert Comment

ID: 22926178
Thanks for the grade.



Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question