PowerShell Deep Dive First Sales

PowerShell Deep Dives Last year I had the pleasure of editing PowerShell Deep Dives, published by Manning. This book is a community project with chapters contributed from MVPs and leading members of the PowerShell community. You won’t find this content anywhere else.

Anyway, I have the first royalty report from Q3 2013. Looks like we sold a little under 1500 copies. The important thing, in case you missed the original news about this project, is that all proceeds are given to charity. For this book, Save the Children received a check for $3,338.30. That’s nice but I know we can do better.

So if you’ve put off getting a copy, what are you waiting for? If you have a copy, thank you. Now spread the word and tell your colleagues to buy a copy. You can get the title in print or ebook formats. You can also buy the book from Amazon. In fact, if you’ve read the book a posted review would also help. The more reviews the attention the book can get which should lead to more sales and continued charitable contributions.

Thank you again to all of the authors and editors on this project and to those of you who have a copy on your shelf. I hope you found a few things that made it worth your investment. For the rest of you, well, you know what you need to do.

Techmentor Las Vegas 2013 Session Materials

TMVSK4I had a terrific time at Techmentor last week in Las Vegas. I did 2 3-hour sessions. The longer sessions are intended to allow speakers time to go deeper into content and offer more detailed coverage than what you might get at a conference like TechEd. From my informal survey of attendees, many people enjoyed the longer sessions with a few wanting even longer. I expect we’ll see this longer format at the Techmentor conference next year.

Because I had 3 hours I was able to cover a lot of material. One of my sessions was a hands-on-lab with some exercises. As promised I’ve updated my slide decks (primarily for clarity) and assembled all of my PowerShell scripts and demos. While anyone is welcome to download them, unless you were in my session you won’t have the necessary context. For example, most of my presentations were live demonstrations with the slides serving as notes and an agenda. But feel free to download and try it all out.

Much of the content for my sessions are drawn from my books.

Each zip file contains a PDF of my slide deck and all of my PowerShell samples. Put all the samples in the same directory. All samples are provided as learning material and are not intended for immediate production use.

Techmentor Las Vegas 2013 PowerShell Workflows
Techmentor Las Vegas 2013 Automating AD with PowerShell

TechDays SF Presentations

TechDays_logo250 Last week I presented a number of sessions at TechDays in beautiful San Francisco. Met some great people and had a great time. I presented 4 talks, almost all of them PowerShell-related. Actually, they all had some type of PowerShell content. I’m happy to share my session slides and PowerShell demonstrations. Most of the demonstrations are not full-blown scripts but command examples, except for those things labeled as functions. If you did not attend TechDays, you are still welcome to download the material, although without the context of the live presentation some of it may not make sense. I hope you can make it next time.

File and Folders with Powershell 3
If you manage file servers and aren’t using PowerShell, you are working much too hard. Or if you are using PowerShell v2 you are still working pretty hard. Fortunately PowerShell v3 along with Windows 8 and Windows Server 2012 offer a much better solution. This session will demonstrate how to provision and manage folders, files and file shares using PowerShell from a Windows 8 client. With a little up-front work, you ‘ll be able to create provisioning scripts to deploy a new file share in seconds.

10 PowerShell mistakes, trip-ups and traps
Windows PowerShell is a language and management technology that many IT professionals, including developers, think they understand. Yet very often they get caught up in pre-conceptions and misinterpretations, usually based on prior experience with scripting or development. This session will explore the 10 most common mistakes and traps that people fall into with PowerShell and how to avoid them.

Troubleshooting Active Directory with PowerShell
Active Directory is one of those technologies that when it works, nobody notices. But when it doesn’t work, everyone does. Fortunately, Windows PowerShell and Windows Server 2012 make a terrific troubleshooting tool. In this session we’ll look at some common Active Directory problems, how to diagnose them and in some cases resolve, all with Windows PowerShell.

Building a Windows 8 Hyper-V lab
We all know the benefits of testing in a non-production environment. But sometimes resources are limited and having a test setup seems like a lot of work. But now that Windows 8 includes Hyper-V, you can setup a lab environment in very little time. This session will guide you through setting up a Hyper-V based test lab and how to get the most out of it using the PowerShell management tools.

If you didn’t catch me in San Francisco, I’ll be at TechMentor this fall in Las Vegas. More on that later. There’s a chance I’ll be back to the West coast later this year for more PowerShell goodness. Keep an eye on the blog for announcments. Or if your company is looking for training, let’s talk.

TechDays San Francisco

talkbubble-v3I’m very excited to announce that I’ll be presenting at TechDays San Francisco this year. The event runs May 2nd and 3rd. You can find the schedule here. Registration will be forthcoming. Seating will be limited so you won’t want to delay once it opens up.

