O'Reilly logo

Windows PowerShell™ 2 For Dummies® by Steve Seguis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 22. Converting Your Old Scripts: Out with the Old, In with the New

In This Chapter

  • Breathing new life into your Windows Shell Scripts

  • Moving your WSH scripts to Windows PowerShell

  • Interacting with COM

  • Getting your feet wet in ADO.NET

If you've been in the business of Windows administration for any amount of time, you probably already have a collection of scripts that you use to make your life easier. More than likely, these scripts are written in Windows Shell Scripting (also known as batch files) or in VBScript or JScript for Windows Scripting Host (WSH). Most of the time, it makes the most sense to continue using those scripts in their current form and to use Windows PowerShell for any new scripts you create.

Although that system is the path of least resistance, when it comes to understanding a new scripting language, nothing is better than revisiting old scripts and converting them to the new language. For starters, it gives you the opportunity to go over your old code to see where you can improve. I've done this a couple of times, only to find myself chuckling over rookie mistakes and, in some cases, finding dramatic changes that increase the script's performance and reliability. The other benefit is that you already know the logic of the old script, so the exercise of converting it to Windows PowerShell is purely that of understanding how to do the same thing in a new language.

In this chapter, you explore techniques for migrating your existing Windows Shell or Windows Scripting ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required