WSH script to remove system and user DSN
filed in other on Jun.23, 2010
‘Gregor Stefka
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_CURRENT_USER = &H80000001
strComputer = “.”
strDSN = “YourDSN”
Set objReg=GetObject(“winmgmts:{impersonationLevel=impersonate}!\\” & _
strComputer & “\root\default:StdRegProv”)
strKeyPath = “SOFTWARE\ODBC\ODBC.INI\” & strDSN
objReg.DeleteKey HKEY_LOCAL_MACHINE, strKeyPath
objReg.DeleteKey HKEY_CURRENT_USER, strKeyPath
strKeyPath = “SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources”
objReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strDSN
objReg.DeleteValue HKEY_CURRENT_USER ,strKeyPath,strDSN
Leave a Reply
You must be logged in to post a comment.