Bookmark and Share

In this post:

 

Should I Transition from Using VBScript to Using Windows PowerShell?

Hey, Scripting Guy! Question

Hey, Scripting Guy! A couple weeks back you said that VBScript was in maintenance mode, which basically means it’s going to go away at some point. What should we do for login scripts? Should we use Windows PowerShell? Can you give me some advice so I can adopt a scripting language for login scripts that will last at least the next few years?

-- RD

 

Hey, Scripting Guy! AnswerHello RD,

Yes, VBScript will be going away at some point. When? I do not know. There is still a huge installation base of VBScript code, and it is being used for many different purposes: login scripts, WinPE scripts, Web pages, Office automation, and other things. Therefore, we cannot simply kill the product. There must be a transition process. Generally, when we get ready to remove something, we will state that it is “deprecated,” which means that it can still be used and is still supported, but we recommend that you find something else to take its place. We have not deprecated VBScript; it is simply in maintenance mode. Maintenance mode is probably one step before it becomes deprecated. The final step, of course, is that it becomes obsolete, which means that it is no longer supported. Because VBScript is part of the operating system, it will follow the same life cycle as the operating system with which it ships. Therefore, VBScript will at least be supported as long as Windows 7 and Windows Server 2008 R2 are. If it ships in Windows 8, it will be supported as long as that operating system.

In the meantime, you should begin learning Windows PowerShell because Windows PowerShell is the future of administrative scripting. Many products such as Exchange, Active Directory Domain Services, SharePoint, and SQL are creating their own Windows PowerShell cmdlets, and Windows PowerShell is part of the operating system with Windows 7 and Windows Server 2008 R2. In addition, Windows PowerShell can be added to Windows Server 2008 R2 Core edition. In Windows Server 2008 R2, you can now use Windows PowerShell scripts for login scripts. VBScript scripts are now considered “legacy scripts.”

To get started using Windows PowerShell, you may want to check out our Windows PowerShell Learning page. In particular, pay attention to the Hey, Scripting Guy! posts about getting started. I have also started a new series called Scripting Wife that appears on weekends. It is Windows PowerShell from the ground up. I have six articles there as of today, and two more are coming for this weekend. I will be continuing this series through at least the end of the 2010 Scripting Games, which start on April 26.


Can I Save Information from One VBScript Script and Access It in Another?

Hey, Scripting Guy! Question

Hey, Scripting Guy! My son just learned a ton about programming thanks to you and your perfectly illustrated VBScript examples. We have asked everyone we know about about this, but no one has been able to answer, so we are going straight to the master.

Here's what we're looking at: Right now, he has a VBScript script that collects data from the user (name, address, emergency contact address), and he has a second VBScript script that sends an emergency e-mail notification when activated by a remote infrared device. What he does not have is the capability to get the actual information from the first script into the second. (Right now, his script just sends a generic e-mail message.)

So, here is my question: Is there a way to save information from one VBScript script and then access it in another?

-- KP

 

Hey, Scripting Guy! AnswerHello KP,

I am glad your son has learned a TON of programming information from our site—I love hearing these kind of stories! I would use command-line arguments when calling the second script, and pass the three pieces of information to the script. Take a look at some of these Hey, Scripting Guy! posts for ideas about using arguments.

 


Where Can I Download Windows 7?

Hey, Scripting Guy! Question

Hey, Scripting Guy! Is Windows PowerShell available for Windows 7? If yes, where can I download it?

-- JL

 

Hey, Scripting Guy! AnswerHello JL,

Windows 7 includes Windows PowerShell 2.0. It is already installed and ready to go. You need to go to Start/All Programs/Accessories/Windows PowerShell. In that folder, you will either have two or four icons (depending on whether your computer is a 64-bit operating system or a 32-bit operating system). To start Windows PowerShell, click Windows PowerShell. The contents of this folder (on my Windows 7 64-bit computer) are seen in the following image.

Image of contents of Window PowerShell folder 

 

 

How Can I Wrap a Script into an Executable File?

Hey, Scripting Guy! Question

Hey, Scripting Guy! In your Quick-Hits Friday article of May 8, 2009, there was a question regarding compiling VBScripts into an executable. You mentioned that you could compile a VBScript in Visual Basic, or a Windows PowerShell script in C#, but there were no tools that would compile just the VBScript into an executable. I just wanted to offer up an open source tool I have used in the past that is called (aptly) VBStoEXE. It is a small command-line tool that wraps the script into an executable. I have found it quite nice for running a script during an application install, or if I simply did not want someone seeing my work. Love the articles. Keep up the great work!  

 

Hey, Scripting Guy! AnswerHello JL, 

I am glad you enjoy the articles. Thanks for sharing this information.

 

Well, this concludes another edition of Quick-Hits Friday. Join us tomorrow for the Weekend Scripter as we delve into the mysteries of…well, we will let that remain a mystery for now.

If you want to know exactly what we will be looking at tomorrow, follow us on Twitter or Facebook. If you have any questions, send e-mail to us at scripter@microsoft.com or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.

 

Ed Wilson and Craig Liebendorfer, Scripting Guys