Scripting Blog

A place to learn about PowerShell and share stories of automation

Can I Create and Delete a DSN Using a Script?

Hey, Scripting Guy! Is it possible to create an ODBC Data Sources Name (DSN) on the fly and then remove it when done?-- KC Hey, KC. Is it possible to create and then delete an ODBC DSN? To tell you the truth, we weren’t entirely sure. As it turns out, however the answer is this: as long as you’re willing to write a script that modifies ...

How Can I Tell Whether a Value Exists in the Registry?

Hey, Scripting Guy! How can I tell whether a value exists in the registry on a remote computer?-- AL Hey, AL. Full disclosure time: even though we go by the name The Scripting Guys, we don’t claim to know everything there is to know about scripting. This question is a good example of that. When we first read it we thought, “Well, ...

Registry Script Doesn't Work

Hey, Scripting Guy! I tried writing a script to read data from the registry, but I keep getting this error:   Do you have any idea what's wrong? I'm running Windows XP Professional, Service Pack 1, and this is the code I'm using:Const HKEY_LOCAL_MACHINE = &H80000002 strComputer = "." Set oReg=GetObject("winmgmts:\\" &_ ...