?
Solved

VBScript or Powershell?

Posted on 2013-01-26
13
Medium Priority
?
364 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 70

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 70

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
Congratulations! You’re Certified – Now What?

Starting a new career can be overwhelming. Becoming certified in your field of expertise is a great start, but where do you go from here?  Here are some tips to help you on your career journey.

 
LVL 2

Accepted Solution

by:
feaglin earned 2000 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 70

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 70

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 70

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 70

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

Containers & Docker to Create a Powerful Team

Containers are an incredibly powerful technology that can provide you and/or your engineering team with huge productivity gains. Using containers, you can deploy, back up, replicate, and move apps and their dependencies quickly and easily.

Question has a verified solution.

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

This article will show, step by step, how to integrate R code into a R Sweave document
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

752 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