Tech-Ed 2007 – Top 5 PowerShell Questions

This week I have had the privilege of working at TechEd 2007.I’ve been on the PowerShell demo stand in the Technical Learning Centre and talking to what feels like most of the 12000 attendees about how cool PowerShell is.It probably doesn’t surprise you to hear there were some really common questions, so I thought I’d list my top questions and answers:

1. How can I learn PowerShell?

Well I can only speak from my personal experience.When I was just beginning with PowerShell I came across “PowerShell Week”, a series of webcasts put together by The Scripting Guys.This series includes 5 webcasts which take you from the very basics of PowerShell to some pretty cool stuff.The webcasts can be found here and are pretty awesome:

What about books?!?I personally own 2 PowerShell books which I think are great.The first one is more of a tutorial book and is called “Windows PowerShell Step by Step” by Ed Wilson.This is great book for those just starting out with PowerShell.Find out more about the book here:

The other book I have is the daddy of all PowerShell books.It’s called “PowerShell in Action” by Bruce Payette.It’s a meaty book which I continuously refer to.If you really need to know the answer to something about PowerShell it’s probably in this book.Find out more about it here:

The answer to this is yes!I have seen some great PowerShell scripts that do some really cool stuff with AD.I’ve already written quite a bit about this on my blog.Check out the following 3 archived blogs for more detailed information:

The answer to this is yes and no.There is no native support to run any cmdlet against a remote host.For example I cannot say:

get-service –computername server1

Cmdlets generally only work on the computer that they are executed on.However, some cmdlets (for example Get-WMIObject) can be run against remote hosts.The Get-WMIObject cmdlet itself has inbuilt support to connect to remote hosts, and use the WMI providers that are running on them.

This means that you can run any scripts that use WMI against remote hosts.The following line would get the running services on a remote computer :

Get-WMIObject Win32_Service –computername Server1

WMI is not a new technology; it’s a mature technology that has been installed out of the box since Windows 2000.This means that you can use PowerShell to remotely administer boxes, as long there is a WMI provider that allows you do this.There are hundreds and hundreds of WMI providers, so the chances are you can do what you want using WMI.

4. Does PowerShell install on Windows 2008 Server Core?

In Windows Server 2008 Beta 3, the answer is no.PowerShell requires the .Net framework to be installed.The .Net framework will not install on Server Core.It won’t install because there are many components of the .Net framework that require Windows features installed, that are no installed in Server Core.For example there is no GUI in Server Core, and therefore none of the GUI .Net components could ever work.So the .Net framework is not available in Server Core and therefore PowerShell is not available.

5. Can I call PowerShell cmdlets from my own custom app?

Yes you can.Whether it is an ASP.Net application, or standard exe you can hook into PowerShell and run cmdlets. You need to host a PowerShell Runspace in your application, MSDN has loads of information on how you can do this. The first link below is the MSDN PowerShell homepage, the 2nd link introduces the concept of hosting PowerShell runspaces in applications:

Yuvraaj, I`m not aware of a tool that converts batch files to PowerShell scripts, but that doesn’t mean it doesn’t exist 🙂

However, personally if I had a load of legacy scripts that work, I would keep them. Write new scripts in PowerShell, but if something doesn’t need to be changed and it already works I would keep using it. That’s probably just because I am lazy though 🙂