How to populate computer description with %username%

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Does anyone know if there is a way to automatically change the computer
description to the name of the user logged on. (using a variable %username%)


Many Thanks
 
You may use this script to accomplish the task. Copy the lines below to a
Notepad document and save the file as "PC-Desc.vbs"

------------------------------------------------------------------
Set WshNetwork = WScript.CreateObject("WScript.Network")
MyDesc=WshNetwork.UserName
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")

For Each objOperatingSystem in colOperatingSystems
objOperatingSystem.Description = MyDesc
objOperatingSystem.Put_
Next

Set WshNetwork = Nothing
 
Back
Top