Compare commits

...

27 Commits

Author SHA1 Message Date
Przemyslaw Klys 7d85d41747 Text improvement 2021-01-24 16:48:37 +01:00
Przemyslaw Klys a1fab2ceb2 Text improvement 2021-01-24 10:28:35 +01:00
Przemyslaw Klys 99f07f61e3 Text improvement 2021-01-24 10:28:29 +01:00
Przemyslaw Klys 58136f0c43 Update psd1 2021-01-22 12:40:45 +01:00
Przemyslaw Klys b55729d8e0 Update deployment module 2021-01-22 12:40:36 +01:00
Przemyslaw Klys 6206a33a2e Update readme 2021-01-22 12:40:27 +01:00
Przemyslaw Klys 165381b1e3 Small update 2021-01-22 12:39:53 +01:00
Przemyslaw Klys ea1de10fd9 Update readme 2021-01-11 10:30:41 +01:00
Przemyslaw Klys 03453b6bdb PSD1 update 2021-01-11 10:27:41 +01:00
Przemyslaw Klys 4d7f49902d Update 2021-01-11 10:27:34 +01:00
Przemyslaw Klys 508d778d06 Update consistency report 2021-01-11 10:14:01 +01:00
Przemyslaw Klys 5c3157f15f Update psd1 2021-01-11 10:13:54 +01:00
Przemyslaw Klys b33f42b320 Update readme 2021-01-11 10:13:48 +01:00
Przemyslaw Klys f8d3b363e7 Update list 2021-01-11 09:52:59 +01:00
Przemyslaw Klys a68d917d19 Small test 2021-01-11 09:51:10 +01:00
Przemyslaw Klys 946bb3029f Update 2021-01-11 09:51:04 +01:00
Przemyslaw Klys 975bf5b889 Update PSD1 2021-01-11 09:00:13 +01:00
Przemyslaw Klys 6fa0818375 Update Examples 2021-01-11 08:59:35 +01:00
Przemyslaw Klys 2abec9579a Update Invoke-GPOZaurrContent 2021-01-11 08:58:51 +01:00
Przemyslaw Klys 75a8083368 Update PSD1/Readme 2021-01-11 08:58:24 +01:00
Przemyslaw Klys 06c711694e Update readme/psd1 2021-01-05 13:32:57 +01:00
Przemyslaw Klys 8a38ac4556 Improved report 2021-01-05 13:31:45 +01:00
Przemyslaw Klys 9d2ae288c0 Update PSD1/Readme 2021-01-04 21:47:54 +01:00
Przemyslaw Klys 0bc50328ee solves issue when gpLink is empty 2021-01-04 21:47:26 +01:00
Przemyslaw Klys a74b662c9b Prevent errors from doing harm 2021-01-04 21:29:57 +01:00
Przemyslaw Klys 37d8db92f7 Update to make sure it works properly for domains 2021-01-04 21:15:49 +01:00
Przemyslaw Klys d094344f9f Update docs 2021-01-04 21:15:28 +01:00
19 changed files with 219 additions and 80 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
Get-GPOZaurrLink | Format-Table -AutoSize *
Get-GPOZaurrLink -Verbose | Format-Table -AutoSize *
+1 -1
View File
@@ -1,4 +1,4 @@
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
$Output = Invoke-GPOZaurrContent -Verbose -OutputType HTML, Object -Open
$Output = Invoke-GPOZaurrContent -Verbose -OutputType HTML, Object -Open -Type LocalGroups
$Output | Format-Table
+1 -1
View File
@@ -1,4 +1,4 @@
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
#$Output = Invoke-GPOZaurr -FilePath $PSScriptRoot\Reports\GPOZaurr.html -PassThru -Type GPOConsistency, GPOList, GPODuplicates, GPOOrphans, GPOOwners, NetLogonOwners, GPOPermissionsRead, GPOPermissionsAdministrative,GPOPermissionsUnknown
Invoke-GPOZaurr -FilePath $PSScriptRoot\Reports\GPOZaurr.html -Type GPOPermissions,GPOPermissionsRead
Invoke-GPOZaurr -FilePath $PSScriptRoot\Reports\GPOZaurr.html -Type GPOBrokenLink
@@ -0,0 +1,5 @@
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
#Get-GPOZaurrBrokenLink -Verbose | Format-Table -AutoSize *
Get-GPOZaurrBrokenLink -Verbose -IncludeDomains ad.evotec.pl | Format-Table -AutoSize *
@@ -0,0 +1,5 @@
Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
Repair-GPOZaurrBrokenLink -Verbose -LimitProcessing 1 -WhatIf
#Repair-GPOZaurrBrokenLink -Verbose -IncludeDomains ad.evotec.pl -LimitProcessing 30 #-WhatIf
+4 -4
View File
@@ -8,7 +8,7 @@
Description = 'Group Policy Eater is a PowerShell module that aims to gather information about Group Policies but also allows fixing issues that you may find in them.'
FunctionsToExport = @('Add-GPOPermission', 'Add-GPOZaurrPermission', 'Backup-GPOZaurr', 'Clear-GPOZaurrSysvolDFSR', 'ConvertFrom-CSExtension', 'Find-CSExtension', 'Get-GPOZaurr', 'Get-GPOZaurrAD', 'Get-GPOZaurrBackupInformation', 'Get-GPOZaurrBroken', 'Get-GPOZaurrBrokenLink', 'Get-GPOZaurrDictionary', 'Get-GPOZaurrDuplicateObject', 'Get-GPOZaurrFiles', 'Get-GPOZaurrFilesPolicyDefinition', 'Get-GPOZaurrFolders', 'Get-GPOZaurrInheritance', 'Get-GPOZaurrLegacyFiles', 'Get-GPOZaurrLink', 'Get-GPOZaurrLinkSummary', 'Get-GPOZaurrNetLogon', 'Get-GPOZaurrOwner', 'Get-GPOZaurrPassword', 'Get-GPOZaurrPermission', 'Get-GPOZaurrPermissionAnalysis', 'Get-GPOZaurrPermissionConsistency', 'Get-GPOZaurrPermissionIssue', 'Get-GPOZaurrPermissionRoot', 'Get-GPOZaurrPermissionSummary', 'Get-GPOZaurrSysvolDFSR', 'Get-GPOZaurrWMI', 'Invoke-GPOZaurr', 'Invoke-GPOZaurrContent', 'Invoke-GPOZaurrPermission', 'Invoke-GPOZaurrSupport', 'New-GPOZaurrWMI', 'Optimize-GPOZaurr', 'Remove-GPOPermission', 'Remove-GPOZaurr', 'Remove-GPOZaurrBroken', 'Remove-GPOZaurrDuplicateObject', 'Remove-GPOZaurrFolders', 'Remove-GPOZaurrLegacyFiles', 'Remove-GPOZaurrPermission', 'Remove-GPOZaurrWMI', 'Repair-GPOZaurrBrokenLink', 'Repair-GPOZaurrNetLogonOwner', 'Repair-GPOZaurrPermission', 'Repair-GPOZaurrPermissionConsistency', 'Restore-GPOZaurr', 'Save-GPOZaurrFiles', 'Set-GPOOwner', 'Set-GPOZaurrOwner', 'Set-GPOZaurrStatus', 'Skip-GroupPolicy')
GUID = 'f7d4c9e4-0298-4f51-ad77-e8e3febebbde'
ModuleVersion = '0.0.103'
ModuleVersion = '0.0.110'
PowerShellVersion = '5.1'
PrivateData = @{
PSData = @{
@@ -18,15 +18,15 @@
}
}
RequiredModules = @(@{
ModuleVersion = '0.0.192'
ModuleVersion = '0.0.194'
ModuleName = 'PSSharedGoods'
Guid = 'ee272aa8-baaa-4edf-9f45-b6d6f7d844fe'
}, @{
ModuleVersion = '0.0.103'
ModuleVersion = '0.0.107'
ModuleName = 'ADEssentials'
Guid = '9fc9fd61-7f11-4f4b-a527-084086f1905f'
}, @{
ModuleVersion = '0.0.122'
ModuleVersion = '0.0.130'
ModuleName = 'PSWriteHTML'
Guid = 'a7bdf640-f5cb-4acf-9de0-365b322d245c'
}, 'CimCmdlets', 'Microsoft.PowerShell.Management', 'Microsoft.PowerShell.Utility', 'Microsoft.PowerShell.Security')
+1
View File
@@ -42,6 +42,7 @@
$DomainCN = ConvertFrom-DistinguishedName -DistinguishedName $DN -ToDomainCN
$Output = [ordered] @{
DistinguishedName = $Object.DistinguishedName
#Domain = ConvertFrom-DistinguishedName -DistinguishedName $Object.DistinguishedName -ToDomainCN
CanonicalName = if ($Object.CanonicalName) { $Object.CanonicalName.TrimEnd('/') } else { $Object.CanonicalName }
Guid = [Regex]::Match($DN, '(?={)(.*)(?<=})').Value -replace '{' -replace '}'
Enforced = $Enforced
+14 -11
View File
@@ -39,9 +39,11 @@ $GPOZaurrBrokenLink = [ordered] @{
}
Summary = {
New-HTMLText -FontSize 10pt -TextBlock {
"When GPO is deleted in a proper way it usually is removed from AD, SYSVOL and any link to it is also discarded. "
"Unfortunetly this is true only if the GPO is created and linked within same domain. "
"If GPO is linked in another domain, this leaves a broken link hanging on wherever it was linked before. "
"When GPO is deleted correctly, it usually is removed from AD, SYSVOL, and any link to it is also discarded. "
"Unfortunately, this is true only if the GPO is created and linked within the same domain. "
"If GPO is linked in another domain, this leaves a broken link hanging on before it was linked. "
"Additionally, the Remove-GPO cmdlet doesn't handle site link deletions, which causes dead links to be stuck on sites until those are manually deleted. "
"This means that any GPOs deleted using PowerShell may leave a trail."
}
New-HTMLText -Text @(
'As it stands currently there are ',
@@ -49,14 +51,15 @@ $GPOZaurrBrokenLink = [ordered] @{
' broken links that need to be deleted over '
$Script:Reporting['GPOBrokenLink']['Variables']['UniqueObjects'].Count,
' unique objects. '
) -FontSize 10pt -FontWeight normal, bold, normal, bold, normal
New-HTMLText -Text 'Following domains require actions (permissions required):' -FontSize 10pt -FontWeight bold
New-HTMLList -Type Unordered {
foreach ($Domain in $Script:Reporting['GPOBrokenLink']['Variables']['WillFixPerDomain'].Keys) {
New-HTMLListItem -Text "$Domain requires ", $Script:Reporting['GPOBrokenLink']['Variables']['WillFixPerDomain'][$Domain], " changes." -FontWeight normal, bold, normal
}
} -FontSize 10pt
) -FontSize 10pt -FontWeight normal, bold, normal, bold, normal -LineBreak
if ($Script:Reporting['GPOBrokenLink']['Data'].Count -ne 0) {
New-HTMLText -Text 'Following domains require actions (permissions required):' -FontSize 10pt -FontWeight bold
New-HTMLList -Type Unordered {
foreach ($Domain in $Script:Reporting['GPOBrokenLink']['Variables']['WillFixPerDomain'].Keys) {
New-HTMLListItem -Text "$Domain requires ", $Script:Reporting['GPOBrokenLink']['Variables']['WillFixPerDomain'][$Domain], " changes." -FontWeight normal, bold, normal
}
} -FontSize 10pt
}
}
Solution = {
New-HTMLSection -Invisible {
+14 -9
View File
@@ -52,11 +52,12 @@
}
Summary = {
New-HTMLText -FontSize 10pt -TextBlock {
"When GPO is created it creates an entry in Active Directory (metadata) and SYSVOL (content). "
"Two different places meens two different sets of permissions. Group Policy module is making sure the data in both places is correct. "
"However, for different reasons it's not nessecary the case and often permissions go out of sync between AD and SYSVOL. "
"This test verifies consistency of policies between AD and SYSVOL in two ways. "
"It checks top level permissions for a GPO, and then checks if all files within said GPO are inheriting permissions or have different permissions in place. "
"When GPO is created, it creates an entry in Active Directory (metadata) and SYSVOL (content). "
"Two different places mean two different sets of permissions. "
"The group Policy module is making sure the data in both places is correct. "
"However, it's not necessarily the case for different reasons, and often permissions go out of sync between AD and SYSVOL. "
"This test verifies the consistency of policies between AD and SYSVOL in two ways. "
"It checks top-level permissions for a GPO and then checks if all files within said GPO is inheriting permissions or have different permissions in place."
}
New-HTMLText -Text 'Following list presents ', 'permissions consistency between Active Directory and SYSVOL for Group Policies' -FontSize 10pt -FontWeight normal, bold
New-HTMLList -Type Unordered {
@@ -111,10 +112,10 @@
New-HTMLCodeBlock -Code {
Invoke-GPOZaurr -FilePath $Env:UserProfile\Desktop\GPOZaurrPermissionsInconsistentBefore.html -Verbose -Type GPOConsistency
}
New-HTMLText -Text {
New-HTMLText -Text @(
"When executed it will take a while to generate all data and provide you with new report depending on size of environment."
"Once confirmed that data is still showing issues and requires fixing please proceed with next step."
}
)
New-HTMLText -Text "Alternatively if you prefer working with console you can run: "
New-HTMLCodeBlock -Code {
$GPOOutput = Get-GPOZaurrPermissionConsistency
@@ -143,8 +144,12 @@
New-HTMLText -Text "If there's nothing else to be fixed, we can skip to next step step"
}
New-HTMLWizardStep -Name 'Fix inconsistent downlevel permissions' {
New-HTMLText -Text "Unfortunetly this step is manual until automation is developed. "
New-HTMLText -Text "If there are inconsistent permissions found inside GPO one has to fix them manually by going into SYSVOL and making sure inheritance is enabled, and that permissions are consistent across all files."
New-HTMLText -Text @(
"Unfortunetly this step is manual until automation is developed. "
"If there are inconsistent permissions found inside GPO one has to fix them manually by going into SYSVOL and making sure inheritance is enabled, and that permissions are consistent across all files."
"Please keep in mind that it's possible inconsistent downlevel permissions fix will not be required once the top level fix is applied. "
"Rerun report to find out if you've just fixed top-level permissions. "
)
}
New-HTMLWizardStep -Name 'Verification report' {
New-HTMLText -TextBlock {
+7
View File
@@ -292,6 +292,13 @@
New-HTMLListItem -Text "$Domain requires ", $Script:Reporting['GPOList']['Variables']['GPONotOptimizedPerDomain'][$Domain], " changes." -FontWeight normal, bold, normal
}
} -FontSize 10pt
# Just in case report is too big and the full file is not attached
New-HTMLText -FontSize 10pt -Text "To generate up to date report please execute: " -FontWeight bold
New-HTMLList -Type Unordered {
New-HTMLListItem -Text 'Install-Module GPOZaurr -Force', ' or ', ' install module manually.' -Color RoyalBlue, None, None
New-HTMLListItem -Text 'Invoke-GPOZaurr -FilePath $Env:UserProfile\Desktop\GPOZaurrGPOPListBefore.html -Verbose -Type GPOList' -Color RoyalBlue
} -FontSize 10pt
New-HTMLText -FontSize 10pt -Text 'Steps above will generate above summary with more details allowing you to get up to date report and steps on how to fix it.'
}
Solution = {
New-HTMLSection -Invisible {
+13 -12
View File
@@ -77,18 +77,19 @@
#>
}
Summary = {
New-HTMLText -FontSize 10pt -TextBlock {
"By default GPO creation is usually maintained by Domain Admins or Enterprise Admins. "
"When GPO is created by member of Domain Admins or Enterprise Admins group the GPO Owner is set to Domain Admins. "
"When GPO is created by member of Group Policy Creator Owners or other group has delegated rights to create a GPO the owner of said GPO is not Domain Admins group but is assigned to relevant user. "
"GPO Owners should be Domain Admins or Enterprise Admins to prevent abuse. If that isn't so it means owner is able to fully control GPO and potentially change it's settings in uncontrolled way. "
"While at the moment of creation of new GPO it's not a problem, in long term it's possible such person may no longer be admin, yet keep their rights over GPO. "
}
New-HTMLText -FontSize 10pt -TextBlock {
"As you're aware Group Policies are stored in 2 places. In Active Directory (metadata) and SYSVOL (settings). This means that there are 2 places where GPO Owners exists. "
"This also means that for multiple reasons AD and SYSVOL can be out of sync when it comes to their permissions which can lead to uncontrolled ability to modify them. "
"Ownership in Active Directory and Ownership of SYSVOL for said GPO are required to be the same. "
}
New-HTMLText -FontSize 10pt -Text @(
"By default, GPO creation is usually maintained by Domain Admins or Enterprise Admins. "
"When GPO is created by Domain Admins or Enterprise Admins group members, the GPO Owner is set to Domain Admins. "
"When GPO is created by a member of Group Policy Creator Owners or other group has delegated rights to create a GPO, "
"the owner of said GPO is not Domain Admins group but is assigned to the relevant user. "
"GPO Owners should be Domain Admins or Enterprise Admins to prevent abuse. "
"If that isn't so, it means the owner can fully control GPO and potentially change its settings in an uncontrolled way. "
"While at the moment of creation of new GPO, it's not a problem, in the long term, it's possible such a person may no longer be admin, yet keep their rights over GPO. "
"As your aware, Group Policies are stored in 2 places. In Active Directory (metadata) and SYSVOL (settings). "
"This means that there are 2 places where GPO Owners exists. "
"This also means that for multiple reasons, AD and SYSVOL can be out of sync when it comes to their permissions, which can lead to uncontrolled ability to modify them. "
"Ownership in Active Directory and Ownership of SYSVOL for said GPO is required to be the same."
)
New-HTMLText -Text "Here's a short summary of ", "Group Policy Owners", ": " -FontSize 10pt -FontWeight normal, bold, normal
New-HTMLList -Type Unordered {
New-HTMLListItem -Text 'Administrative Owners: ', $Script:Reporting['GPOOwners']['Variables']['IsAdministrative'] -FontWeight normal, bold
-29
View File
@@ -1,29 +0,0 @@
$GPOZaurrPermissions = [ordered] @{
Name = 'Group Policy Permissions'
Enabled = $true
Action = $null
Data = $null
Execute = {
Get-GPOZaurrPermission -Type All -IncludePermissionType GpoEditDeleteModifySecurity, GpoEdit, GpoCustom -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains
}
Processing = {
}
Variables = @{
}
Overview = {
}
Solution = {
New-HTMLTable -DataTable $Script:Reporting['GPOPermissions']['Data'] -Filtering
if ($Script:Reporting['GPOPermissions']['WarningsAndErrors']) {
New-HTMLSection -Name 'Warnings & Errors to Review' {
New-HTMLTable -DataTable $Script:Reporting['GPOPermissions']['WarningsAndErrors'] -Filtering {
New-HTMLTableCondition -Name 'Type' -Value 'Warning' -BackgroundColor SandyBrown -ComparisonType string -Row
New-HTMLTableCondition -Name 'Type' -Value 'Error' -BackgroundColor Salmon -ComparisonType string -Row
}
}
}
}
}
@@ -279,7 +279,14 @@
foreach ($Domain in $Script:Reporting['GPOPermissions']['Variables']['WillFixUnknownPerDomain'].Keys) {
New-HTMLListItem -Text "$Domain requires ", $Script:Reporting['GPOPermissions']['Variables']['WillFixUnknownPerDomain'][$Domain], " changes." -FontWeight normal, bold, normal
}
} -FontSize 10pt -LineBreak
# Just in case report is too big and the full file is not attached
New-HTMLText -FontSize 10pt -Text "To generate up to date report please execute: " -FontWeight bold
New-HTMLList -Type Unordered {
New-HTMLListItem -Text 'Install-Module GPOZaurr -Force', ' or ', ' install module manually.' -Color RoyalBlue, None, None
New-HTMLListItem -Text 'Invoke-GPOZaurr -FilePath $Env:UserProfile\Desktop\GPOZaurrGPOPermissionsBefore.html -Verbose -Type GPOPermissions' -Color RoyalBlue
} -FontSize 10pt
New-HTMLText -FontSize 10pt -Text 'Steps above will generate above summary with more details allowing you to get up to date report and steps on how to fix it.'
}
Solution = {
New-HTMLSection -Invisible {
+44 -2
View File
@@ -1,4 +1,32 @@
function Get-GPOZaurrBrokenLink {
<#
.SYNOPSIS
Finds any GPO link that doesn't have a matching GPO (already removed GPO).
.DESCRIPTION
Finds any GPO link that doesn't have a matching GPO (already removed GPO).
.PARAMETER Forest
Target different Forest, by default current forest is used
.PARAMETER ExcludeDomains
Exclude domain from search, by default whole forest is scanned
.PARAMETER IncludeDomains
Include only specific domains, by default whole forest is scanned
.PARAMETER ExtendedForestInformation
Ability to provide Forest Information from another command to speed up processing
.EXAMPLE
Get-GPOZaurrBrokenLink -Verbose | Format-Table -AutoSize *
.EXAMPLE
Get-GPOZaurrBrokenLink -Verbose -IncludeDomains ad.evotec.pl | Format-Table -AutoSize *
.NOTES
General notes
#>
[cmdletBinding()]
param(
[alias('ForestName')][string] $Forest,
@@ -6,14 +34,22 @@ function Get-GPOZaurrBrokenLink {
[alias('Domain', 'Domains')][string[]] $IncludeDomains,
[System.Collections.IDictionary] $ExtendedForestInformation
)
$ErrorFound = $false
$PoliciesAD = @{}
$ForestInformation = Get-WinADForestDetails -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -ExcludeDomainControllers $ExcludeDomainControllers -IncludeDomainControllers $IncludeDomainControllers -SkipRODC:$SkipRODC -ExtendedForestInformation $ExtendedForestInformation -Extended
# We need to request all GPOS from Forest. Requesting just for any domain won't be enough
$ForestInformation = Get-WinADForestDetails -Forest $Forest -Extended # -Extended
foreach ($Domain in $ForestInformation.Domains) {
$QueryServer = $ForestInformation['QueryServers']["$Domain"].HostName[0]
$SystemsContainer = $ForestInformation['DomainsExtended'][$Domain].SystemsContainer
if ($SystemsContainer) {
$PoliciesSearchBase = -join ("CN=Policies,", $SystemsContainer)
$PoliciesInAD = Get-ADObject -SearchBase $PoliciesSearchBase -SearchScope OneLevel -Filter * -Server $QueryServer -Properties Name, gPCFileSysPath, DisplayName, DistinguishedName, Description, Created, Modified, ObjectClass, ObjectGUID
try {
$PoliciesInAD = Get-ADObject -ErrorAction Stop -SearchBase $PoliciesSearchBase -SearchScope OneLevel -Filter * -Server $QueryServer -Properties Name, gPCFileSysPath, DisplayName, DistinguishedName, Description, Created, Modified, ObjectClass, ObjectGUID
} catch {
Write-Warning "Get-GPOZaurrBrokenLink - An error occured while searching $PoliciesSearchBase. Error $($_.Exception.Message). Please resolve this before continuing."
$ErrorFound = $true
break
}
foreach ($Policy in $PoliciesInAD) {
$GUIDFromDN = ConvertFrom-DistinguishedName -DistinguishedName $Policy.DistinguishedName
# $Key = "$($Domain)$($GuidFromDN)"
@@ -34,6 +70,12 @@ function Get-GPOZaurrBrokenLink {
Write-Warning "Get-GPOZaurrBroken - Couldn't get GPOs from $Domain. Skipping"
}
}
if ($ErrorFound) {
return
}
# In case of links we can request here whatever user requested.
# This will search for broken links in domain user requested
$ForestInformation = Get-WinADForestDetails -Forest $Forest -Extended -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -ExtendedForestInformation $ExtendedForestInformation
$Links = Get-GPOZaurrLinkLoop -Linked 'All' -ForestInformation $ForestInformation
foreach ($Link in $Links) {
if (-not $PoliciesAD[$Link.GPODistinguishedName]) {
+3
View File
@@ -95,7 +95,10 @@
$Output['CategoriesFull'] = [ordered] @{}
Write-Verbose "Invoke-GPOZaurrContent - Loading GPO Report to Categories"
$CountGPO = 0
[Array] $GPOCategories = foreach ($GPO in $GPOs) {
$CountGPO++
Write-Verbose "Invoke-GPOZaurrContent - Processing [$CountGPO/$($GPOs.Count)] $($GPO.DisplayName)"
if ($GPOPath) {
$GPOOutput = $GPO.GPOOutput
} else {
+46 -7
View File
@@ -1,4 +1,35 @@
function Repair-GPOZaurrBrokenLink {
<#
.SYNOPSIS
Removes any link to GPO that no longer exists.
.DESCRIPTION
Removes any link to GPO that no longer exists. It scans all site, organizational unit or domain root making sure every single link that may be linking to GPO that doesn't exists anymore is gone.
.PARAMETER Forest
Target different Forest, by default current forest is used
.PARAMETER ExcludeDomains
Exclude domain from search, by default whole forest is scanned
.PARAMETER IncludeDomains
Include only specific domains, by default whole forest is scanned
.PARAMETER ExtendedForestInformation
Ability to provide Forest Information from another command to speed up processing
.PARAMETER LimitProcessing
Allows to specify maximum number of items that will be fixed in a single run. It doesn't affect amount of GPOs processed
.EXAMPLE
Repair-GPOZaurrBrokenLink -Verbose -LimitProcessing 1 -WhatIf
.EXAMPLE
Repair-GPOZaurrBrokenLink -Verbose -IncludeDomains ad.evotec.pl -LimitProcessing 1 -WhatIf
.NOTES
General notes
#>
[cmdletBinding(SupportsShouldProcess)]
param(
[alias('ForestName')][string] $Forest,
@@ -7,7 +38,7 @@ function Repair-GPOZaurrBrokenLink {
[System.Collections.IDictionary] $ExtendedForestInformation,
[int] $LimitProcessing
)
$ForestInformation = Get-WinADForestDetails -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -ExtendedForestInformation $ExtendedForestInformation -Extended
$ForestInformation = Get-WinADForestDetails -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -Extended
$Links = Get-GPOZaurrBrokenLink -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -ExtendedForestInformation $ForestInformation
$Cache = @{}
foreach ($Link in $Links) {
@@ -38,14 +69,22 @@ function Repair-GPOZaurrBrokenLink {
Write-Verbose "Repair-GPOZaurrBrokenLink - preparing for removal link to $GPODN ($Key)"
}
}
#
if ($Found) {
$NewGpLink = $($FixedLinks -join '')
try {
Write-Verbose "Repair-GPOZaurrBrokenLink - setting gpLink to $Key - $NewGPLink"
Set-ADObject -Identity $Key -Server $Server -Replace @{ gPLink = $NewGpLink } -ErrorAction Stop
} catch {
Write-Warning "Repair-GPOZaurrBrokenLink - couldn't replace gpLink at $Key with $NewGpLink"
if ($NewGpLink) {
try {
Write-Verbose "Repair-GPOZaurrBrokenLink - setting gpLink to $Key - $NewGPLink"
Set-ADObject -Identity $Key -Server $Server -Replace @{ gPLink = $NewGpLink } -ErrorAction Stop
} catch {
Write-Warning "Repair-GPOZaurrBrokenLink - setting gpLink to $Key - $NewGpLink failed! Error $($_.Exception.Message)"
}
} else {
try {
Write-Verbose "Repair-GPOZaurrBrokenLink - clearing gpLink for $Key (no other links)"
Set-ADObject -Identity $Key -Server $Server -Clear gPLink -ErrorAction Stop
} catch {
Write-Warning "Repair-GPOZaurrBrokenLink - clearing gpLink for $Key failed! Error $($_.Exception.Message)"
}
}
if ($LimitProcessing -eq $Count) {
break
+31
View File
@@ -1,4 +1,35 @@
function Repair-GPOZaurrNetLogonOwner {
<#
.SYNOPSIS
Sets new owner to each file in NetLogon share.
.DESCRIPTION
Sets new owner to each file in NetLogon share.
.PARAMETER Forest
Target different Forest, by default current forest is used
.PARAMETER ExcludeDomains
Exclude domain from search, by default whole forest is scanned
.PARAMETER IncludeDomains
Include only specific domains, by default whole forest is scanned
.PARAMETER ExtendedForestInformation
Ability to provide Forest Information from another command to speed up processing
.PARAMETER Principal
Provide named owner. If not provided default S-1-5-32-544 is used.
.PARAMETER LimitProcessing
Allows to specify maximum number of items that will be fixed in a single run. It doesn't affect amount of GPOs processed
.EXAMPLE
Repair-GPOZaurrNetLogonOwner -WhatIf -Verbose -IncludeDomains ad.evotec.pl
.NOTES
General notes
#>
[cmdletBinding(SupportsShouldProcess)]
param(
[alias('ForestName')][string] $Forest,
+3 -3
View File
@@ -35,7 +35,7 @@ $Configuration = @{
RequiredModules = @(
@{ ModuleName = 'PSSharedGoods'; ModuleVersion = 'Latest'; Guid = 'ee272aa8-baaa-4edf-9f45-b6d6f7d844fe' }
@{ ModuleName = 'ADEssentials'; ModuleVersion = 'Latest'; Guid = '9fc9fd61-7f11-4f4b-a527-084086f1905f' }
@{ ModuleName = 'PSWriteHTML'; ModuleVersion = "0.0.122"; Guid = 'a7bdf640-f5cb-4acf-9de0-365b322d245c' }
@{ ModuleName = 'PSWriteHTML'; ModuleVersion = "Latest"; Guid = 'a7bdf640-f5cb-4acf-9de0-365b322d245c' }
)
ExternalModuleDependencies = @(
#"ActiveDirectory"
@@ -277,10 +277,10 @@ $Configuration = @{
Verbose = $false
}
PublishModule = @{ # requires Enable to be on to process all of that
Enabled = $false
Enabled = $true
Prerelease = ''
RequireForce = $false
GitHub = $false
GitHub = $true
}
}
}
+19
View File
@@ -57,6 +57,25 @@ That's it. Whenever there's a new version, you run the command, and you can enjo
## Changelog
- 0.0.110 - 2021.01.22
- [x] Improved `Invoke-GPOZaurr`
- 0.0.109 - 2021.01.11
- [x] Improved `Invoke-GPOZaurr`
- 0.0.108 - 2021.01.11
- [x] Improved `Invoke-GPOZaurr`
- [x] Improved `GPOConsistency`
- 0.0.107 - 2021.01.11
- [x] Improved `Invoke-GPOZaurr`
- 0.0.106 - 2021.01.11
- [x] Improved `Invoke-GPOZaurrContent`
- 0.0.105 - 2021.01.05
- [x] Improved `Get-GPOZaurr`
- [x] Improved report `GPOBrokenLink`
- 0.0.104 - 2021.01.04
- [x] Improved `Get-GPOZaurrBrokenLink`
- [x] Improved `Repair-GPOZaurrBrokenLink`
- [x] Improved `Get-GPOZaurr`
- [x] Improved report `GPOBrokenLink`
- 0.0.103 - 2021.01.04
- [x] Improved `Get-GPOZaurr`
- [x] Added new report `GPOBrokenLink`