Skip to content
This repository was archived by the owner on Jan 21, 2021. It is now read-only.

Commit 783bff3

Browse files
committed
-Added "-GroupScope [DomainLocal/Global/Universal]" to Get-DomainGroup
-Added "-GroupProperty [Security/Distribution/CreatedBySystem]" to Get-DomainGroup
1 parent 30c5177 commit 783bff3

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

Recon/PowerView.ps1

+36
Original file line numberDiff line numberDiff line change
@@ -8748,6 +8748,15 @@ specifying the user/group member to query for group membership.
87488748

87498749
Switch. Return users with '(adminCount=1)' (meaning are/were privileged).
87508750

8751+
.PARAMETER GroupScope
8752+
8753+
Specifies the scope (DomainLocal, Global, or Universal) of the group(s) to search for.
8754+
8755+
.PARAMETER GroupProperty
8756+
8757+
Specifies a specific property to search for when performing the group search.
8758+
Possible values are Security, Distribution, and CreatedBySystem.
8759+
87518760
.PARAMETER Domain
87528761

87538762
Specifies the domain to use for the query, defaults to the current domain.
@@ -8910,6 +8919,15 @@ Custom PSObject with translated group property fields.
89108919
[Switch]
89118920
$AdminCount,
89128921

8922+
[ValidateSet('DomainLocal', 'Global', 'Universal')]
8923+
[Alias('Scope')]
8924+
[String]
8925+
$GroupScope,
8926+
8927+
[ValidateSet('Security', 'Distribution', 'CreatedBySystem')]
8928+
[String]
8929+
$GroupProperty,
8930+
89138931
[ValidateNotNullOrEmpty()]
89148932
[String]
89158933
$Domain,
@@ -9054,6 +9072,24 @@ Custom PSObject with translated group property fields.
90549072
Write-Verbose '[Get-DomainGroup] Searching for adminCount=1'
90559073
$Filter += '(admincount=1)'
90569074
}
9075+
if ($PSBoundParameters['GroupScope']) {
9076+
$GroupScopeValue = $PSBoundParameters['GroupScope']
9077+
$Filter = Switch ($GroupScopeValue) {
9078+
'DomainLocal' { '(groupType:1.2.840.113556.1.4.803:=4)' }
9079+
'Global' { '(groupType:1.2.840.113556.1.4.803:=2)' }
9080+
'Universal' { '(groupType:1.2.840.113556.1.4.803:=8)' }
9081+
}
9082+
Write-Verbose "[Get-DomainGroup] Searching for group scope '$GroupScopeValue'"
9083+
}
9084+
if ($PSBoundParameters['GroupProperty']) {
9085+
$GroupPropertyValue = $PSBoundParameters['GroupProperty']
9086+
$Filter = Switch ($GroupPropertyValue) {
9087+
'Security' { '(groupType:1.2.840.113556.1.4.803:=2147483648)' }
9088+
'Distribution' { '(!(groupType:1.2.840.113556.1.4.803:=2147483648))' }
9089+
'CreatedBySystem' { '(groupType:1.2.840.113556.1.4.803:=1)' }
9090+
}
9091+
Write-Verbose "[Get-DomainGroup] Searching for group property '$GroupPropertyValue'"
9092+
}
90579093
if ($PSBoundParameters['LDAPFilter']) {
90589094
Write-Verbose "[Get-DomainGroup] Using additional LDAP filter: $LDAPFilter"
90599095
$Filter += "$LDAPFilter"

0 commit comments

Comments
 (0)