@@ -5077,22 +5077,26 @@ function Get-NetGroup {
5077
5077
A [Management.Automation.PSCredential] object of alternate credentials
5078
5078
for connection to the target domain.
5079
5079
5080
+ . PARAMETER AllTypes
5081
+
5082
+ By default we will retrieve only Security, not Distribution Groups.
5083
+
5080
5084
. EXAMPLE
5081
5085
5082
5086
PS C:\> Get-NetGroup
5083
-
5084
- Returns the current groups in the domain.
5087
+
5088
+ Returns the current security groups in the domain.
5085
5089
5086
5090
. EXAMPLE
5087
5091
5088
5092
PS C:\> Get-NetGroup -GroupName *admin*
5089
-
5093
+
5090
5094
Returns all groups with "admin" in their group name.
5091
5095
5092
5096
. EXAMPLE
5093
5097
5094
5098
PS C:\> Get-NetGroup -Domain testing -FullData
5095
-
5099
+
5096
5100
Returns full group data objects in the 'testing' domain
5097
5101
#>
5098
5102
@@ -5113,10 +5117,10 @@ function Get-NetGroup {
5113
5117
5114
5118
[String ]
5115
5119
$Domain ,
5116
-
5120
+
5117
5121
[String ]
5118
5122
$DomainController ,
5119
-
5123
+
5120
5124
[String ]
5121
5125
$ADSpath ,
5122
5126
@@ -5129,7 +5133,10 @@ function Get-NetGroup {
5129
5133
[Switch ]
5130
5134
$RawSids ,
5131
5135
5132
- [ValidateRange (1 , 10000 )]
5136
+ [Switch ]
5137
+ $AllTypes ,
5138
+
5139
+ [ValidateRange (1 , 10000 )]
5133
5140
[Int ]
5134
5141
$PageSize = 200 ,
5135
5142
@@ -5139,6 +5146,10 @@ function Get-NetGroup {
5139
5146
5140
5147
begin {
5141
5148
$GroupSearcher = Get-DomainSearcher - Domain $Domain - DomainController $DomainController - Credential $Credential - ADSpath $ADSpath - PageSize $PageSize
5149
+ if (! $AllTypes )
5150
+ {
5151
+ $Filter += " (groupType:1.2.840.113556.1.4.803:=2147483648)"
5152
+ }
5142
5153
}
5143
5154
5144
5155
process {
@@ -5193,7 +5204,7 @@ function Get-NetGroup {
5193
5204
else {
5194
5205
$GroupSearcher.filter = " (&(objectCategory=group)(samaccountname=$GroupName )$Filter )"
5195
5206
}
5196
-
5207
+
5197
5208
$Results = $GroupSearcher.FindAll ()
5198
5209
$Results | Where-Object {$_ } | ForEach-Object {
5199
5210
# if we're returning full data objects
0 commit comments