Sign in
|
Join PowerShell.com!
|
Help
Home
PowerTips
Ask the Experts
Forums
Webcasts
Blogs
eBookV2
Script Library
Twitter Grid
Modules
QuickClick
Scripts
Snippets
Videos
Library
»
Script Library
»
Active Directory
»
Get-ADGroup
Get-ADGroup
Share
|
Browse Library
Module Library
QuickClick Library
Script Library
Active Directory
BizTalk
Citrix
Clustering
Desktop
Exchange Server 2003
Exchange Server 2007
File System
Group Policy
Internet Information Server (IIS)
Local Accounts
Logs
Microsoft Office
Microsoft Team Foundation Server
MySQL
Networking
Registry
Remote Desktop Services
Remoting
Security
SharePoint
SQL Server
System Center Virtual Machine Manager
System Center Configuration Manager
System Center Operations Manager
Tutorial
Terminal Server
Using .Net
Virtual Server
VMware
Windows 7
Windows HPC
Windows Server 2000
Windows Server 2003
Windows Server 2008
Windows XP
WMI
Misc
Snippet Library
Video Library
Members Only
Tags
Active Directory
ad
Administrator
aman dhally
Computer
Deleted
DirectorySearcher
domain
Domain Controller
Exchange
Exchange 2003
Forest
fsmo
Group
local
Member
OU
Password
script
search
Security
Site
Tombstone
User
Users
View more
Previous
|
Next
|
View all files
|
View Slideshow
Download
posted by
Richard Giles
10-06-2008
Downloads: 476
File size: 1.3kB
Views: 3,980
Embed
Get-ADGroup
## =====================================================================
## Title
: Get-ADGroup
## Description : Get Active Directory Group Properties
## Author
: Idera
## Date
: 9/22/2008
## Input
: -server
##
-domain
##
-ou
##
-group
##
-verbose
##
-debug
## Output
:
## Usage
: PS> . Get-ADGroup -server localhost:389 -domain Idera -ou sales -group Management -v -d
## Notes
: Adapted from Windows PowerShell Cookbook, Lee Holmes
## Tag
: PowerShell, AD
## Change log
:
## =====================================================================
param
(
[
string
]
$server
=
"localhost:389"
,
[
string
]
$domain
=
"Idera"
,
[
string
]
$ou
=
"sales"
,
[
string
]
$group
=
"Management"
,
[
switch
]
$verbose
,
[
switch
]
$debug
)
function
main()
{
if
(
$verbose
) {
$VerbosePreference
=
"Continue"
}
if
(
$debug
) {
$DebugPreference
=
"Continue"
}
Get-ADGroup
$server
$domain
$ou
$group
}
function
Get-ADGroup
(
$server
,
$domain
,
$ou
,
$group
)
{
trap
[
Exception
]
{
write-error
$
(
"TRAPPED: "
+
$_
.
Exception.Message
);
continue
;
}
$domainObj
=
[
adsi
]
"LDAP://$server/cn=$group,ou=$ou,dc=$domain,dc=COM"
$domainObj
|
Format-List
*
}
main
Filed under:
Active Directory
,
Group
Get properties of an Active Directory Group
Copyright 2011 PowerShell.com. All rights reserved.