Solved

remove a odbc system-dsn by script via policy

Posted on 2009-04-11
3
576 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Exchange 2013 event logs 1 53
error load library when execute a Drawing program 2 25
Exchange 2007 standard - defrag (eseutul /d) 10 39
Determine exact dimensions of screen 5 44
I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
How to record audio from input sources to your PC – connected devices, connected preamp to record vinyl discs, streaming media, that play through your audio card: Vista, Windows 7, Windows 8, Windows 8.1 and Windows 10 – both 32 bit & 64.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

776 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