This commit is contained in:
Przemyslaw Klys
2020-06-28 22:47:51 +02:00
parent f73c445385
commit a7583508f5
3 changed files with 77 additions and 1 deletions
+31
View File
@@ -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
}
}
+29
View File
@@ -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
}
}
+17 -1
View File
@@ -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'