Learn about Windows PowerShell
Summary: Catch up on your reading by focusing in on the most popular Hey, Scripting Guy! blog posts from 2010.
Hey, Scripting Guy! I am trying to catch up on my reading. Last year, I got so busy that I was unable to keep up with all of the Hey, Scripting Guy! Blog posts. I read a lot of them, and I subscribe to the RSS feed, but still I got behind. I resolve to do better this year. In the meantime, I am curious—can you tell me the most popular posts that you wrote this past year?
Hello EF, Microsoft Scripting Guy Ed Wilson here. I applaud your efforts to keep up with the Hey, Scripting Guy! Blog posts. One reason I started writing posts in a series (one week on a theme) is to help you to keep on track with your reading. One of the features I like about Microsoft Outlook 2010 is that I can subscribe to RSS feeds via Outlook. I have my RSS feeds in a special folder, and it is easy to keep track of my favorite blogs and web sites.
In general, the articles we published on SQL Server and on SharePoint have been really popular. I worked with various Microsoft MVP’s for the production of many of those articles. The graphical Windows PowerShell articles are also a hit and have been of great assistance to scripters who are looking to replace aging VBScript HTA’s. From a learning Windows PowerShell perspective, the Scripting Wife articles are a grand slam home run. Look for some more Scripting Wife articles in the ramp up to the 2011 Scripting Games (April 4 – April 15, 2011).
The post, “How to Change a User’s Active Directory Password with PowerShell” that I wrote on August 17 is one of the most popular posts of the year. In that article, I talk about some of the problems involved in attempting to translate a VBScript that changes passwords to a Windows PowerShell script that will change a user’s password. I show how to use the ADSI type accelerator to call the setpassword method. Following that excursion, I then show how to use the Set-ADAccountPassword cmdlet from the Microsoft Active Directory Domain Services cmdlets (for A good introduction to using the Active Directory Domain Services Windows 2008 R2 cmdlets, see “What’s up with Active Directory Domain Services cmdlets.”)
Nearly as popular as the post about changing a user’s AD password, is the post I wrote the following week about querying Active Directory with Windows PowerShell to retrieve a list of computers (but it could also be a list of users, groups or anything else that resides in AD) and then running WMI commands. I am really glad to see this post near the top of the list of popular 2010 Hey, Scripting Guy! posts because this post illustrates an extremely important technique. Rather than having to type in a list of computers, or maintain a text file of computer names, all I need to do is know how to query AD to retrieve my target list. I then walk through the returned collection to perform my maintenance. This allows me to focus on performing maintenance on the computers on my network, rather than spending time updating text files.
August was a hot month (for Hey, Scripting Guy! Blog posts) because the next post on the list appeared on August 16. It was about using Windows PowerShell to find all disabled user accounts in Active Directory and it led off with an excellent picture I took in Hamburg Germany. I had a lot of fun writing that article because I got to do one of my favorite things: I tested the performance of three different scripts. The first script used the WMI Win32_UserAccount class, the second script used the ADSISearcher Windows PowerShell type accelerator to query Active Directory for disabled user accounts, and the last script used the Search-ADAccount cmdlet from the Active Directory Domain Services Windows 2008 R2 cmdlets. The cool thing is that all three approaches took just about the same amount of time. In the post I discuss my test methodology and provide pointers to a collection of posts I wrote about testing the performance of scripts. Because there are three different scripts and three different approaches, I created a table in the post with my recommendations to help you decide which technique to use.
In April, I received an email at Scripter@Microsoft.Com from a network administrator who was taking over from a previous admin who was “a slouch.” The previous admin did not clean up user folders when he deleted users from Active Directory. This created a problem that involved a decent amount of manual labor to grant the Administrator rights to the folders to delete them. In the post, I wrote a script that searches Active Directory for a specific user. When the user is found, the script returns the path to the users home directory as well as the users profile path. The script then uses the takeown utility to take ownership of the folders, and then it uses the icacls utility to grant administrators full control of the folders. Next, it uses the Windows PowerShell Remove-Item cmdlet to delete the folders. It is a cool script, and it solved a real world problem. I had a lot of fun on my network creating users, logging on as different users, and then deleting their folders.
EF, this should help speed you on your way to catching up with the Hey, Scripting Guy! blog posts. Of course, you do not need to only read the most popular posts – although popularity is certainly one measure of impact. In the end, an excellent post is one that inspires you to experiment, or solves an immediate problem. This is something that I hope all of my articles accomplish. Use the tag cloud to click around and find things that will help you achieve your particular goals. Last year, I wrote the equivalent of three books, so there is lots of good content available for you. Join me tomorrow when I will begin talking about how to run Windows PowerShell scripts from a central storage location.
I invite you to follow me on Twitter or Facebook. If you have any questions, send email to me at email@example.com or post them on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.
Ed Wilson, Microsoft Scripting Guy