We help IT Professionals succeed at work.

Update the logged in users name as the description of the computer.

Last Modified: 2010-03-05

I want a script to update the logged in users name as the Description of the computer Object.Is there a way to do this.And i want to do this only for a particlar OU.

Watch Question

Sure is.  Use the script below:

Const MY_COMPUTER = &H11&
Set objNetwork = CreateObject("Wscript.Network")
strUsername = objNetwork.UserName
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(MY_COMPUTER)
Set objFolderItem = objFolder.Self
objFolderItem.Name = strUsername

Save that into a vbs file (i.e. "ChangeIconName.vbs").  If you want to add it to a batch file login script simply use this command:
wscript.exe "ChangeIconName.vbs"

Just realized I didnt answer the 2nd part of your question.  You can have this done for a certain OU by simply adding the script as a login script to the OU's GPO.  If it does not have a GPO assigned you can create a new one.

Be careful though if the GPO is assigned to multiple OU's the script will run for all that it is assigned too.




This is changing the Mycomputer to the logged in name.

Start > you have My Computer its changing that to the logged in user name
This one is on us!
(Get your first solution completely free - no credit card required)



How do i automate this .

I just want to run this on a computers which will update the logged in users name...
Just copy the code into a vbs file (i.e. desc_change.vbs).  Then you can do it 1 of 2 ways. (1) If you already have login scripts for the users you cn simply add this to that login script (if it is a bat file or cmd file just use "wscript.exe desc_change.vbs").  Also make sure that the file is saved in the netlogon folder. (2) If you dont currently have login scripts you can add on to the GPO that is assigned to the users you want to apply it to and add it as a login script in there.


Any way to take the machine names from the file in which i have there names...

Not sure I follow you.  This script will automatically change the Computers Description to the username that is logged in.  So let's say your username is "bsharath" and you login to machine pc01.  pc01's description would then become "bsharath" automatically.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.