Getting AD users in a group with PowerShell

PowerShell rocks, but a part of the rockiness comes from the great third party additions. For example, enumerating the users in an Active Directory Group is somewhat painful with the basic PowerShell… but throw in Quest Software’s excellent free ActiveRoles Management Shell extensions, and things get a lot smoother. The goodness can be downloaded from […]

June 11, 2010 · Jouni Heikniemi · 4 Comments
Tags: ,  · Posted in: Windows IT

PowerShell Basics #5: Manipulating services

Although you can start and stop the Windows services on your computer with the net.exe, PowerShell makes it far easier to do more complex manipulations. Start by doing a Get-Service – or just casually called gsv. PS D:\PowerShell> gsv Status Name DisplayName —— —- ———– Running AEADIFilters Andrea ADI Filters Service Running AeLookupSvc Application Experience […]

April 29, 2010 · Jouni Heikniemi · No Comments
Tags:  · Posted in: .NET, Windows IT

Getting a list of all types in the GAC with PowerShell

Surprisingly, it became necessary to list all the types in the assemblies loaded in the GAC. Getting the list of assemblies from the GAC isn’t hard, but then you need the types – and that requires some more programming. I think this example greatly demonstrates the might of PowerShell. You can easily combine traditional text-based […]

April 16, 2010 · Jouni Heikniemi · No Comments
Tags:  · Posted in: .NET

Enabling MSI installations on Windows Server 2008 via PowerShell

Did you know that by default, there are limitations on installing MSI packages on Windows Server 2008 and Windows Server 2008 R2? Neither did I, but you live to learn. MSDN documents this quite well if you know what to look for. According to the page the server OS default is to disable MSI for […]

April 7, 2010 · Jouni Heikniemi · No Comments
Tags:  · Posted in: Windows IT

Extracting media files from a PowerPoint presentation with PowerShell

Ever needed to extract all the media files (images, video etc.) from a PowerPoint presentation? Copy/paste does it, but getting the stuff into separate files is a chore. Unless you speak fluent PowerShell, that is. The following script defines a function that takes a full path (including the directory) to the PowerPoint file. It then […]

April 5, 2010 · Jouni Heikniemi · 2 Comments
Tags: ,  · Posted in: .NET

PowerShell for Developers: Slides for my TechDays 2010 Finland presentation

If you’re after my slides for my TechDays 2010 presentation earlier today (“PowerShell kehittäjille”, a.k.a. PowerShell for Developers), look no further. Unfortunately, the material is in Finnish only. You can find the slides and one of the demo scripts in a single zip package. Also, if you want the WebNote demo, the solution is available […]

March 9, 2010 · Jouni Heikniemi · One Comment
Tags:  · Posted in: .NET

PowerShell Basics #4: Matching and capturing with regular expressions

Using regular expressions on Windows hasn’t been particularly easy, as the standard command-line tools have provided very little support to these powerful beasts. On the other hand, various spawns of Unix have had loads of support for regexes on the command line, including classic tools such as grep, sed and awk. PowerShell changes things here. […]

February 13, 2010 · Jouni Heikniemi · 3 Comments
Tags:  · Posted in: .NET

PowerShell Basics #3: Manipulating data in text files

To continue my series of PowerShell Basics posts, I’ll cover some basic features around manipulating text file data. First off, the problem is really two separate problems: Handling text file IO and manipulating the contents. PowerShell provides decent tools for both, and since everything is just .NET objects, you can run any .NET string manipulations […]

February 5, 2010 · Jouni Heikniemi · 2 Comments
Tags:  · Posted in: .NET

PowerShell Basics #2: Dir for power users

You would think the standard dir command in cmd.exe would do its job adequately, but it’s still surprising how much more functionality can you pack into it. Here’s an introduction to power-using Get-ChildItem, also known by the aliases of dir and ls. Leveraging FileInfo and DirectoryInfo For starters, it is important to remember that dir […]

January 28, 2010 · Jouni Heikniemi · 2 Comments
Tags:  · Posted in: .NET, Windows IT

PowerShell Basics #1: Reading and parsing CSV

I will be giving a talk on the topic of “PowerShell for Developers” at TechDays 2010 in Helsinki, Finland. As a warm-up to my presentation, I will be publishing a series of blog posts on various aspects of PowerShell. My viewpoint is specifically one of developer utility: What can PowerShell do to make a dev’s […]

January 22, 2010 · Jouni Heikniemi · 29 Comments
Tags: ,  · Posted in: .NET