Get-ADGroup


posted by Richard Giles
10-06-2008

Downloads: 476
File size: 1.3kB
Views: 3,980

Embed
Get-ADGroup
  1. ## ===================================================================== 
  2. ## Title       : Get-ADGroup 
  3. ## Description : Get Active Directory Group Properties 
  4. ## Author      : Idera 
  5. ## Date        : 9/22/2008 
  6. ## Input       : -server  
  7. ##               -domain 
  8. ##               -ou 
  9. ##               -group 
  10. ##               -verbose  
  11. ##               -debug    
  12. ## Output      :  
  13. ## Usage       : PS> . Get-ADGroup -server localhost:389 -domain Idera -ou sales -group Management -v -d 
  14. ## Notes       : Adapted from Windows PowerShell Cookbook, Lee Holmes 
  15. ## Tag         : PowerShell, AD 
  16. ## Change log  : 
  17. ## ===================================================================== 
  18.  
  19. param 
  20.    [string]$server = "localhost:389"
  21.    [string]$domain = "Idera"
  22.    [string]$ou = "sales"
  23.    [string]$group = "Management"
  24.    [switch]$verbose
  25.    [switch]$debug 
  26.  
  27. function main() 
  28.     if ($verbose) {$VerbosePreference = "Continue"
  29.     if ($debug) {$DebugPreference = "Continue"
  30.     Get-ADGroup $server $domain $ou $group 
  31.  
  32. function Get-ADGroup($server,$domain,$ou,$group
  33.     trap [Exception]  
  34.     
  35.         write-error $("TRAPPED: " + $_.Exception.Message); 
  36.         continue
  37.     
  38.  
  39.     $domainObj = [adsi]"LDAP://$server/cn=$group,ou=$ou,dc=$domain,dc=COM" 
  40.    $domainObj | Format-List * 
  41.  
  42. main 
Filed under: ,

Get properties of an Active Directory Group

Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.