mirror of
https://github.com/EvotecIT/GPOZaurr.git
synced 2026-08-07 09:26:44 +00:00
93 lines
6.3 KiB
PowerShell
93 lines
6.3 KiB
PowerShell
function Get-XMLLocalUserGroups {
|
|
[cmdletBinding()]
|
|
param(
|
|
[PSCustomObject] $GPO,
|
|
[System.Xml.XmlElement[]] $GPOOutput,
|
|
[string] $Splitter = [System.Environment]::NewLine,
|
|
[switch] $FullObjects
|
|
)
|
|
$LinksInformation = Get-LinksFromXML -GPOOutput $GPOOutput -Splitter $Splitter -FullObjects:$FullObjects
|
|
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 = $LinksInformation.Linked
|
|
LinksCount = $LinksInformation.LinksCount
|
|
Links = $LinksInformation.Links
|
|
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 = $LinksInformation.Linked
|
|
LinksCount = $LinksInformation.LinksCount
|
|
Links = $LinksInformation.Links
|
|
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
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |