Listing AD Group Members Recursively with Powershell

The Quest Active Directory Cmdlets are very useful in getting AD group members. The only thing I was missing, was a -Recursive parameter. So I created this script.

You feed it AD Group Names as a parameter, and it will return a nice tree view of all members and subgroups and their members and so on. Finally, it returns a list of allunique members and their email addresses. You can easily modify the script to include other properties and export the ouput to a csv file.

I hope you like it.

Hugo

Get-MyGroupMembersRecursive (Rename to .ps1)

clubs take steps to guard against possible players’ strikeThe Department of Wildlife information on the lake notes the water is clear and the quality is good.. The Fox broadcast team mentioned the travel woes so often that I half expected to see Daryl Johnson IDed as “Fox Analyst/Circadian Rhythm Expert.”. Start by sitting with your http://www.cheapjerseys-nfl.com knees bent NFL Jerseys China and feet on the ground in front of you approximately 6 inches apart. In 2013 and 2014 he led Carolina to the play offs, and this year to a near perfect 15 1 regular season.. One of the reasons why Apple iPhone is the preferred smart phone for most is its versatility. He was truly an interesting guy.”Gumbel’s career has included three Emmys, calling two Super Bowls for CBS along with studio hosting duties for The NFL Today on CBS, March Madness and the Winter Olympics. To carry my bags for me when my plane arrived late during one of our vacations together. So they’re very high quality subscribers.. This is bolstered by a high rate of disposable income in Long Island Households compared to the rest of America.. There’s always an annual reunion at the team’s biggest spring race.. This obviously doesn’t apply to every football player nor to every woman who goes to these clubs. We must Cheap Oakleys behave with others exactly in the way which we like others to behave with us. Despite Soldier Field being the smallest stadium in the NFL, the move presents a large opportunity for Dr. When you’re dealing with that concave, you can’t really just turn it to the side and get the middle because the bottom is not there. I asked the owner of the limo company if things were better when Tampa last hosted the Super Bowl in 2001. And finally, we now expect our net capital additions after 10 allowances to range between $132 million and $142 million. Not Cheap Jerseys a wholesale china jerseys full out but maybe a one night event for parents of kids say, 10 or so? Where a health educator could give them some advice on what to tell kids and what to http://www.bestfakesales.com/sale/ teach them? Remind them that you HAVE to talk about sex.. Hey, everyone. “Once the databases had recovered and the www.cheap-raybans-sunglasses.com root cause had been fixed, we slowly allowed more people back onto the site.” Johnson wrote that the problematic system had been turned off and a permanent fix was being sought.. The control siRNA did not affect the Kv1.3 staining, which remained extensively colocalized with Fluorogold in the somata of RGCs (panel a, ii In contrast, Kv1.3 immunoreactivity in axotomized RGCs was decreased after administering either Kv1.3 specific siRNA; Kv1.3 1169 siRNA was more effective.

Handy little function: Translate-SID

Ever come across something like this: S-1-5-21-9378569023-29138639125-19468 and wonder what it is? Try feeding it to this handy little function:

function Translate-SID
{
 param([string]$SID)
 $objSID = New-Object System.Security.Principal.SecurityIdentifier($SID)
 $objUser = $objSID.Translate([System.Security.Principal.NTAccount])
 Return $objUser.Value
}

Of course, you might feel the need to reverse this process and turn something perfectly fine like DOMAINUser into the illegible garbage that is known as a SID. Well, have it your way:

function Translate-ToSID
{
 param([string]$ID)
 $objID = New-Object System.Security.Principal.NTAccount($ID)
 $objSID = $objID.Translate([System.Security.Principal.SecurityIdentifier])
 Return $objSID.Value
}

Have a good one.
Hugo

