Windows

Pop Quiz: Microsoft Windows PowerShell basics

Windows PowerShell combines the command line's speed, a scripting language's flexibility, and the power of a GUI-based administrative tool. If you're still reluctant to learn PowerShell, you may just not know how powerful it can be. Take TechRepublic's Microsoft Windows PowerShell pop quiz and test your PowerShell knowledge.

Released in 2006, Windows PowerShell combines the command line's speed, a scripting language's flexibility, and the power of a GUI-based administrative tool. Whether you're an old school fan of the C:\ prompt or strictly a GUI user, learning to use the Windows PowerShell can save you time and effort on common Windows admin tasks. Besides, it also just looks cool to fix a problem from the command line.

If you're still reluctant to learn PowerShell, you may just not know how powerful it can be. Take the following Windows PowerShell pop quiz and test your PowerShell knowledge.

Note: Unfortunately, our poll tool, which I use to create each pop quiz, doesn't let me indicate a correct answer after each question. To keep from giving away the answers before everyone has a chance to test his/her knowledge, and ruining all the fun, I'm going to hold off posting the answers until later.

About

Bill Detwiler is Managing Editor of TechRepublic and Tech Pro Research and the host of Cracking Open, CNET and TechRepublic's popular online show. Prior to joining TechRepublic in 2000, Bill was an IT manager, database administrator, and desktop supp...

10 comments
Bill Detwiler
Bill Detwiler

Here are the answers to the PowerShell pop quiz: 1. Monad 2. Windows 2000 3. All of the above 4. True 5. cmdlets 6. True 7. .ps1 8. False 9. All of thee above 10. Alias

BlueCollarCritic
BlueCollarCritic

AS seems to be common lately, Microsoft made several poor choices with the push of Pwershell very much like they made with the push of the RibbonBar in the Office 2007 products. I am familiar with OOP languages and the .Net platform with some experience working in VB6, VBA, VB.Net, C++ & even some C# so the object oriented approach is not a stranger to me. I however have had a very difficult time with Powershell because it is as far from intuitive as you can get. If Microsft was going to push Powershell as it has then at a minimum they should have included a basic GUI that could generate template or outline coide with comments making it easier for the new Powershell user to move to using the langauge. Powershell is also over-complicated in many ways. I use SQL Server 2008 whcih includes PS and it's amazing to me the hoops you have to jump thru in PS code to perfrom very basic actions. The best example is restoring a backup of a DB. If I have a backup of a database that I would like to restore to my server and I want to explicitly specify the name of the new DB along with the path and file names to use for the DB's data & log files and I am using microsoft's own DPM (Data Protection Management) to handle the backups, there's no easy way to do this. In fact, from what I've found from searching on the net there is no way to do this at all. This should not ojnly be doable but it shoudl be easy since all parts of the puzzle are Microsoft technology; SQL Server, Powershell & DPM. So in closing, even though I'm using the latest in MS technology for Database Management (SQL Server 2008), DB backup (DPM 2007) and scripting (Powershell) I can't perfrom even the simplest of tasks using the scripting lanaguage that Microsoft is pushing. I had high hopes for Powershell and maybe in the next version it will be a lot better but for now, Microsoft has in my opinion failed to deliver when it comes to the Powershell scripting langauge.

Bill Detwiler
Bill Detwiler

Windows PowerShell combines the command line's speed, a scripting language's flexibility, and the power of a GUI-based administrative tool. In an IT Dojo blog post, I published a 10-question quiz to test your knowledge of PowerShell basics. Original post: http://blogs.techrepublic.com.com/itdojo/?p=157 Despite being a powerful tool, PowerShell has a pretty steep learning curve. Do the benefits of knowing how to use PowerShell outweigh the effort required for PowerShell proficiency?

info
info

The answer to 4. is False.

kirtw
kirtw

Are you sure about your "False" answer for #8? I guess it depends on when you test the "default" behavior. Prior to the installation of PowerShell, a ps1 file does not open PowerShell. After the installation of PowerShell, the default behavior is to launch PowerShell and run the PowerShell (.ps1) script after a double-click. So, the answer depends on which "initial conditions" you want for your answer.

wiggledbits
wiggledbits

"and the power of a GUI-based administrative tool" What GUI? I have only seen CL. MS took the *nix approach on this, small command line tools piped together to do larger tasks only now PS works with Windows objects. I don't know enough about it to bash it but if there is a GUI tell me where I can get it to make the learning curve less steep.

chris
chris

I consider myself a lazy admin - why, because I'll figure out how to write a program before manually doing a process on x number of servers. Just this week I wrote a couple scripts: - audit 700+ servers for a given service - audit 700+ servers for scheduled tasks - Generate a list of 'online' and 'offline' servers in a windows domain. Yes, I could (and have) done this in VBS in the past - but I wanted to compare the two. I will say that once the code was written - the execution seemed much faster then any vbs script I've written. So, I've learned a little something and feel I've started speeding up my audits. Does this make it worth my effort to learn Powershell - maybe. One thing that I didn't mention is all the cmdlets that are coming out for power shell. Quest has some powershell cmdlets for AD. VMWare just came out with some VI cmdlets for powershell. MS is using it to manage exchange. I'm working on some Citrix scripting in powershell as well. So if you ask if it is worth it - I believe the number of vendor supporting and coming out with cmdlets would say YES, it is worth it. This is just my personal opinion though - and you should do you own testing. Thanks, Chris

wizard57m-cnet
wizard57m-cnet

since the original article is over 3 years old???

info
info

By default, PowerShell's execution policy is set to Restricted, i.e. no scripts will run.

Computer_User_1024
Computer_User_1024

Not only do scripts simplify tasks and speed them up, they can also reduce the chance of error on your behalf. Face it. when you have to audit 700+ servers for a given service and you have to do it manually there is a high chance for error. When manually performing such a task one can get quite tired and very easily make a mistake. A script to do the task is thus much more efficient and accurate.

Editor's Picks