Solved

remove a odbc system-dsn by script via policy

Posted on 2009-04-11
3
574 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
3 Comments
 
LVL 15

Expert Comment

by:Naser Gabaj
ID: 24124622
0
 
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now