Solved

Deleting this reg entry with a VB script

Posted on 2008-10-24
2
302 Views
Last Modified: 2010-04-20
How can get this reg entry to update on its own. I always have to go in to reg and delete the values? Is the script I can use inside my login script to delete the values? This entry tells windows what label to give mapped drives. It never updates on it own and it is very frustrating.

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ComputerDescription
0
Comment
Question by:Raquelfournier
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
zabu99 earned 500 total points
ID: 22799439
Here is a quick and dirty way of doing it. Delete the "ComputerDescription" key and then add it back in. Note: on my computer it is "ComputerDescriptions".

You could also enumerate each item in the key and delete them individually.

Nothing wrong with messing with the registry; if you have a backup. I would recommend exporting your registry before doing this. The script worked fine on my computer, but discretion is the better part of valor and all that...

Hope this helps. Let me know if you need more info or have questions.
'We could check to see if the key exists before deleting it,'
'or we could just add this line for expediency'
On Error Resume Next
 
'Set up variables and constants'
const HKEY_CURRENT_USER = &H80000001
strComputer = "."
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ComputerDescription\"
 
'Connect to the registry'
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ 
	strComputer & "\root\default:StdRegProv")
 
'Delete'
objReg.DeleteKey HKEY_CURRENT_USER,strKeyPath
'Add'
objReg.CreateKey HKEY_CURRENT_USER,strKeyPath

Open in new window

0
 

Author Comment

by:Raquelfournier
ID: 22799539
That worked Your the man!!!!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
This article was inspired by a question here at Experts Exchange (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28629170.html). The requirements stated in that question are (1) reduce the file size of a large number of…
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.

736 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