From 8b2e655723ae507675863991703d52ef644f21f7 Mon Sep 17 00:00:00 2001 From: Przemyslaw Klys Date: Tue, 13 Oct 2020 15:29:38 +0200 Subject: [PATCH] Update Invoke-GPOZaurr --- Private/ConvertTo-XMLAccountPolicy.ps1 | 120 +++-- Private/ConvertTo-XMLAudit.ps1 | 319 ++++++++---- Private/ConvertTo-XMLGenericPolicy.ps1 | 206 +++++--- .../ConvertTo-XMLGenericSecuritySettings.ps1 | 2 +- Private/Script.GPODictionary.ps1 | 491 ++++++++++++------ 5 files changed, 781 insertions(+), 357 deletions(-) diff --git a/Private/ConvertTo-XMLAccountPolicy.ps1 b/Private/ConvertTo-XMLAccountPolicy.ps1 index d522bf9..7cb04f2 100644 --- a/Private/ConvertTo-XMLAccountPolicy.ps1 +++ b/Private/ConvertTo-XMLAccountPolicy.ps1 @@ -1,39 +1,95 @@ function ConvertTo-XMLAccountPolicy { [cmdletBinding()] param( - [PSCustomObject] $GPO + [PSCustomObject] $GPO, + [switch] $SingleObject ) - $CreateGPO = [ordered]@{ - DisplayName = $GPO.DisplayName - DomainName = $GPO.DomainName - GUID = $GPO.GUID - GpoType = $GPO.GpoType - #GpoCategory = $GPOEntry.GpoCategory - #GpoSettings = $GPOEntry.GpoSettings - ClearTextPassword = 'Not Set' - LockoutBadCount = 'Not Set' - LockoutDuration = 'Not Set' - MaximumPasswordAge = 'Not Set' - MinimumPasswordAge = 'Not Set' - MinimumPasswordLength = 'Not Set' - PasswordComplexity = 'Not Set' - PasswordHistorySize = 'Not Set' - ResetLockoutCount = 'Not Set' - MaxClockSkew = 'Not Set' - MaxRenewAge = 'Not Set' - MaxServiceAge = 'Not Set' - MaxTicketAge = 'Not Set' - TicketValidateClient = 'Not Set' - } - foreach ($GPOEntry in $GPO.DataSet) { - if ($GPOEntry.SettingBoolean) { - $CreateGPO[$($GPOEntry.Name)] = if ($GPOEntry.SettingBoolean -eq 'true') { 'Enabled' } elseif ($GPOEntry.SettingBoolean -eq 'false') { 'Disabled' } else { 'Not set' }; - } elseif ($GPOEntry.SettingNumber) { - $CreateGPO[$($GPOEntry.Name)] = [int] $GPOEntry.SettingNumber + if ($SingleObject) { + $CreateGPO = [ordered]@{ + DisplayName = $GPO.DisplayName + DomainName = $GPO.DomainName + GUID = $GPO.GUID + GpoType = $GPO.GpoType + #GpoCategory = $GPOEntry.GpoCategory + #GpoSettings = $GPOEntry.GpoSettings + Count = 0 + Settings = $null } + [Array] $CreateGPO['Settings'] = @( + $Settings = [ordered]@{ + DisplayName = $GPO.DisplayName + DomainName = $GPO.DomainName + GUID = $GPO.GUID + GpoType = $GPO.GpoType + #GpoCategory = $GPOEntry.GpoCategory + #GpoSettings = $GPOEntry.GpoSettings + ClearTextPassword = 'Not Set' + LockoutBadCount = 'Not Set' + LockoutDuration = 'Not Set' + MaximumPasswordAge = 'Not Set' + MinimumPasswordAge = 'Not Set' + MinimumPasswordLength = 'Not Set' + PasswordComplexity = 'Not Set' + PasswordHistorySize = 'Not Set' + ResetLockoutCount = 'Not Set' + MaxClockSkew = 'Not Set' + MaxRenewAge = 'Not Set' + MaxServiceAge = 'Not Set' + MaxTicketAge = 'Not Set' + TicketValidateClient = 'Not Set' + } + foreach ($GPOEntry in $GPO.DataSet) { + if ($GPOEntry.SettingBoolean) { + $Settings[$($GPOEntry.Name)] = if ($GPOEntry.SettingBoolean -eq 'true') { 'Enabled' } elseif ($GPOEntry.SettingBoolean -eq 'false') { 'Disabled' } else { 'Not set' }; + } elseif ($GPOEntry.SettingNumber) { + $Settings[$($GPOEntry.Name)] = [int] $GPOEntry.SettingNumber + } + } + [PSCustomObject] $Settings + ) + + + $CreateGPO['Count'] = $CreateGPO['Settings'].Count + $CreateGPO['Linked'] = $GPO.Linked + $CreateGPO['LinksCount'] = $GPO.LinksCount + $CreateGPO['Links'] = $GPO.Links + [PSCustomObject] $CreateGPO + } else { + + + + $CreateGPO = [ordered]@{ + DisplayName = $GPO.DisplayName + DomainName = $GPO.DomainName + GUID = $GPO.GUID + GpoType = $GPO.GpoType + #GpoCategory = $GPOEntry.GpoCategory + #GpoSettings = $GPOEntry.GpoSettings + ClearTextPassword = 'Not Set' + LockoutBadCount = 'Not Set' + LockoutDuration = 'Not Set' + MaximumPasswordAge = 'Not Set' + MinimumPasswordAge = 'Not Set' + MinimumPasswordLength = 'Not Set' + PasswordComplexity = 'Not Set' + PasswordHistorySize = 'Not Set' + ResetLockoutCount = 'Not Set' + MaxClockSkew = 'Not Set' + MaxRenewAge = 'Not Set' + MaxServiceAge = 'Not Set' + MaxTicketAge = 'Not Set' + TicketValidateClient = 'Not Set' + } + foreach ($GPOEntry in $GPO.DataSet) { + if ($GPOEntry.SettingBoolean) { + $CreateGPO[$($GPOEntry.Name)] = if ($GPOEntry.SettingBoolean -eq 'true') { 'Enabled' } elseif ($GPOEntry.SettingBoolean -eq 'false') { 'Disabled' } else { 'Not set' }; + } elseif ($GPOEntry.SettingNumber) { + $CreateGPO[$($GPOEntry.Name)] = [int] $GPOEntry.SettingNumber + } + } + $CreateGPO['Linked'] = $GPO.Linked + $CreateGPO['LinksCount'] = $GPO.LinksCount + $CreateGPO['Links'] = $GPO.Links + [PSCustomObject] $CreateGPO } - $CreateGPO['Linked'] = $GPO.Linked - $CreateGPO['LinksCount'] = $GPO.LinksCount - $CreateGPO['Links'] = $GPO.Links - [PSCustomObject] $CreateGPO } \ No newline at end of file diff --git a/Private/ConvertTo-XMLAudit.ps1 b/Private/ConvertTo-XMLAudit.ps1 index 7059495..1c50e29 100644 --- a/Private/ConvertTo-XMLAudit.ps1 +++ b/Private/ConvertTo-XMLAudit.ps1 @@ -2,7 +2,7 @@ [cmdletBinding()] param( [PSCustomObject] $GPO, - [switch] $FullObject + [switch] $SingleObject ) $SettingType = @{ '0' = 'No Auditing' @@ -10,107 +10,222 @@ '2' = 'Failure' '3' = 'Success, Failure' } - $CreateGPO = [ordered]@{ - DisplayName = $GPO.DisplayName - DomainName = $GPO.DomainName - GUID = $GPO.GUID - GpoType = $GPO.GpoType - #GpoCategory = $GPOEntry.GpoCategory - #GpoSettings = $GPOEntry.GpoSettings - AuditAccountLogon = 'Not configured' - AuditAccountManage = 'Not configured' - AuditDSAccess = 'Not configured' - AuditLogonEvents = 'Not configured' - AuditObjectAccess = 'Not configured' - AuditPolicyChange = 'Not configured' - AuditPrivilegeUse = 'Not configured' - AuditProcessTracking = 'Not configured' - AuditSystemEvents = 'Not configured' - # Advanced Policies - AuditAccountLockout = 'Not configured' - AuditApplicationGenerated = 'Not configured' - AuditApplicationGroupManagement = 'Not configured' - AuditAuditPolicyChange = 'Not configured' - AuditAuthenticationPolicyChange = 'Not configured' - AuditAuthorizationPolicyChange = 'Not configured' - AuditCentralAccessPolicyStaging = 'Not configured' - AuditCertificationServices = 'Not configured' - AuditComputerAccountManagement = 'Not configured' - AuditCredentialValidation = 'Not configured' - AuditDetailedDirectoryServiceReplication = 'Not configured' - AuditDetailedFileShare = 'Not configured' - AuditDirectoryServiceAccess = 'Not configured' - AuditDirectoryServiceChanges = 'Not configured' - AuditDirectoryServiceReplication = 'Not configured' - AuditDistributionGroupManagement = 'Not configured' - AuditDPAPIActivity = 'Not configured' - AuditFileShare = 'Not configured' - AuditFileSystem = 'Not configured' - AuditFilteringPlatformConnection = 'Not configured' - AuditFilteringPlatformPacketDrop = 'Not configured' - AuditFilteringPlatformPolicyChange = 'Not configured' - AuditGroupMembership = 'Not configured' - AuditHandleManipulation = 'Not configured' - AuditIPsecDriver = 'Not configured' - AuditIPsecExtendedMode = 'Not configured' - AuditIPsecMainMode = 'Not configured' - AuditIPsecQuickMode = 'Not configured' - AuditKerberosAuthenticationService = 'Not configured' - AuditKerberosServiceTicketOperations = 'Not configured' - AuditKernelObject = 'Not configured' - AuditLogoff = 'Not configured' - AuditLogon = 'Not configured' - AuditMPSSVCRuleLevelPolicyChange = 'Not configured' - AuditNetworkPolicyServer = 'Not configured' - AuditNonSensitivePrivilegeUse = 'Not configured' - AuditOtherAccountLogonEvents = 'Not configured' - AuditOtherAccountManagementEvents = 'Not configured' - AuditOtherLogonLogoffEvents = 'Not configured' - AuditOtherObjectAccessEvents = 'Not configured' - AuditOtherPolicyChangeEvents = 'Not configured' - AuditOtherPrivilegeUseEvents = 'Not configured' - AuditOtherSystemEvents = 'Not configured' - AuditPNPActivity = 'Not configured' - AuditProcessCreation = 'Not configured' - AuditProcessTermination = 'Not configured' - AuditRegistry = 'Not configured' - AuditRemovableStorage = 'Not configured' - AuditRPCEvents = 'Not configured' - AuditSAM = 'Not configured' - AuditSecurityGroupManagement = 'Not configured' - AuditSecurityStateChange = 'Not configured' - AuditSecuritySystemExtension = 'Not configured' - AuditSensitivePrivilegeUse = 'Not configured' - AuditSpecialLogon = 'Not configured' - AuditSystemIntegrity = 'Not configured' - AuditUserDeviceClaims = 'Not configured' - AuditUserAccountManagement = 'Not configured' - } - foreach ($GPOEntry in $GPO.DataSet) { - if ($GPOEntry.PolicyTarget) { - # Category = 'AuditSettings', Settings = 'AuditSetting' - $Category = $GPOEntry.SubcategoryName -replace ' ', '' -replace '-', '' -replace '/', '' - if ($CreateGPO["$($Category)"]) { - $CreateGPO["$($Category)"] = $SettingType["$($GPOEntry.SettingValue)"] - } - } else { - # Category = 'SecuritySettings', Settings = 'Audit' - $SuccessAttempts = try { [bool]::Parse($GPOEntry.SuccessAttempts) } catch { $null }; - $FailureAttempts = try { [bool]::Parse($GPOEntry.FailureAttempts) } catch { $null }; - if ($SuccessAttempts -and $FailureAttempts) { - $Setting = 'Success, Failure' - } elseif ($SuccessAttempts) { - $Setting = 'Success' - } elseif ($FailureAttempts) { - $Setting = 'Failure' - } else { - $Setting = 'Not configured' - } - $CreateGPO["$($GPOEntry.Name)"] = $Setting + if ($SingleObject) { + $CreateGPO = [ordered]@{ + DisplayName = $GPO.DisplayName + DomainName = $GPO.DomainName + GUID = $GPO.GUID + GpoType = $GPO.GpoType + #GpoCategory = $GPOEntry.GpoCategory + #GpoSettings = $GPOEntry.GpoSettings + Count = 0 + Settings = $null } + [Array] $CreateGPO['Settings'] = @( + $Settings = [ordered]@{ + AuditAccountLogon = 'Not configured' + AuditAccountManage = 'Not configured' + AuditDSAccess = 'Not configured' + AuditLogonEvents = 'Not configured' + AuditObjectAccess = 'Not configured' + AuditPolicyChange = 'Not configured' + AuditPrivilegeUse = 'Not configured' + AuditProcessTracking = 'Not configured' + AuditSystemEvents = 'Not configured' + # Advanced Policies + AuditAccountLockout = 'Not configured' + AuditApplicationGenerated = 'Not configured' + AuditApplicationGroupManagement = 'Not configured' + AuditAuditPolicyChange = 'Not configured' + AuditAuthenticationPolicyChange = 'Not configured' + AuditAuthorizationPolicyChange = 'Not configured' + AuditCentralAccessPolicyStaging = 'Not configured' + AuditCertificationServices = 'Not configured' + AuditComputerAccountManagement = 'Not configured' + AuditCredentialValidation = 'Not configured' + AuditDetailedDirectoryServiceReplication = 'Not configured' + AuditDetailedFileShare = 'Not configured' + AuditDirectoryServiceAccess = 'Not configured' + AuditDirectoryServiceChanges = 'Not configured' + AuditDirectoryServiceReplication = 'Not configured' + AuditDistributionGroupManagement = 'Not configured' + AuditDPAPIActivity = 'Not configured' + AuditFileShare = 'Not configured' + AuditFileSystem = 'Not configured' + AuditFilteringPlatformConnection = 'Not configured' + AuditFilteringPlatformPacketDrop = 'Not configured' + AuditFilteringPlatformPolicyChange = 'Not configured' + AuditGroupMembership = 'Not configured' + AuditHandleManipulation = 'Not configured' + AuditIPsecDriver = 'Not configured' + AuditIPsecExtendedMode = 'Not configured' + AuditIPsecMainMode = 'Not configured' + AuditIPsecQuickMode = 'Not configured' + AuditKerberosAuthenticationService = 'Not configured' + AuditKerberosServiceTicketOperations = 'Not configured' + AuditKernelObject = 'Not configured' + AuditLogoff = 'Not configured' + AuditLogon = 'Not configured' + AuditMPSSVCRuleLevelPolicyChange = 'Not configured' + AuditNetworkPolicyServer = 'Not configured' + AuditNonSensitivePrivilegeUse = 'Not configured' + AuditOtherAccountLogonEvents = 'Not configured' + AuditOtherAccountManagementEvents = 'Not configured' + AuditOtherLogonLogoffEvents = 'Not configured' + AuditOtherObjectAccessEvents = 'Not configured' + AuditOtherPolicyChangeEvents = 'Not configured' + AuditOtherPrivilegeUseEvents = 'Not configured' + AuditOtherSystemEvents = 'Not configured' + AuditPNPActivity = 'Not configured' + AuditProcessCreation = 'Not configured' + AuditProcessTermination = 'Not configured' + AuditRegistry = 'Not configured' + AuditRemovableStorage = 'Not configured' + AuditRPCEvents = 'Not configured' + AuditSAM = 'Not configured' + AuditSecurityGroupManagement = 'Not configured' + AuditSecurityStateChange = 'Not configured' + AuditSecuritySystemExtension = 'Not configured' + AuditSensitivePrivilegeUse = 'Not configured' + AuditSpecialLogon = 'Not configured' + AuditSystemIntegrity = 'Not configured' + AuditUserDeviceClaims = 'Not configured' + AuditUserAccountManagement = 'Not configured' + } + foreach ($GPOEntry in $GPO.DataSet) { + if ($GPOEntry.PolicyTarget) { + # Category = 'AuditSettings', Settings = 'AuditSetting' + $Category = $GPOEntry.SubcategoryName -replace ' ', '' -replace '-', '' -replace '/', '' + if ($Settings["$($Category)"]) { + $Settings["$($Category)"] = $SettingType["$($GPOEntry.SettingValue)"] + } + } else { + # Category = 'SecuritySettings', Settings = 'Audit' + $SuccessAttempts = try { [bool]::Parse($GPOEntry.SuccessAttempts) } catch { $null }; + $FailureAttempts = try { [bool]::Parse($GPOEntry.FailureAttempts) } catch { $null }; + if ($SuccessAttempts -and $FailureAttempts) { + $Setting = 'Success, Failure' + } elseif ($SuccessAttempts) { + $Setting = 'Success' + } elseif ($FailureAttempts) { + $Setting = 'Failure' + } else { + $Setting = 'Not configured' + } + $Settings["$($GPOEntry.Name)"] = $Setting + } + } + [PSCustomObject] $Settings + ) + + $CreateGPO['Count'] = $CreateGPO['Settings'].Count + $CreateGPO['Linked'] = $GPO.Linked + $CreateGPO['LinksCount'] = $GPO.LinksCount + $CreateGPO['Links'] = $GPO.Links + [PSCustomObject] $CreateGPO + } else { + $CreateGPO = [ordered]@{ + DisplayName = $GPO.DisplayName + DomainName = $GPO.DomainName + GUID = $GPO.GUID + GpoType = $GPO.GpoType + #GpoCategory = $GPOEntry.GpoCategory + #GpoSettings = $GPOEntry.GpoSettings + AuditAccountLogon = 'Not configured' + AuditAccountManage = 'Not configured' + AuditDSAccess = 'Not configured' + AuditLogonEvents = 'Not configured' + AuditObjectAccess = 'Not configured' + AuditPolicyChange = 'Not configured' + AuditPrivilegeUse = 'Not configured' + AuditProcessTracking = 'Not configured' + AuditSystemEvents = 'Not configured' + # Advanced Policies + AuditAccountLockout = 'Not configured' + AuditApplicationGenerated = 'Not configured' + AuditApplicationGroupManagement = 'Not configured' + AuditAuditPolicyChange = 'Not configured' + AuditAuthenticationPolicyChange = 'Not configured' + AuditAuthorizationPolicyChange = 'Not configured' + AuditCentralAccessPolicyStaging = 'Not configured' + AuditCertificationServices = 'Not configured' + AuditComputerAccountManagement = 'Not configured' + AuditCredentialValidation = 'Not configured' + AuditDetailedDirectoryServiceReplication = 'Not configured' + AuditDetailedFileShare = 'Not configured' + AuditDirectoryServiceAccess = 'Not configured' + AuditDirectoryServiceChanges = 'Not configured' + AuditDirectoryServiceReplication = 'Not configured' + AuditDistributionGroupManagement = 'Not configured' + AuditDPAPIActivity = 'Not configured' + AuditFileShare = 'Not configured' + AuditFileSystem = 'Not configured' + AuditFilteringPlatformConnection = 'Not configured' + AuditFilteringPlatformPacketDrop = 'Not configured' + AuditFilteringPlatformPolicyChange = 'Not configured' + AuditGroupMembership = 'Not configured' + AuditHandleManipulation = 'Not configured' + AuditIPsecDriver = 'Not configured' + AuditIPsecExtendedMode = 'Not configured' + AuditIPsecMainMode = 'Not configured' + AuditIPsecQuickMode = 'Not configured' + AuditKerberosAuthenticationService = 'Not configured' + AuditKerberosServiceTicketOperations = 'Not configured' + AuditKernelObject = 'Not configured' + AuditLogoff = 'Not configured' + AuditLogon = 'Not configured' + AuditMPSSVCRuleLevelPolicyChange = 'Not configured' + AuditNetworkPolicyServer = 'Not configured' + AuditNonSensitivePrivilegeUse = 'Not configured' + AuditOtherAccountLogonEvents = 'Not configured' + AuditOtherAccountManagementEvents = 'Not configured' + AuditOtherLogonLogoffEvents = 'Not configured' + AuditOtherObjectAccessEvents = 'Not configured' + AuditOtherPolicyChangeEvents = 'Not configured' + AuditOtherPrivilegeUseEvents = 'Not configured' + AuditOtherSystemEvents = 'Not configured' + AuditPNPActivity = 'Not configured' + AuditProcessCreation = 'Not configured' + AuditProcessTermination = 'Not configured' + AuditRegistry = 'Not configured' + AuditRemovableStorage = 'Not configured' + AuditRPCEvents = 'Not configured' + AuditSAM = 'Not configured' + AuditSecurityGroupManagement = 'Not configured' + AuditSecurityStateChange = 'Not configured' + AuditSecuritySystemExtension = 'Not configured' + AuditSensitivePrivilegeUse = 'Not configured' + AuditSpecialLogon = 'Not configured' + AuditSystemIntegrity = 'Not configured' + AuditUserDeviceClaims = 'Not configured' + AuditUserAccountManagement = 'Not configured' + } + foreach ($GPOEntry in $GPO.DataSet) { + if ($GPOEntry.PolicyTarget) { + # Category = 'AuditSettings', Settings = 'AuditSetting' + $Category = $GPOEntry.SubcategoryName -replace ' ', '' -replace '-', '' -replace '/', '' + if ($CreateGPO["$($Category)"]) { + $CreateGPO["$($Category)"] = $SettingType["$($GPOEntry.SettingValue)"] + } + } else { + # Category = 'SecuritySettings', Settings = 'Audit' + $SuccessAttempts = try { [bool]::Parse($GPOEntry.SuccessAttempts) } catch { $null }; + $FailureAttempts = try { [bool]::Parse($GPOEntry.FailureAttempts) } catch { $null }; + if ($SuccessAttempts -and $FailureAttempts) { + $Setting = 'Success, Failure' + } elseif ($SuccessAttempts) { + $Setting = 'Success' + } elseif ($FailureAttempts) { + $Setting = 'Failure' + } else { + $Setting = 'Not configured' + } + $CreateGPO["$($GPOEntry.Name)"] = $Setting + } + } + $CreateGPO['Linked'] = $GPO.Linked + $CreateGPO['LinksCount'] = $GPO.LinksCount + $CreateGPO['Links'] = $GPO.Links + [PSCustomObject] $CreateGPO } - $CreateGPO['Linked'] = $GPO.Linked - $CreateGPO['LinksCount'] = $GPO.LinksCount - $CreateGPO['Links'] = $GPO.Links - [PSCustomObject] $CreateGPO } \ No newline at end of file diff --git a/Private/ConvertTo-XMLGenericPolicy.ps1 b/Private/ConvertTo-XMLGenericPolicy.ps1 index 46f1b24..ebadfbf 100644 --- a/Private/ConvertTo-XMLGenericPolicy.ps1 +++ b/Private/ConvertTo-XMLGenericPolicy.ps1 @@ -2,52 +2,141 @@ function ConvertTo-XMLGenericPolicy { [cmdletBinding()] param( [PSCustomObject] $GPO, - [string[]] $Category + [string[]] $Category, + [switch] $SingleObject ) - $CreateGPO = [ordered]@{ - DisplayName = $GPO.DisplayName - DomainName = $GPO.DomainName - GUID = $GPO.GUID - GpoType = $GPO.GpoType - #GpoCategory = $GPOEntry.GpoCategory - #GpoSettings = $GPOEntry.GpoSettings - } $UsedNames = [System.Collections.Generic.List[string]]::new() - [Array] $Policies = foreach ($Cat in $Category) { $GPO.DataSet | Where-Object { $_.Category -like $Cat } } if ($Policies.Count -gt 0) { - foreach ($Policy in $Policies) { - #if ($Policy.Category -notlike $Category) { - # We check again for Category because one GPO can have multiple categories - # First check checks GPO globally, - # continue - #} - $Name = Format-ToTitleCase -Text $Policy.Name -RemoveWhiteSpace -RemoveChar ',', '-', "'", '\(', '\)', ':' - $CreateGPO[$Name] = $Policy.State + if ($SingleObject) { + $CreateGPO = [ordered]@{ + DisplayName = $GPO.DisplayName + DomainName = $GPO.DomainName + GUID = $GPO.GUID + GpoType = $GPO.GpoType + #GpoCategory = $GPOEntry.GpoCategory + #GpoSettings = $GPOEntry.GpoSettings + Count = 0 + Settings = $null + } - foreach ($Setting in @('DropDownList', 'Numeric', 'EditText', 'Text', 'CheckBox', 'ListBox')) { - if ($Policy.$Setting) { - foreach ($Value in $Policy.$Setting) { - if ($Value.Name) { - $SubName = Format-ToTitleCase -Text $Value.Name -RemoveWhiteSpace -RemoveChar ',', '-', "'", '\(', '\)', ':' - $SubName = -join ($Name, $SubName) - if ($SubName -notin $UsedNames) { - $UsedNames.Add($SubName) + [Array] $CreateGPO['Settings'] = @( + $Settings = [ordered] @{} + foreach ($Policy in $Policies) { + #if ($Policy.Category -notlike $Category) { + # We check again for Category because one GPO can have multiple categories + # First check checks GPO globally, + # continue + #} + + $Name = Format-ToTitleCase -Text $Policy.Name -RemoveWhiteSpace -RemoveChar ',', '-', "'", '\(', '\)', ':' + $Settings[$Name] = $Policy.State + + foreach ($Setting in @('DropDownList', 'Numeric', 'EditText', 'Text', 'CheckBox', 'ListBox')) { + if ($Policy.$Setting) { + foreach ($Value in $Policy.$Setting) { + if ($Value.Name) { + $SubName = Format-ToTitleCase -Text $Value.Name -RemoveWhiteSpace -RemoveChar ',', '-', "'", '\(', '\)', ':' + $SubName = -join ($Name, $SubName) + if ($SubName -notin $UsedNames) { + $UsedNames.Add($SubName) + } else { + $TimesUsed = $UsedNames | Group-Object | Where-Object { $_.Name -eq $SubName } + $NumberToUse = $TimesUsed.Count + 1 + # We add same name 2nd and 3rd time to make sure we count properly + $UsedNames.Add($SubName) + # We now build property name based on amnount of times + $SubName = -join ($SubName, "$NumberToUse") + } + if ($Value.Value -is [string]) { + $Settings["$SubName"] = $Value.Value + } elseif ($Value.Value -is [System.Xml.XmlElement]) { + + <# + if ($null -eq $Value.Value.Name) { + # Shouldn't happen but lets see + Write-Verbose $Value } else { - $TimesUsed = $UsedNames | Group-Object | Where-Object { $_.Name -eq $SubName } - $NumberToUse = $TimesUsed.Count + 1 - # We add same name 2nd and 3rd time to make sure we count properly - $UsedNames.Add($SubName) - # We now build property name based on amnount of times - $SubName = -join ($SubName, "$NumberToUse") + $CreateGPO["$SubName"] = $Value.Value.Name } - if ($Value.Value -is [string]) { - $CreateGPO["$SubName"] = $Value.Value - } elseif ($Value.Value -is [System.Xml.XmlElement]) { - <# + #> + if ($Value.Value.Element) { + $Settings["$SubName"] = $Value.Value.Element.Data -join '; ' + } elseif ($null -eq $Value.Value.Name) { + # Shouldn't happen but lets see + Write-Verbose "Tracking $Value" + } else { + $Settings["$SubName"] = $Value.Value.Name + } + + } elseif ($Value.State) { + $Settings["$SubName"] = $Value.State + } elseif ($null -eq $Value.Value) { + # This is most likely Setting 'Text + # Do nothing, usually it's just a text to display + #Write-Verbose "Skipping value for display because it's empty. Name: $($Value.Name)" + } else { + # shouldn't happen + Write-Verbose $Value + } + } + } + } + } + + + } + [PSCustomObject] $Settings + ) + + $CreateGPO['Count'] = $CreateGPO['Settings'].Count + $CreateGPO['Linked'] = $GPO.Linked + $CreateGPO['LinksCount'] = $GPO.LinksCount + $CreateGPO['Links'] = $GPO.Links + [PSCustomObject] $CreateGPO + } else { + + $CreateGPO = [ordered]@{ + DisplayName = $GPO.DisplayName + DomainName = $GPO.DomainName + GUID = $GPO.GUID + GpoType = $GPO.GpoType + #GpoCategory = $GPOEntry.GpoCategory + #GpoSettings = $GPOEntry.GpoSettings + } + foreach ($Policy in $Policies) { + #if ($Policy.Category -notlike $Category) { + # We check again for Category because one GPO can have multiple categories + # First check checks GPO globally, + # continue + #} + $Name = Format-ToTitleCase -Text $Policy.Name -RemoveWhiteSpace -RemoveChar ',', '-', "'", '\(', '\)', ':' + $CreateGPO[$Name] = $Policy.State + + foreach ($Setting in @('DropDownList', 'Numeric', 'EditText', 'Text', 'CheckBox', 'ListBox')) { + if ($Policy.$Setting) { + foreach ($Value in $Policy.$Setting) { + if ($Value.Name) { + $SubName = Format-ToTitleCase -Text $Value.Name -RemoveWhiteSpace -RemoveChar ',', '-', "'", '\(', '\)', ':' + $SubName = -join ($Name, $SubName) + if ($SubName -notin $UsedNames) { + $UsedNames.Add($SubName) + } else { + $TimesUsed = $UsedNames | Group-Object | Where-Object { $_.Name -eq $SubName } + $NumberToUse = $TimesUsed.Count + 1 + # We add same name 2nd and 3rd time to make sure we count properly + $UsedNames.Add($SubName) + # We now build property name based on amnount of times + $SubName = -join ($SubName, "$NumberToUse") + } + if ($Value.Value -is [string]) { + $CreateGPO["$SubName"] = $Value.Value + } elseif ($Value.Value -is [System.Xml.XmlElement]) { + + <# if ($null -eq $Value.Value.Name) { # Shouldn't happen but lets see Write-Verbose $Value @@ -56,34 +145,35 @@ function ConvertTo-XMLGenericPolicy { } #> - if ($Value.Value.Element) { - $CreateGPO["$SubName"] = $Value.Value.Element.Data -join '; ' - } elseif ($null -eq $Value.Value.Name) { - # Shouldn't happen but lets see - Write-Verbose "Tracking $Value" - } else { - $CreateGPO["$SubName"] = $Value.Value.Name - } + if ($Value.Value.Element) { + $CreateGPO["$SubName"] = $Value.Value.Element.Data -join '; ' + } elseif ($null -eq $Value.Value.Name) { + # Shouldn't happen but lets see + Write-Verbose "Tracking $Value" + } else { + $CreateGPO["$SubName"] = $Value.Value.Name + } - } elseif ($Value.State) { - $CreateGPO["$SubName"] = $Value.State - } elseif ($null -eq $Value.Value) { - # This is most likely Setting 'Text - # Do nothing, usually it's just a text to display - #Write-Verbose "Skipping value for display because it's empty. Name: $($Value.Name)" - } else { - # shouldn't happen - Write-Verbose $Value + } elseif ($Value.State) { + $CreateGPO["$SubName"] = $Value.State + } elseif ($null -eq $Value.Value) { + # This is most likely Setting 'Text + # Do nothing, usually it's just a text to display + #Write-Verbose "Skipping value for display because it's empty. Name: $($Value.Name)" + } else { + # shouldn't happen + Write-Verbose $Value + } } } } } } + $CreateGPO['Linked'] = $GPO.Linked + $CreateGPO['LinksCount'] = $GPO.LinksCount + $CreateGPO['Links'] = $GPO.Links + [PSCustomObject] $CreateGPO + #} } - $CreateGPO['Linked'] = $GPO.Linked - $CreateGPO['LinksCount'] = $GPO.LinksCount - $CreateGPO['Links'] = $GPO.Links - [PSCustomObject] $CreateGPO - #} } } \ No newline at end of file diff --git a/Private/ConvertTo-XMLGenericSecuritySettings.ps1 b/Private/ConvertTo-XMLGenericSecuritySettings.ps1 index a92c9a5..ec9d6f7 100644 --- a/Private/ConvertTo-XMLGenericSecuritySettings.ps1 +++ b/Private/ConvertTo-XMLGenericSecuritySettings.ps1 @@ -5,7 +5,7 @@ function ConvertTo-XMLGenericSecuritySettings { [string[]] $Category ) $SkipNames = ('Name', 'LocalName', 'NamespaceURI', 'Prefix', 'NodeType', 'ParentNode', 'OwnerDocument', 'IsEmpty', 'Attributes', 'HasAttributes', 'SchemaInfo', 'InnerXml', 'InnerText', 'NextSibling', 'PreviousSibling', 'Value', 'ChildNodes', 'FirstChild', 'LastChild', 'HasChildNodes', 'IsReadOnly', 'OuterXml', 'BaseURI', 'PreviousText') - $UsedNames = [System.Collections.Generic.List[string]]::new() + #$UsedNames = [System.Collections.Generic.List[string]]::new() [Array] $Settings = foreach ($Cat in $Category) { $GPO.DataSet | Where-Object { $null -ne $_.$Cat } } diff --git a/Private/Script.GPODictionary.ps1 b/Private/Script.GPODictionary.ps1 index 85d8f71..147a08f 100644 --- a/Private/Script.GPODictionary.ps1 +++ b/Private/Script.GPODictionary.ps1 @@ -11,7 +11,7 @@ ConvertTo-XMLAccountPolicy -GPO $GPO } CodeSingle = { - ConvertTo-XMLAccountPolicy -GPO $GPO + ConvertTo-XMLAccountPolicy -GPO $GPO -SingleObject } } Audit = [ordered] @{ @@ -33,7 +33,7 @@ ConvertTo-XMLAudit -GPO $GPO } CodeSingle = { - ConvertTo-XMLAudit -GPO $GPO + ConvertTo-XMLAudit -GPO $GPO -SingleObject } } Autologon = [ordered] @{ @@ -51,16 +51,19 @@ } } AutoPlay = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Windows Components/AutoPlay Policies' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Windows Components/AutoPlay Policies' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/AutoPlay Policies*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/AutoPlay Policies*' -SingleObject + } } Biometrics = @{ Types = @( @@ -76,149 +79,186 @@ } } Bitlocker = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Windows Components/BitLocker Drive Encryption' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Windows Components/BitLocker Drive Encryption' + Code = { #ConvertTo-XMLBitlocker -GPO $GPO ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/BitLocker Drive Encryption*' } + CodeSingle = { + #ConvertTo-XMLBitlocker -GPO $GPO + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/BitLocker Drive Encryption*' -SingleObject + } } ControlPanel = [ordered]@{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Controol Panel' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Controol Panel' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Control Panel' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Control Panel' -SingleObject + } } ControlPanelAddRemove = [ordered]@{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Control Panel/Add or Remove Programs' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Control Panel/Add or Remove Programs' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Control Panel/Add or Remove Programs' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Control Panel/Add or Remove Programs' -SingleObject + } } ControlPanelDisplay = [ordered]@{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Control Panel/Display' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Control Panel/Display' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Control Panel/Display' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Control Panel/Display' -SingleObject + } } ControlPanelPersonalization = [ordered]@{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Control Panel/Personalization' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Control Panel/Personalization' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Control Panel/Personalization' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Control Panel/Personalization' -SingleObject + } } ControlPanelPrinters = [ordered]@{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Control Panel/Printers' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Control Panel/Printers' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Control Panel/Printers' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Control Panel/Printers' -SingleObject + } } ControlPanelPrograms = [ordered]@{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Control Panel/Programs' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Control Panel/Programs' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Control Panel/Programs' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Control Panel/Programs' -SingleObject + } } ControlPanelRegional = [ordered]@{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Control Panel/Regional and Language Options' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Control Panel/Regional and Language Options' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Control Panel/Regional and Language Options' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Control Panel/Regional and Language Options' -SingleObject + } } CredentialsDelegation = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> System/Credentials Delegation' - Code = { + GPOPath = 'Policies -> Administrative Templates -> System/Credentials Delegation' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'System/Credentials Delegation*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'System/Credentials Delegation*' -SingleObject + } } CustomInternationalSettings = [ordered]@{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Custom International Settings' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Custom International Settings' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Custom International Settings*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Custom International Settings*' -SingleObject + } } Desktop = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Desktop' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Desktop' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Desktop*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Desktop*' -SingleObject + } } DnsClient = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Network/DNS Client' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Network/DNS Client' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Network/DNS Client*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Network/DNS Client*' -SingleObject + } } DriveMapping = [ordered] @{ Types = @( @@ -251,116 +291,143 @@ } } EventForwarding = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Windows Components/Event Forwarding' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Windows Components/Event Forwarding' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Event Forwarding*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Event Forwarding*' -SingleObject + } } EventLogService = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Windows Components/Event Log Service' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Windows Components/Event Log Service' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Event Log Service*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Event Log Service*' -SingleObject + } } FileExplorer = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Windows Components/File Explorer' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Windows Components/File Explorer' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/File Explorer*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/File Explorer*' -SingleObject + } } FolderRedirection = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> System/Folder Redirection' - Code = { + GPOPath = 'Policies -> Administrative Templates -> System/Folder Redirection' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'System/Folder Redirection' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'System/Folder Redirection' -SingleObject + } } FSLogix = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> FSLogix' - Code = { + GPOPath = 'Policies -> Administrative Templates -> FSLogix' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'FSLogix' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'FSLogix' -SingleObject + } } GoogleChrome = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = @( + GPOPath = @( 'Policies -> Administrative Templates -> Google Chrome' 'Policies -> Administrative Templates -> Google/Google Chrome' 'Policies -> Administrative Templates -> Google Chrome - Default Settings (users can override)' ) - Code = { + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Google Chrome', 'Google/Google Chrome', 'Google Chrome - Default Settings (users can override)' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Google Chrome', 'Google/Google Chrome', 'Google Chrome - Default Settings (users can override)' -SingleObject + } } GroupPolicy = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> System/Group Policy' - Code = { + GPOPath = 'Policies -> Administrative Templates -> System/Group Policy' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'System/Group Policy*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'System/Group Policy*' -SingleObject + } } InternetCommunicationManagement = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> System/Internet Communication Management' - Code = { + GPOPath = 'Policies -> Administrative Templates -> System/Internet Communication Management' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'System/Internet Communication Management*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'System/Internet Communication Management*' -SingleObject + } } InternetExplorer = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Windows Components/Internet Explorer' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Windows Components/Internet Explorer' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Internet Explorer*', 'Composants Windows/Celle Internet Explorer' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Internet Explorer*', 'Composants Windows/Celle Internet Explorer' -SingleObject + } } InternetExplorerZones = [ordered] @{ ByReports = @( @@ -374,41 +441,50 @@ } } KDC = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> System/KDC' - Code = { + GPOPath = 'Policies -> Administrative Templates -> System/KDC' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'System/KDC' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'System/KDC' -SingleObject + } } LAPS = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> LAPS' - Code = { + GPOPath = 'Policies -> Administrative Templates -> LAPS' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'LAPS' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'LAPS' -SingleObject + } } Lithnet = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Lithnet/Password Protection for Active Directory' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Lithnet/Password Protection for Active Directory' + Code = { #ConvertTo-XMLLithnetFilter -GPO $GPO ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Lithnet/Password Protection for Active Directory*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Lithnet/Password Protection for Active Directory*' -SingleObject + } } LocalUsers = [ordered] @{ Types = @( @@ -441,152 +517,188 @@ } } Logon = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings'; Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> System/Logon' - Code = { + GPOPath = 'Policies -> Administrative Templates -> System/Logon' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'System/Logon*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'System/Logon*' -SingleObject + } } MicrosoftOutlook2002 = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Microsoft Outlook 2002' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Microsoft Outlook 2002' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Microsoft Outlook 2002*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Microsoft Outlook 2002*' -SingleObject + } } MicrosoftEdge = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = @( + GPOPath = @( 'Policies -> Administrative Templates -> Microsoft Edge' 'Policies -> Administrative Templates -> Windows Components/Edge UI' 'Policies -> Administrative Templates -> Windows Components/Microsoft Edge' ) - Code = { + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Microsoft Edge*', 'Windows Components/Microsoft Edge', 'Windows Components/Edge UI' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Microsoft Edge*', 'Windows Components/Microsoft Edge', 'Windows Components/Edge UI' -SingleObject + } } MicrosoftOutlook2003 = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = @( + GPOPath = @( 'Policies -> Administrative Templates -> Microsoft Office Outlook 2003' 'Policies -> Administrative Templates -> Outlook 2003 RPC Encryption' ) - Code = { + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Microsoft Office Outlook 2003*', 'Outlook 2003 RPC Encryption' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Microsoft Office Outlook 2003*', 'Outlook 2003 RPC Encryption' -SingleObject + } } MicrosoftOutlook2010 = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Microsoft Outlook 2010' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Microsoft Outlook 2010' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Microsoft Outlook 2010*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Microsoft Outlook 2010*' -SingleObject + } } MicrosoftOutlook2013 = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Microsoft Outlook 2013' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Microsoft Outlook 2013' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Microsoft Outlook 2013*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Microsoft Outlook 2013*' -SingleObject + } } MicrosoftOutlook2016 = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Microsoft Outlook 2016' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Microsoft Outlook 2016' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Microsoft Outlook 2016*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Microsoft Outlook 2016*' -SingleObject + } } MicrosoftManagementConsole = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Windows Components/Microsoft Management Console' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Windows Components/Microsoft Management Console' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Microsoft Management Console*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Microsoft Management Console*' -SingleObject + } } NetMeeting = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Windows Components/NetMeeting' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Windows Components/NetMeeting' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/NetMeeting*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/NetMeeting*' -SingleObject + } } MSSLegacy = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> MSS (Legacy)' - Code = { + GPOPath = 'Policies -> Administrative Templates -> MSS (Legacy)' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'MSS (Legacy)' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'MSS (Legacy)' -SingleObject + } } MSSecurityGuide = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> MS Security Guide' - Code = { + GPOPath = 'Policies -> Administrative Templates -> MS Security Guide' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'MS Security Guide' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'MS Security Guide' -SingleObject + } } OneDrive = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Windows Components/OneDrive' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Windows Components/OneDrive' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/OneDrive*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/OneDrive*' -SingleObject + } } Policies = @{ Comment = "This isn't really translated" @@ -624,19 +736,22 @@ } } PrintersPolicies = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = @( + GPOPath = @( 'Policies -> Administrative Templates -> Printers' 'Policies -> Administrative Templates -> Control Panel/Printers' ) - Code = { + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Printers*', 'Control Panel/Printers*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Printers*', 'Control Panel/Printers*' -SingleObject + } } PublicKeyPoliciesCertificates = [ordered] @{ Types = @( @@ -736,18 +851,21 @@ } } PublicKeyPoliciesEnrollmentPolicy = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = @( + GPOPath = @( 'Policies -> Windows Settings -> Security Settings -> Public Key Policies' ) - Code = { + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'System/Internet Communication Management*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'System/Internet Communication Management*' -SingleObject + } } RegistrySetting = [ordered] @{ Types = @( @@ -780,52 +898,64 @@ } } OnlineAssistance = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Windows Components/Online Assistance' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Windows Components/Online Assistance' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Online Assistance*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Online Assistance*' -SingleObject + } } RemoteAssistance = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> System/Remote Assistance' - Code = { + GPOPath = 'Policies -> Administrative Templates -> System/Remote Assistance' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'System/Remote Assistance*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'System/Remote Assistance*' -SingleObject + } } RemoteDesktopServices = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Windows Components/Remote Desktop Services' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Windows Components/Remote Desktop Services' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Remote Desktop Services*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Remote Desktop Services*' -SingleObject + } } RSSFeeds = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Windows Components/RSS Feeds' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Windows Components/RSS Feeds' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/RSS Feeds*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/RSS Feeds*' -SingleObject + } } Scripts = [ordered] @{ Types = @( @@ -939,16 +1069,19 @@ } } TaskSchedulerPolicies = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Windows Components/Task Scheduler' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Windows Components/Task Scheduler' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Task Scheduler*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Task Scheduler*' -SingleObject + } } <# TaskScheduler1 = [ordered] @{ @@ -984,127 +1117,157 @@ } } WindowsDefender = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Windows Components/Windows Defender' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Windows Components/Windows Defender' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Windows Defender*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Windows Defender*' -SingleObject + } } WindowsDefenderExploitGuard = @{ # this needs improvements because of DropDownList - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Windows Components/Microsoft Defender Antivirus/Microsoft Defender Exploit Guard' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Windows Components/Microsoft Defender Antivirus/Microsoft Defender Exploit Guard' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Microsoft Defender Antivirus/Microsoft Defender Exploit Guard*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Microsoft Defender Antivirus/Microsoft Defender Exploit Guard*' -SingleObject + } } WindowsHelloForBusiness = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Windows Components/Windows Hello For Business' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Windows Components/Windows Hello For Business' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Windows Hello For Business*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Windows Hello For Business*' -SingleObject + } } WindowsInstaller = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Windows Components/Windows Installer' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Windows Components/Windows Installer' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Windows Installer*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Windows Installer*' -SingleObject + } } WindowsLogon = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Windows Components/Windows Logon Options' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Windows Components/Windows Logon Options' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Windows Logon Options*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Windows Logon Options*' -SingleObject + } } WindowsMediaPlayer = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Windows Components/Windows Media Player' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Windows Components/Windows Media Player' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Windows Media Player*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Windows Media Player*' -SingleObject + } } WindowsMessenger = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Windows Components/Windows Messenger' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Windows Components/Windows Messenger' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Windows Messenger*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Windows Messenger*' -SingleObject + } } WindowsPowerShell = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Windows Components/Windows PowerShell' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Windows Components/Windows PowerShell' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Windows PowerShell*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Windows PowerShell*' -SingleObject + } } WindowsRemoteManagement = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = 'Policies -> Administrative Templates -> Windows Components/Windows Remote Management (WinRM)' - Code = { + GPOPath = 'Policies -> Administrative Templates -> Windows Components/Windows Remote Management (WinRM)' + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Windows Remote Management (WinRM)*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Windows Remote Management (WinRM)*' -SingleObject + } } WindowsUpdate = @{ - Types = @( + Types = @( @{ Category = 'RegistrySettings' Settings = 'Policy' } ) - GPOPath = @( + GPOPath = @( 'Policies -> Administrative Templates -> Windows Components/Windows Update' #'Policies -> Administrative Templates -> Windows Components/Delivery Optimization' ) - Code = { + Code = { ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Windows Update*', 'Windows Components/Delivery Optimization*' } + CodeSingle = { + ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Windows Update*', 'Windows Components/Delivery Optimization*' -SingleObject + } } } \ No newline at end of file