Solved

VBScript or Powershell?

Posted on 2013-01-26
13
360 Views
Last Modified: 2013-02-03
Hi,

I'm in Windows IT quite some years but never touched any scripting myself (yes, I did some copy pasting "writing my own scripts", but that's about it).

Now I would like to dive deeper into it but just wonder what I should "learn" VBScript first, then Powershell or directly Powershell.
Reason: a lot of Powershell scripts exist and not all Windows-es have powershell. On the other hand, I don't want to spend 2 times the effort.

Please advise.
J.
0
Comment
Question by:janhoedt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 2
13 Comments
 
LVL 69

Expert Comment

by:Qlemo
ID: 38824271
If you do a fresh start in regard of learning, you should go with PowerShell. Even XP allows for PS, and anything older than that should cease to be used ;-).
VBS requires you to use some workarounds for things you can do with PS easily. Both besides having control over .NET functions, they are not much comparable or interchangable.

Getting the concepts right with PS needs some more initial effort than with VBS, at least if you are already used to any programming or scripting language. Writing in VBS is more easy for the simple things, however, and calling it is faster. Nevertheless, PS is the way to go, VBS will keep to exist for a long time still as there is so much code out there.
0
 

Author Comment

by:janhoedt
ID: 38824446
Thanks. But as you mention "VBS will keep to exist for a long time still as there is so much code out there." In order to interprete/change that code I still need to understand VBS ....
0
 
LVL 69

Expert Comment

by:Qlemo
ID: 38824481
You'll need to understand VBS, but not be able to fully handle it. That makes a big difference. If you see VBS code, most of it can be understood without having too much knowledge.

You can say the same about PowerShell, but that isn't true. Modifying PS code needs more insight in what it is doing, and why.

But in the end it depends on what you know already, and what you are after.
If you just want to paste code you find on the Web together, VBS cide is usally easier to adapt.
If you want to write code yourself, PowerShell gives you more feedback with less ado.
0
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 
LVL 2

Accepted Solution

by:
feaglin earned 500 total points
ID: 38824580
VBscript is a lot more complicated, and can't be run interactively from the command line.  It's easier to write and test Powershell scripts because you can run single commands or small sections of code from the command line to see the results.

  I use PowerShell more than the GUI for day to day systems administration.  After you've forced yourself to go through the learning curve it's a lot faster to make a change to one server or AD account than to do a dozen clicks for the same task.  And if you need to make the same change to 3 or a 100 servers/account it's trivial to wrap a simple loop around your command instead of spending your day clicking.

  Finally, Microsoft has not actively developed VBscript for quite a while.  It's kept around for backwards compatibility.  Microsoft made PowerShell part of it's "Common Engineering Criteria" (I think I have the name right) a year or two ago.  That mean every Microsoft product has to managed, support, PowerShell.  In Exchange 2010 every button you click runs a PowerShell script.  You can right click on a button to see what the script is.  The same goes for Windows Server 2012 management consoles, and I've read that it also has a window that shows the PowerShell code as it runs whenever you click a button in the Management console.

  Summary: VBscript is last decade's solution, PowerShell is the future.  Unless your current job has a lot of VBscript code in day to day use I would forget VBscript exists and learn PowerShell now.  (Don Jones has a favorite saying: "If you're a SysAdmin either learn PowerShell or learn how to say 'Do you want fries with that?'".

  There are a lot of free e-books out there, and the PowerScripting Podcast is a good resource.  Look through old topics to pick the interesting ones at first.  The book publisher Manning.com has several good PowerShell books and the best ebook policy I've seen.  Sign up for their daily newsletter and within a couple of months the book you want will be half price.

Good luck.
0
 
LVL 69

Expert Comment

by:Qlemo
ID: 38824604
... and the book you want should be Windows PowerShell In Action, 2nd Edition (ISBN 978-1-935182-13-9).

I absolutely agree to the interactive part, though I do not use the shell that way often. Quest's (free) PowerGUI Script Editoris much better for trying things out, debug, and monitor. It's kind of "fat" in memory usage, however.
0
 
LVL 2

Expert Comment

by:feaglin
ID: 38824635
"PowerShell in Action" is great, but it's on the advanced side.  It's written by the guy who did the majority of the design and development of PowerShell.  A better starter book would be "PowerShell in a Month of Lunches" to learn the basic concepts, and the "PowerShell Cookbook" to get instant examples on a variety of Windows OS tasks, and afterward move on to "PowerShell in Action".  Of course, everything in the cookbook is on the Internet, but you have to wade through the Internet, so the cookbook is more of a convenience, I think.

http://poshcode.org and http://www.codeplex.com are good sources for scripts.

hth
0
 
LVL 69

Expert Comment

by:Qlemo
ID: 38824818
I'm not in total disagreement about PSiA being advanced. think that you can read each chapter as far as you dare, and still have a good introduction into the "machine". You do not get a lot of example code, that's true. The book is a two or three pass adventure.

If you look for free ebooks, make sure you get PowerShell 2.0 related stuff - with 1.0 many things were much more complicated, and you had to fall back to WMI often.
0
 

Author Comment

by:janhoedt
ID: 38824865
What about logonscripts , can powershell be used?
0
 
LVL 69

Expert Comment

by:Qlemo
ID: 38824893
Yes, but for interacting with AD either the ActiveDirectory module should be used (W2008R2 and above), or the Quest cmdlets loaded, to simplify tasks.
0
 

Author Comment

by:janhoedt
ID: 38825812
So every client needs this module loaded in order to run logonscript?
0
 
LVL 69

Expert Comment

by:Qlemo
ID: 38826523
The logon script will have to load the module. As said, you can go without, but it is more demanding then.
0
 

Author Comment

by:janhoedt
ID: 38826537
So the client needs to load the module = powershell  installed.
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

730 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