mirror of
https://github.com/EvotecIT/GPOZaurr.git
synced 2026-08-10 18:57:23 +00:00
Fixes for duplicate guids
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
$GPOs = Get-GPOZaurr #-GPOName 'New Group Policy Object'
|
||||
$GPOs | Format-Table DisplayName, Owner, OwnerSID, OwnerType
|
||||
|
||||
Set-GPOZaurrOwner -Type EmptyOrUnknown -Verbose -LimitProcessing 1 -WhatIf
|
||||
Set-GPOZaurrOwner -Type NonAdministrative -Verbose -LimitProcessing 1 -WhatIf
|
||||
|
||||
$GPOs = Get-GPOZaurr #-GPOName 'New Group Policy Object'
|
||||
$GPOs | Format-Table DisplayName, Owner, OwnerSID
|
||||
@@ -18,25 +18,4 @@ Invoke-GPOZaurrPermission -Linked Root -Verbose { #-IncludePermissionType GpoEdi
|
||||
Remove-GPOPermission -Type NotAdministrative, NotWellKnownAdministrative -IncludePermissionType GpoEdit, GpoEditDeleteModifySecurity
|
||||
Add-GPOPermission -Type Administrative -IncludePermissionType GpoEditDeleteModifySecurity
|
||||
#Add-GPOPermission -Type WellKnownAdministrative -IncludePermissionType GpoEditDeleteModifySecurity
|
||||
} #-WhatIf #| Format-Table *
|
||||
#-ApprovedGroups $ApprovedGroups -Trustee $RootGroups -TrusteeType Name -TrusteePermissionType GpoEditDeleteModifySecurity -WhatIf | Format-Table *
|
||||
|
||||
|
||||
return
|
||||
Get-GPOZaurrLink -Linked Root | ForEach-Object {
|
||||
Get-GPOZaurrPermission -GPOGuid $_.GUID -IncludePermissionType 'GpoEdit', 'GpoEditDeleteModifySecurity' -Type 'NotAdministrative', 'NotWellKnownAdministrative' -IncludeGPOObject | ForEach-Object {
|
||||
$_
|
||||
}
|
||||
} | Format-Table -a *
|
||||
|
||||
#Get-GPOZaurrLink -Linked Site | Format-Table -AutoSize
|
||||
|
||||
#Get-GPOZaurrLink -Linked DomainControllers | Format-Table -AutoSize
|
||||
|
||||
#Get-GPOZaurrLink -Linked Other | Format-Table -AutoSize
|
||||
|
||||
#Get-GPOZaurrLink -SearchBase 'CN=Configuration,DC=ad,DC=evotec,DC=xyz' | Format-Table -AutoSize
|
||||
|
||||
#Get-AdObject -SearchBase 'DC=ad,DC=evotec,DC=xyz' -Server 'ad.evotec.xyz' -Filter "(ObjectClass -eq 'site') -or (ObjectClass -eq 'organizationalUnit' -or ObjectClass -eq 'domainDNS')" -SearchScope Subtree #
|
||||
|
||||
#Get-ADObject -SearchBase 'CN=Configuration,DC=ad,DC=evotec,DC=xyz' | fl
|
||||
} #-WhatIf #| Format-Table *
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
}
|
||||
}
|
||||
RequiredModules = @{
|
||||
ModuleVersion = '0.0.137'
|
||||
ModuleVersion = '0.0.138'
|
||||
ModuleName = 'PSSharedGoods'
|
||||
Guid = 'ee272aa8-baaa-4edf-9f45-b6d6f7d844fe'
|
||||
}, @{
|
||||
|
||||
@@ -8,19 +8,21 @@
|
||||
if ($Object.GpLink -and $Object.GpLink.Trim() -ne '') {
|
||||
$Object.GpLink -split { $_ -eq '[' -or $_ -eq ']' } -replace ';0' -replace 'LDAP://' | ForEach-Object -Process {
|
||||
if ($_) {
|
||||
$DomainCN = ConvertFrom-DistinguishedName -DistinguishedName $_ -ToDomainCN
|
||||
$Output = [ordered] @{
|
||||
DistinguishedName = $Object.DistinguishedName
|
||||
CanonicalName = $Object.CanonicalName
|
||||
Guid = [Regex]::Match( $_, '(?={)(.*)(?<=})').Value -replace '{' -replace '}'
|
||||
}
|
||||
$Search = -join ($DomainCN, $Output['Guid'])
|
||||
if ($GPOCache -and -not $Limited) {
|
||||
$Output['DisplayName'] = $GPOCache[$Output['Guid']].DisplayName
|
||||
$Output['DomainName'] = $GPOCache[$Output['Guid']].DomainName
|
||||
$Output['Owner'] = $GPOCache[$Output['Guid']].Owner
|
||||
$Output['GpoStatus'] = $GPOCache[$Output['Guid']].GpoStatus
|
||||
$Output['Description'] = $GPOCache[$Output['Guid']].Description
|
||||
$Output['CreationTime'] = $GPOCache[$Output['Guid']].CreationTime
|
||||
$Output['ModificationTime'] = $GPOCache[$Output['Guid']].ModificationTime
|
||||
$Output['DisplayName'] = $GPOCache[$Search].DisplayName
|
||||
$Output['DomainName'] = $GPOCache[$Search].DomainName
|
||||
$Output['Owner'] = $GPOCache[$Search].Owner
|
||||
$Output['GpoStatus'] = $GPOCache[$Search].GpoStatus
|
||||
$Output['Description'] = $GPOCache[$Search].Description
|
||||
$Output['CreationTime'] = $GPOCache[$Search].CreationTime
|
||||
$Output['ModificationTime'] = $GPOCache[$Search].ModificationTime
|
||||
}
|
||||
$Output['GPODomainDistinguishedName'] = ConvertFrom-DistinguishedName -DistinguishedName $_ -ToDC
|
||||
$Output['GPODistinguishedName'] = $_
|
||||
@@ -30,19 +32,21 @@
|
||||
} elseif ($Object.LinkedGroupPolicyObjects -and $Object.LinkedGroupPolicyObjects.Trim() -ne '') {
|
||||
$Object.LinkedGroupPolicyObjects -split { $_ -eq '[' -or $_ -eq ']' } -replace ';0' -replace 'LDAP://' | ForEach-Object -Process {
|
||||
if ($_) {
|
||||
$DomainCN = ConvertFrom-DistinguishedName -DistinguishedName $_ -ToDomainCN
|
||||
$Output = [ordered] @{
|
||||
DistinguishedName = $Object.DistinguishedName
|
||||
CanonicalName = $Object.CanonicalName
|
||||
Guid = [Regex]::Match( $_, '(?={)(.*)(?<=})').Value -replace '{' -replace '}'
|
||||
}
|
||||
$Search = -join ($DomainCN, $Output['Guid'])
|
||||
if ($GPOCache -and -not $Limited) {
|
||||
$Output['Name'] = $GPOCache[$Output['Guid']].DisplayName
|
||||
$Output['DomainName'] = $GPOCache[$Output['Guid']].DomainName
|
||||
$Output['Owner'] = $GPOCache[$Output['Guid']].Owner
|
||||
$Output['GpoStatus'] = $GPOCache[$Output['Guid']].GpoStatus
|
||||
$Output['Description'] = $GPOCache[$Output['Guid']].Description
|
||||
$Output['CreationTime'] = $GPOCache[$Output['Guid']].CreationTime
|
||||
$Output['ModificationTime'] = $GPOCache[$Output['Guid']].ModificationTime
|
||||
$Output['Name'] = $GPOCache[$Search].DisplayName
|
||||
$Output['DomainName'] = $GPOCache[$Search].DomainName
|
||||
$Output['Owner'] = $GPOCache[$Search].Owner
|
||||
$Output['GpoStatus'] = $GPOCache[$Search].GpoStatus
|
||||
$Output['Description'] = $GPOCache[$Search].Description
|
||||
$Output['CreationTime'] = $GPOCache[$Search].CreationTime
|
||||
$Output['ModificationTime'] = $GPOCache[$Search].ModificationTime
|
||||
}
|
||||
$Output['GPODomainDistinguishedName'] = ConvertFrom-DistinguishedName -DistinguishedName $_ -ToDC
|
||||
$Output['GPODistinguishedName'] = $_
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
foreach ($Domain in $ForestInformation.Domains) {
|
||||
$QueryServer = $ForestInformation['QueryServers'][$Domain]['HostName'][0]
|
||||
Get-GPO -All -DomainName $Domain -Server $QueryServer | ForEach-Object {
|
||||
$GPOCache[$_.ID.Guid] = $_
|
||||
$GPOCache["$Domain$($_.ID.Guid)"] = $_
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user