Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Computer Description Property

98 views
Skip to first unread message

JimR

unread,
Jan 24, 2004, 12:09:41 PM1/24/04
to
I would like to write a script to set the "Computer
Description" field on all Windows XP PC's in my domain.
This is not the AD description field, but rather the PC
description field found on the "Name" tab of the "My
Computer" icon. I cannot find this property in any of the
WMI classes. Does anyone know where it is?

mika

unread,
Jan 24, 2004, 12:51:28 PM1/24/04
to
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
For Each objItem in colItems
    Wscript.Echo "Comp Description: " & objItem.Description
Next
 
-mika
 
 

Torgeir Bakken (MVP)

unread,
Jan 24, 2004, 4:46:06 PM1/24/04
to
JimR wrote:

Hi

Here is an example on how to set it with WMI:

sDescription = "some description here"
sComputer = "." ' use "." for local computer

Set oWMI = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & sComputer & "\root\cimv2")

Set oOScol = oWMI.InstancesOf("Win32_OperatingSystem")

For Each oOS in oOScol
oOS.Description = sDescription
'oOS.Put_ ' note the trailing underscore!
Next

The Description text is also stored in the Registry, you can change it here
with
a registry write:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters
srvcomment : REG_SZ = "description text"

Downside with this method is that I think you will need to log off and on
to see the change, unless the following command will activate it:

RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters

--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter


0 new messages