mirror of
https://github.com/EvotecIT/GPOZaurr.git
synced 2026-07-26 11:49:17 +00:00
XML parsing improvements
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
function Get-XMLAutologon {
|
||||
[cmdletBinding()]
|
||||
param(
|
||||
[PSCustomObject] $GPO,
|
||||
[System.Xml.XmlElement[]] $GPOOutput
|
||||
)
|
||||
if ($GPOOutput.LinksTo) {
|
||||
$Linked = $true
|
||||
$LinksCount = ([Array] $GPOOutput.LinksTo).Count
|
||||
} else {
|
||||
$Linked = $false
|
||||
$LinksCount = 0
|
||||
}
|
||||
foreach ($Type in @('User', 'Computer')) {
|
||||
if ($GPOOutput.$Type.ExtensionData.Extension.RegistrySettings) {
|
||||
foreach ($Key in $GPOOutput.$Type.ExtensionData.Extension.RegistrySettings.Registry) {
|
||||
#$Key
|
||||
<#
|
||||
clsid : {9CD4B2F4-923D-47f5-A062-E897DD1DAD50}
|
||||
name : AutoAdminLogon
|
||||
status : AutoAdminLogon
|
||||
image : 7
|
||||
changed : 2013-02-06 09:57:45
|
||||
uid : {23AD1B6F-0D90-49B5-926D-AAA6E1E2F4B3}
|
||||
GPOSettingOrder : 1
|
||||
Properties : Properties
|
||||
Filters :
|
||||
#>
|
||||
|
||||
<# $Key.properties
|
||||
action : U
|
||||
displayDecimal : 0
|
||||
default : 0
|
||||
hive : HKEY_LOCAL_MACHINE
|
||||
key : SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
|
||||
name : AutoAdminLogon
|
||||
type : REG_SZ
|
||||
value : 1
|
||||
Values :
|
||||
#>
|
||||
[PSCustomObject] @{
|
||||
DisplayName = $GPO.DisplayName
|
||||
DomainName = $GPO.DomainName
|
||||
GUID = $GPO.Guid
|
||||
Linked = $Linked
|
||||
LinksCount = $LinksCount
|
||||
Changed = [DateTime] $Key.changed
|
||||
GPOSettingOrder = $Key.GPOSettingOrder
|
||||
hive = $Key.Properties.hive #: HKEY_LOCAL_MACHINE
|
||||
key = $Key.Properties.key #: SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
|
||||
name = $Key.Properties.name #: AutoAdminLogon
|
||||
type = $Key.Properties.type #: REG_SZ
|
||||
value = $Key.Properties.value #
|
||||
Filters = $Key.Filters
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,6 +112,9 @@
|
||||
'UserSettingsVersionIdentical' = if ($XMLContent.GPO.User.VersionDirectory -eq $XMLContent.GPO.User.VersionSysvol) { $true } else { $false }
|
||||
'UserSettings' = $XMLContent.GPO.User.ExtensionData.Extension
|
||||
|
||||
ComputerPolicies = $XMLContent.GPO.Computer.ExtensionData.Name -join ", "
|
||||
UserPolicies = $XMLContent.GPO.User.ExtensionData.Name -join ", "
|
||||
|
||||
'CreationTime' = [DateTime] $XMLContent.GPO.CreatedTime
|
||||
'ModificationTime' = [DateTime] $XMLContent.GPO.ModifiedTime
|
||||
'ReadTime' = [DateTime] $XMLContent.GPO.ReadTime
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
|
||||
function Get-XMLLocalUserGroups {
|
||||
[cmdletBinding()]
|
||||
param(
|
||||
[PSCustomObject] $GPO,
|
||||
[System.Xml.XmlElement[]] $GPOOutput
|
||||
)
|
||||
if ($GPOOutput.LinksTo) {
|
||||
$Linked = $true
|
||||
$LinksCount = ([Array] $GPOOutput.LinksTo).Count
|
||||
} else {
|
||||
$Linked = $false
|
||||
$LinksCount = 0
|
||||
}
|
||||
foreach ($Type in @('User', 'Computer')) {
|
||||
if ($GPOOutput.$Type.ExtensionData.Extension.LocalUsersAndGroups) {
|
||||
foreach ($NestedType in @('User', 'Group')) {
|
||||
if ($GPOOutput.$Type.ExtensionData.Extension.LocalUsersAndGroups.$NestedType) {
|
||||
foreach ($Entry in $GPOOutput.$Type.ExtensionData.Extension.LocalUsersAndGroups.$NestedType) {
|
||||
if ($Entry.Properties.Members) {
|
||||
foreach ($Members in $Entry.Properties.Members) {
|
||||
foreach ($Member in $Members.Member) {
|
||||
[PSCustomObject] @{
|
||||
DisplayName = $GPO.DisplayName
|
||||
DomainName = $GPO.DomainName
|
||||
GUID = $GPO.Guid
|
||||
Linked = $Linked
|
||||
LinksCount = $LinksCount
|
||||
GpoType = $Type
|
||||
Name = $Entry.name
|
||||
Changed = [DateTime] $Entry.changed
|
||||
GPOSettingOrder = $Entry.GPOSettingOrder
|
||||
Filters = $Entry.Filters
|
||||
ActionType = $NestedType
|
||||
Action = $Entry.Properties.Action
|
||||
UserName = $Entry.Properties.userName
|
||||
NewName = $Entry.Properties.newName
|
||||
Description = $Entry.Properties.description
|
||||
DeleteAllUsers = [bool] $Entry.Properties.deleteAllUsers
|
||||
DeleteAllGroups = [bool] $Entry.Properties.deleteAllGroups
|
||||
RemoveAccounts = [bool] $Entry.Properties.removeAccounts
|
||||
GroupSid = $Entry.Properties.groupSid
|
||||
GroupName = $Entry.Properties.groupName
|
||||
MembersName = $Member.Name
|
||||
MembersAction = $Member.Action
|
||||
MembersSid = $Member.Sid
|
||||
FullName = $Entry.Properties.fullName
|
||||
AccountCpassword = $Entry.Properties.cpassword
|
||||
AccountChangeLogon = [bool] $Entry.Properties.changeLogon
|
||||
AccountNoChange = [bool] $Entry.Properties.noChange
|
||||
AccountNeverExpires = [bool] $Entry.Properties.neverExpires
|
||||
AccountDisabled = [bool] $Entry.Properties.acctDisabled
|
||||
SubAuthority = $Entry.Properties.subAuthority
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
[PSCustomObject] @{
|
||||
DisplayName = $GPO.DisplayName
|
||||
DomainName = $GPO.DomainName
|
||||
GUID = $GPO.Guid
|
||||
Linked = $Linked
|
||||
LinksCount = $LinksCount
|
||||
GpoType = $Type
|
||||
Name = $Entry.name
|
||||
Changed = [DateTime] $Entry.changed
|
||||
GPOSettingOrder = $Entry.GPOSettingOrder
|
||||
Filters = $Entry.Filters
|
||||
ActionType = $NestedType
|
||||
Action = $Entry.Properties.Action
|
||||
UserName = $Entry.Properties.userName
|
||||
NewName = $Entry.Properties.newName
|
||||
Description = $Entry.Properties.description
|
||||
DeleteAllUsers = [bool] $Entry.Properties.deleteAllUsers
|
||||
DeleteAllGroups = [bool] $Entry.Properties.deleteAllGroups
|
||||
RemoveAccounts = [bool] $Entry.Properties.removeAccounts
|
||||
GroupSid = $Entry.Properties.groupSid
|
||||
GroupName = $Entry.Properties.groupName
|
||||
MembersName = $null
|
||||
MembersAction = $null
|
||||
MembersSid = $null
|
||||
FullName = $Entry.Properties.fullName
|
||||
AccountCpassword = $Entry.Properties.cpassword
|
||||
AccountChangeLogon = [bool] $Entry.Properties.changeLogon
|
||||
AccountNoChange = [bool] $Entry.Properties.noChange
|
||||
AccountNeverExpires = [bool] $Entry.Properties.neverExpires
|
||||
AccountDisabled = [bool] $Entry.Properties.acctDisabled
|
||||
SubAuthority = $Entry.Properties.subAuthority
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user