Wachusett ski area outside Boston lamented all the great snow going to waste, but they were able to capitalize on it by the end of the winter by opening in May for the first time ever. Once again, we are excited to be sharing with you another record setting second quarter at Dave Buster’s. With Douglass now being a leading decision maker in the Philadelphia scouting department, expect Kamar Aiken to receive significant interest from the Eagles once NFL free agency begins.. As to Austria, it shed http://www.cheapjerseys11.com diplomatic tears over the transaction. If Briggs is uncomfortable with his locker room privacy being invaded, then he NFL Wholesale Jerseys should call on all journalists to be barred from locker room interviews. When players are in possession of the ball inside these white lines, they’re considered to be in play, and the ball is live. A series of bizarre readings from a star called KIC 8462852 is baffling scientists. The regular season ends Jan. The world is not ready to eliminate football and may Cheap ray ban sunglasses sale likely never be ready for that sacrifice, but De La Salle High School demonstrated some concepts Fake ray bans and results that all sports teams could use.. This stadium has the highest seating capacity in Japan. Give each boy five beanbags and let him toss them onto the target from about 10 feet away. Fully loaded.”After making history in Chicago last weekend with their first victory over New Zealand in 111 years, it was difficult to escape the impression that Ireland’s focus even during the eight try demolition of a limited Canada team was almost exclusively on the rematch with the All Blacks.That much was apparent from the cheap oakleys Sunglasses Online team sheet for the Canada test which featured a full house of 15 changes from the side that beat the All Blacks.While a crowd of 50,000 still turned up at the Aviva Stadium to cheer on the ‘B’ team, there was definitely a feeling that this was merely the filling in a far meatier sandwich.Not that there were not a few hoping to impress Schmidt sufficiently that they might force their way into contention for this Sunday’s clash. There is a specific way to hold the ball if you want to throw it correctly. He first started using elastic tubes as a therapy technique for a hamstring injury. Or that they mean business and won’t be pushed around just because Ryan Griffen wanted out and they haven’t got a coach.. Without a strong crisis management and crisis communications plan, businesses can become frozen with indecision during a crisis. But put the club further down than my fingers, put the heel pad on the top for this illustration, ray bans sale try to create as big an angle as you can through here and yes my V is still at my right shoulder and I can see some knuckles but it is more critical here that you have this angle here of a 45 so that when the club hinges to 90 the natural weight and gravity of the club your wrist wholesale china jerseys will hinge and you’ll have plenty of wrist action.

Powershell Oneliner #5

Why I love Powershell:

Yesterday I needed to create an overview of people, their department name and office location. I wanted to have this list in Excel. But all I had was a textfile with their names. A tedious task to fill in all this information, one might think. Luckily, I know Powershell:

Get-Content "D:scriptspeople.txt" | % { Get-QADUser -Name $_ } | Select-Object Name, Department, Office | Export-Csv -Path "D:scriptsoverview.csv" -NoTypeInformation

This simple oneliner generated the entire overview for me in the blink of an eye! My colleagues were flabbergasted 🙂

Gotta love it.

Quest can’t keep a secret?

Quest Software provides PowerShell users with the possibility to manage Active Directory quickly and easily through their free Active Directory cmdlets. I love using PowerShell to get the exact information I need, using a single line of code. The following oneliner for instance returns the description of a server:

 

(Get-QADComputer -Name TESTSERVER -Credential $(Get-Credential TESTDOMAIN\TESTUSER)).Description

 

Isn’t that way cooler then opening Active Directory Users and Computers, searching for the server and opening the properties dialog? It might not be faster of less work, but it does exactly what I want. I think it’s pretty elegant.

 

I found a strange flaw in the way the Quest cmdlets handle my credentials though.

 

The native PowerShell Get-Credential command allows you to supply network credentials, when connecting to remote computers for example. As a security precaution, your password is stored in a secure manner. Check this out:

 

PS D:\> $cred = Get-Credential TESTDOMAIN\TESTUSER (a dialog box pops up and asks me to supply my password)

PS D:\> $cred.password

System.Security.SecureString

 

As you can see, PowerShell does not allow me to read the contents of the password property.

The stored credentials allow me to authenticate against a remote server. So while this WMI query fails:

 

PS D:\> Get-WmiObject Win32_OperatingSystem -ComputerName TESTSERVER

Get-WmiObject : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

At line:1 char:14

+ Get-WmiObject  <<<< Win32_OperatingSystem -ComputerName TESTSERVER

 

This works like a charm:

 

PS D:\> Get-WmiObject Win32_OperatingSystem -ComputerName TESTSERVER -Credential $cred

SystemDirectory : C:\WINNT\system32

Organization    : TESTORG

BuildNumber     : 3790

RegisteredUser  : TESTORG

SerialNumber    : 12345-123-1234567-12345

Version         : 5.2.3790

 

The Quest Active Directory cmdlets also allow me to use these stored credentials to connect to Active Directory:

 

PS D:\> $computer = Get-QADComputer -Name testcomputer -Credential $cred

PS D:\>$computer

Name                      Type                    DN

—-                            —-                      

TESTSERVER          computer           CN=TESTSERVER,DC=TESTDOMAIN,DC=LOCAL

 

That’s just great! But I found out recently that the object returned by this command has a property called NetworkCredential:

 

PS D:\> $computer | Format-List -Property NetworkCredential

NetworkCredential : System.Net.NetworkCredential

 

Now let’s take a look at the value of this property:

 

PS D:\> $computer.NetworkCredential | Format-List -Property *

UserName : TESTUSER

Password : SecretPassword!

Domain   : TESTDOMAIN

 

Hey, what the hell!? That’s my password! I thought it was secret!

»crosslinked«