diff --git a/Private/ConvertTo-AccountPolicies.ps1 b/Private/ConvertTo-AccountPolicies.ps1 new file mode 100644 index 0000000..b3dcca1 --- /dev/null +++ b/Private/ConvertTo-AccountPolicies.ps1 @@ -0,0 +1,31 @@ +# TODO: #2 Identical to ConvertTo-EventLog - decide what to do later on + +function ConvertTo-AccountPolicies { + [cmdletBinding()] + param( + [Array] $GPOList + ) + foreach ($GPOEntry in $GPOList) { + $CreateGPO = [ordered]@{ + DisplayName = $GPOEntry.DisplayName #: WO_SEC_NTLM_Auth_Level + DomainName = $GPOEntry.DomainName #: area1.local + GUID = $GPOEntry.GUID #: 364B095E-C7BF-4CC1-9BFA-393BD38975E5 + GpoType = $GPOEntry.GpoType #: Computer + GpoCategory = $GPOEntry.GpoCategory #: SecuritySettings + GpoSettings = $GPOEntry.GpoSettings #: SecurityOptions + Type = $GPOEntry.Type + Policy = $GPOEntry.Name + + } + if ($GPOEntry.SettingBoolean) { + $CreateGPO['Setting'] = if ($GPOEntry.SettingBoolean -eq 'true') { 'Enabled' } elseif ($GPOEntry.SettingBoolean -eq 'false') { 'Disabled' } else { $null }; + #try { [bool]::Parse($GPOEntry.SettingBoolean) } catch { $null }; + } elseif ($GPOEntry.SettingNumber) { + $CreateGPO['Setting'] = $GPOEntry.SettingNumber + } + $CreateGPO['Linked'] = $GPOEntry.Linked #: True + $CreateGPO['LinksCount'] = $GPOEntry.LinksCount #: 1 + $CreateGPO['Links'] = $GPOEntry.Links #: area1.local + [PSCustomObject] $CreateGPO + } +} \ No newline at end of file diff --git a/Private/ConvertTo-EventLog.ps1 b/Private/ConvertTo-EventLog.ps1 new file mode 100644 index 0000000..0c2b5bc --- /dev/null +++ b/Private/ConvertTo-EventLog.ps1 @@ -0,0 +1,29 @@ +function ConvertTo-EventLog { + [cmdletBinding()] + param( + [Array] $GPOList + ) + foreach ($GPOEntry in $GPOList) { + $CreateGPO = [ordered]@{ + DisplayName = $GPOEntry.DisplayName #: WO_SEC_NTLM_Auth_Level + DomainName = $GPOEntry.DomainName #: area1.local + GUID = $GPOEntry.GUID #: 364B095E-C7BF-4CC1-9BFA-393BD38975E5 + GpoType = $GPOEntry.GpoType #: Computer + GpoCategory = $GPOEntry.GpoCategory #: SecuritySettings + GpoSettings = $GPOEntry.GpoSettings #: SecurityOptions + Type = $GPOEntry.Type + Policy = $GPOEntry.Name + + } + if ($GPOEntry.SettingBoolean) { + $CreateGPO['Setting'] = if ($GPOEntry.SettingBoolean -eq 'true') { 'Enabled' } elseif ($GPOEntry.SettingBoolean -eq 'false') { 'Disabled' } else { $null }; + #try { [bool]::Parse($GPOEntry.SettingBoolean) } catch { $null }; + } elseif ($GPOEntry.SettingNumber) { + $CreateGPO['Setting'] = $GPOEntry.SettingNumber + } + $CreateGPO['Linked'] = $GPOEntry.Linked #: True + $CreateGPO['LinksCount'] = $GPOEntry.LinksCount #: 1 + $CreateGPO['Links'] = $GPOEntry.Links #: area1.local + [PSCustomObject] $CreateGPO + } +} \ No newline at end of file diff --git a/Private/Script.GPODictionary.ps1 b/Private/Script.GPODictionary.ps1 index 2153a5f..fec38e6 100644 --- a/Private/Script.GPODictionary.ps1 +++ b/Private/Script.GPODictionary.ps1 @@ -1,4 +1,12 @@ -$Script:GPODitionary = @{ +$Script:GPODitionary = [ordered] @{ + AccountPolicies = [ordered] @{ + Category = 'SecuritySettings' + Settings = 'Account' + GPOPath = 'Computer Configuration -> Policies -> Windows Settings -> Security Settings -> Account Policies' + Code = { + ConvertTo-AccountPolicies -GPOList $GPOList + } + } Autologon = [ordered] @{ Category = 'RegistrySettings' Settings = 'RegistrySettings' @@ -6,6 +14,14 @@ ConvertTo-RegistryAutologon -GPOList $GPOList } } + EventLog = [ordered] @{ + Category = 'SecuritySettings' + Settings = 'EventLog' + #GPOPath = 'Computer Configuration -> Policies -> Windows Settings -> Security Settings -> Account Policies' + Code = { + ConvertTo-EventLog -GPOList $GPOList + } + } LocalUsersAndGroups = [ordered] @{ Category = 'LugsSettings' Settings = 'LocalUsersAndGroups'