Archive

Archive for the ‘PowerShell’ Category

PowerShell: Get Active Directory groups membership for a user

22/10/2013 2 comments

Hi,

When you have to document every change ¬†Because¬†you’re committed to SOX regulation, you need to extract the data fast

This PowerShell script receive an AD username and export .csv with all Active Directory groups (for Fast Copy&Past).

import-module ActiveDirectory
$name = Read-Host ‘What is the username?’
$csvvv = “.csv”
Get-ADPrincipalGroupMembership $name | select name | Export-CSV ($name+$csvvv)

Save it as .ps1 and run it from the powershell command line,

Advertisements