Proud to be an Exchange MVP
Video Guides
Surveys
Favorite Exchange Blogs
Microsoft Exchange Blogs
Exchange Training
Site Stats
Members : 2Content : 147
Content View Hits : 140543
| Quick Tip - Determining Group AD Membership Using Powershell... |
|
|
| Written by Andy Grogan |
| Tuesday, 04 March 2008 20:24 |
|
Although Exchange is a major part of my job and one of my primary interests – there are times when I am called to work on other issues. Currently my team is working on a major project whereby we intend to move from Citrix XPe (3000 seats) on Windows 2000 to Citrix Presentation Server 4.5 on Windows 2008 (yes I know that it has only just been released, but we have been testing it for a while and believe that it is ready to serve in this capacity). Now my role in the project (apart from being the boss and overseeing things) is to upgrade the current domain from Windows 2000 to 2008, but also to convert all of the existing KIXX based logon scripts into Powershell (the Citrix aspects are being done by my highly skilled Citrix people), so today I sat down with my copy of PowerGUI and began to convert the first KIXX script to Powershell. For most of the day it went very well, in fact many of the in built PowerShell commands are far more elegant and straight forward that their KIXX (or even VBSCRIPT) counterparts – for example, the creation and deletion of Folders is wonderful (and the inbuilt “Test-Path” cmdlet is a dream), however when it came to the point where I needed to get the script to compare the group membership of user accounts to allocate resources it fell apart a little. You see (as far as I could tell) there is no inbuilt group “MemberOf” cmdlet in Powershell 1.0 – and after a little but of research it seemed to me that I would need to install third party command libraries (some free other at a cost) in order to fill the gap – neither of which was acceptable to my situation. Essentially I needed a cmdlet that would accomplish the following pseudo code:
After hours of searching I found many ways where you could obtain the group membership of a given user, but, I could not find a way to perform the tasks above. In the end I decided to write my own function to accomplish the task which I would like to share with you all:
The function requires two parameters:
Therefore the syntax of the function is such: “get-groupMembership
|
| Last Updated on Sunday, 11 October 2009 11:51 |





