Powershell Questions

Direwolf20

2[H]4U
Joined
Mar 10, 2004
Messages
2,467
Hey guys,

I wasn't sure if I should put this in OS or Programming, but I figured here is plenty good :). So, about powershell.

My company is migrating from Novell to AD this week, its almost done, and AD is where we're going. I'm the local 'Good with programming and scripting and sql' guy, so they want me to learn some powershell.

A) Powershell is a good thing to learn, ya? :) Are there a lot of uses for it in AD?

B) Can you recommend a book or two. Like I said, I've got a strong programming/scripting background, so I'm sure this kind of thing is right up my alley.

Thanks in advance!!
 
powershell has been an absolute blast for me at work. For AD stuff look into downloading the Quest AD cmdlet (http://www.quest.com/powershell/activeroles-server.aspx). Focus on powershell v2 rather than v1. Also keep in mind that only windows 7/2008r2 have v2 built in, if you wish to do anything client side you will have to restrict it to new OSs or install powershell on older machines.

Here is a small exert that I shared of the module I created for my support team: http://hardforum.com/showthread.php?t=1497826

Once you get the hang of it you will never want to do anything in vbscript again.

As for books I do not know of any, i used google and previous coding experience. This should help you get started: http://technet.microsoft.com/en-us/library/ee221100.aspx
 
First, I'll agree with what xenios said...

On the question of whether powershell is a "good thing to learn"... I'll answer with a resounding YES...

Powershell is where MS is going for management. Microsoft originally started this with Exchange 2007... The management GUI for Ex07 is really just a wrapper for powershell commands (many GUI actions even show you the underlying powershell commands that will be run, which is great for teaching non-programmers or non-shell users how to create a command)...

Since Ex07, Microsoft has basically told its other app server groups that they also need to include / create powershell cmdlets for their products. This is coming along, more slowly in some cases than others... The AD commandlets are available in powershell R2.. IIRC, SQL 2008 allows some basic DB server management through powershell... Sharepoint 2010 will include powershell cmdlets for management.. etc...

Heck, even Vmware has released powershell cmdlets for managing ESX... Use and availability of powershell seems like it's only going to grow.

There's lots of good sites out there on powershell, and even a podcast or two. The Powerscripting podcast is on I listen to on a semi-regular basis. Unfortunately I don't get as much time as I'd like with powershell, but I do enjoy it when I do get to use it.
 
In my opinion, powershell is a must for todays IT admins. It's very powerful.

If you're new to powershell, there are some text files in the powershell directory that are actually pretty good. Print them out and they'll walk you through issueing some commands to manage services and supply you with the tools to learn how to do more. It's a pretty decent beginners tutorial.

The quest ad cmdlets are nice, and they make things very easy. However, with Powershell V2 and Remote Server Administrator Tools installed, AD is just another psDrive. Which means you can manipulate AD like it were a filesystem.

Look here to see what I mean:
http://4sysops.com/archives/active-directory-management-with-powershell-v2/
 
Cool thanks, what IDE do you guys use? Something with a script debugger, that lets you step through the code, and watch the variables as it executes?
 
Last edited:
Yes, Powershell is pretty awesome. I would suggest the book 'Powershell in Action' - of the half a dozen books on Powershell I've read, Powershell in Action blows all the rest away easily. Good technical explanations and full of neat tricks. Powershell is very easy to use, the get-member command makes the language super easy to discover, and get-help is very nice and powerful.

For instance you can type "(dir)[0]|gm" without quotes, and it will give you all the commands/properties you can access on the first object the dir command returns (for instance), then you can print the lastaccesstime with "(dir)[0].lastaccesstime" and so on which would be listed by 'gm' aka get-member. It's just really cool. Just remember the 'get-member' command and the 'get-help' command. ;)
 
Last edited:
I've been at this for 2 hours and I'm in already in love with it. PowerGUI does more than I was looking for, and its great AND free -- thanks for the tip on that one!

I already came up with an awesome idea and my boss's face lit up when I told him about it. Muahahaha.
 
That powershell in action book, is that for 2.0?

http://www.manning.com/payette/ shows the date of the book as feb. 2007, I don't think it's been updated so no it's not for Powershell 2.0, but PS 2.0 is a not very major change over 1.0 (depends on your usage I guess) and is a superset of 1.0, most of the core language is unchanged, I would still get this book and maybe look up the changes to 2.0 on the web or whatever. http://blogs.msdn.com/powershell/ is a good place for info on new stuff in Powershell and other misc. powershell stuff.
 
Back
Top