As you might expect I’ll be talking PowerShell, plus a few other topics I hope you’ll find interesting. Everything is subject to last minute change but here are my current plans.

10 PowerShell Mistakes, Trips and Traps and How to Avoid Them

Windows PowerShell is a language and management technology that many IT professionals, including developers, think they understand. Yet very often they get caught up in pre-conceptions and misinterpretations, usually based on prior experience with scripting or development. This session will explore the 10 most common mistakes and traps that people fall into with PowerShell and how to avoid them.

File and Folder Provisioning with PowerShell and Windows Server 2012

If you manage file servers and aren’t using PowerShell, you are working much too hard. Or if you are using PowerShell v2 you are still working pretty hard. Fortunately PowerShell v3 along with Windows 8 and Windows Server 2012 offer a much better solution. This session will demonstrate how to provision and manage folders, files and file shares using PowerShell from a Windows 8 client. With a little up-front work, you ‘ll be able to create provisioning scripts to deploy a new file share in seconds.

Troubleshooting Active Directory with Windows PowerShell

Active Directory is one of those technologies that when it works, nobody notices. But when it doesn’t work, everyone does. Fortunately, Windows PowerShell and Windows Server 2012 make a terrific troubleshooting tool. In this session we’ll look at some common Active Directory problems, how to diagnose them and in some cases resolve, all with Windows PowerShell.

Building a Windows 8 Hyper-V Lab

We all know the benefits of testing in a non-production environment. But sometimes resources are limited and having a test setup seems like a lot of work. But now that Windows 8 includes Hyper-V, you can setup a lab environment in very little time. This session will guide you through setting up a Hyper-V based test lab and how to get the most out of it using the PowerShell management tools.

As I get more details I’ll share them here, on Twitter and on Google Plus.

Counting Users by OU with PowerShell

I’ve been following a discussion thread in the PowerShell forum at ScriptingAnswers.com. The post is about counting the number of users in an OU. Well that sounds like fun. We got him started using the Quest AD cmdlets. I thought I’d share some of the code I posted.

The test code he is posting is using Write-Host, which makes puppies cringe everywhere. But this is PowerShell so we need to be thinking about objects. With objects I can sort on a property, export to a CSV, send to a file or whatever. I decided it would be helpful to have an object for each OU that included the OU name, distinguishedname, total number of users, total enabled users and total disabled users. You could also get a count of expired and/or non-expired.

As with most tasks, there is usually several ways to accomplish it. Here’s my approach using the Quest cmdlets.


get-qadobject -type organizationalunit |
foreach {
$u=get-qaduser -SearchRoot $_.dn -SizeLimit 500 -PageSize 2000 -searchscope Onelevel
$total=($u | measure-object).count
$disabled=($u | where {$_.AccountIsDisabled} | Measure-Object).count
$Enabled=$total-$disabled
New-Object psobject -Property @{
Name=$_.Name;
OU=$_.DN;
Description=$_.Description;
TotalUsers=$Total;
Enabled=$Enabled;
Disabled=$Disabled
}
}

The code first gets all organizational units in the domain. You could use the -Searchroot parameter if you wanted to narrow the search. Each OU is then piped to a foreach-object. Here I’m getting all the users specifying the search root. I’ve added some optional parameters for paging but the cmdlet usually is pretty good about these sorts of things. Although one parameter that is important here is SearchScope. Because I’m counting each OU I don’t want to get a count of users in any child OUs. Setting the SearchScope to OneLevel will only return objects in the immediate container. It won’t recursively search.

Once I have the user count, I measure the total number of of users. Then I get a count of all disabled users. Since an account can only be disabled or enabled, the enabled count should be the difference. Finally, I use New-Object to write a custom object to the pipeline with properties for the OU and my user counts.

If you have the Microsoft AD provider and cmdlets, here’s a version you can use:

Get-ADOrganizationalUnit -filter * -property Description |
foreach {
$u=Get-ADUser -filter * -searchbase $_.distinguishedname -ResultPageSize 2000 -resultSetSize 500 -searchscope Onelevel
$total=($u | measure-object).count
$Enabled=($u | where {$_.Enabled} | Measure-Object).count
$Disabled=$total-$Enabled
New-Object psobject -Property @{
Name=$_.Name;
OU=$_.Distinguishedname;
Description=$_.Description;
TotalUsers=$Total;
Enabled=$Enabled;
Disabled=$Disabled
}
}

If you’d like to learn more about managing Active Directory with PowerShell, as luck would have it I’ve written a book on the subject. You can check it out on my Books and Training page.