Solved

remove a odbc system-dsn by script via policy

Posted on 2009-04-11
3
578 Views
Last Modified: 2012-05-06
Hi,
I need some help for a script which removes a odbc system-dsn.
I have a large number of xp-workstations connected to a sql-server in a new 2008 domain.
I would like to remove the old system-dsn in the user-pc's via a script.
Any Ideas?
0
Comment
Question by:michaellandwehr
[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
3 Comments
 
LVL 8

Accepted Solution

by:
stehardy88 earned 500 total points
ID: 24678869
Hi michael,

Use the attached script, but change ##ODBC NAME## to the name you've given the ODBC connection.

Cheers,

stehardy88

Const HKEY_LOCAL_MACHINE = &H80000002
 
strComputer = "."
 
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _ 
    strComputer & "\root\default:StdRegProv")
 
strKeyPath = "SOFTWARE\ODBC\ODBC.INI\##ODBC NAME##"
objReg.DeleteKey HKEY_LOCAL_MACHINE, strKeyPath
 
strKeyPath = "SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources"
strValueName = "##ODBC NAME##"
objReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName

Open in new window

0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

No single Antivirus application (despite claims by manufacturers) will catch or protect you from all Virus / Malware or Spyware threats. That doesn't stop you from further protecting yourself however - and this article is to show you how.
An introduction to the wonderful sport of Scam Baiting.  Learn how to help fight scammers by beating them at their own game. This great pass time helps the world, while providing an endless source of entertainment. Enjoy!
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

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