Solved

Deleting this reg entry with a VB script

Posted on 2008-10-24
2
303 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

695 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