Added LAPS support

This commit is contained in:
Przemyslaw Klys
2020-07-31 11:00:57 +02:00
parent 2d164750f1
commit 0bf093351f
2 changed files with 60 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
function ConvertTo-XMLLaps {
[cmdletBinding()]
param(
[PSCustomObject] $GPO
)
$CreateGPO = [ordered]@{
DisplayName = $GPO.DisplayName
DomainName = $GPO.DomainName
GUID = $GPO.GUID
GpoType = $GPO.GpoType
#GpoCategory = $GPOEntry.GpoCategory
#GpoSettings = $GPOEntry.GpoSettings
'EnableLocalAdminPasswordManagement' = 'Not set'
'PasswordSettings' = 'Not set'
'PasswordComplexity' = $null
'PasswordLength' = $null
'PasswordAge(Days)' = $null
'AdministratorAccountName' = $null
'NameOfAdministratorAccountToManage' = 'Not set'
'DoNotAllowPasswordExpirationTimeLongerThanRequiredByPolicy' = 'Not set'
}
if ($GPO.DataSet.Category -eq 'LAPS') {
foreach ($Policy in $GPO.DataSet) {
if ($Policy.Category -eq 'LAPS') {
foreach ($Setting in @('DropDownList', 'Numeric', 'EditText')) {
if ($Policy.$Setting) {
foreach ($Value in $Policy.$Setting) {
$Name = Format-ToTitleCase -Text $Value.Name -RemoveWhiteSpace
if ($Value.Value -is [string]) {
$CreateGPO["$Name"] = $Value.Value
} else {
$CreateGPO["$Name"] = $Value.Value.Name
}
}
}
}
$Name = (Format-ToTitleCase -Text $Policy.Name -RemoveWhiteSpace)
$CreateGPO[$Name] = $Policy.State
}
}
$CreateGPO['Linked'] = $GPO.Linked
$CreateGPO['LinksCount'] = $GPO.LinksCount
$CreateGPO['Links'] = $GPO.Links
[PSCustomObject] $CreateGPO
}
}
+14
View File
@@ -92,6 +92,20 @@
ConvertTo-XMLEventLog -GPO $GPO
}
}
LAPS = @{
Types = @(
@{
Category = 'RegistrySettings'
Settings = 'Policy'
}
)
Code = {
ConvertTo-XMLLaps -GPO $GPO
}
CodeSingle = {
ConvertTo-XMLLaps -GPO $GPO
}
}
LocalUsers = [ordered] @{
Types = @(
@{