PowerShell Commands  
  Skip Navigation LinksHome > Downloads > PowerShell Commands

What is this?

OK, a brief bit of history is called for. Microsoft has released a powerful replacement for the old Windows shell (aka: CMD.EXE) and has called it "PowerShell". Somehow almost everyone I talk to about the name thinks the original project name "Monad" was far more spiffy than the rather corny "PowerShell". But the name seems the only part where marketing has struck - every other aspect of the new shell is geared towards admins and their scripting needs. And it is free! (or at least adds to your existing Windows license)

Sadly, upon release of version 1.0 of the PowerShell there was no direct way to interact with the Active Directory - a rather big drawback considering most day-to-day administration today is done using the Active Directory. Every script accessing the active directory does so by using the .NET classes of the System.DirectoryServices namespace - i.e. PowerShell uses the .NET based wrapper classes for ADSI.

One of the more often asked questions is: how do I translate a windows account name (aka: SAMAccountName, NT4 Login,...) into the distinguished name that is required to bind to the user object via ADSI?

Well, the sad truth is: Thou shall not! In the programming world, there is a nifty little COM interface that does the trick, which is called IADsNameTranslate. It can easily be accessed through scripting (VBS, JS) and C++ but the PowerShell somehow doesn't get a good hold on the com object and so while you can create the COM object, it doesn't offer any methods or properties! The only alternative is to do a (rather complicated) search using LDAP-queries.

Behold the power of a few lines of C# code! I created this little snap in that I might extend with more utility cmdlets if feedback and my schedule call for it.

The download

You can download my little utility snap-in for free, but without any liabilities: it is provided as-is so verify that it works correctly in your environment before using it!
link Download


I might provide a Windows Installer (MSI) package at some time but for now you have to install the downloaded files manually.

  1. Unzip the archive into a directory beneath your "Program Files" folder (this will ensure the correct NTFS permissions).
  2. Open a command prompt (or the PowerShell :)
  3. Navigate to the directory that you created in step 1.
  4. Type the following command: InstallUtil Gredl.PowerShell.Commands.dll

Note: The "InstallUtil" executable is part of the Microsoft .NET Framework and - usually - not in your search path. It can be called using the full path (assuming your system directory is C:\Windows): C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe

After you installed the snap-in you need to load it in your shell. You probably want to add these commands to your profile.ps1 file. See the powershell help for details on this.

  • Launch the PowerShell.
  • Type the command Add-PSSnapin GREDL-Commands

You can use the default Get-Help Convert-AdsName command to obtain help.


Please provide feedback ("page feedback" link below) as to how it works out and what cmdlets you are missing and would like to see in a future release!



Convert-AdsName [-InputNames] <string[]> [[-InputNameStyle] <NameStyle>] [[-OutputNameStyle] <NameStyle>] [-Credentials] [<CommonParameters>]


The Convert-AdsName commandlet converts account names between different formats using a global catalog server.

Legal information (EN) | Impressum (DE) | Datenschutzerklärung (DE) | Page feedback