mirror of
https://github.com/EvotecIT/GPOZaurr.git
synced 2026-08-30 12:09:28 +00:00
Update
This commit is contained in:
@@ -2,8 +2,10 @@
|
|||||||
[cmdletBinding()]
|
[cmdletBinding()]
|
||||||
param(
|
param(
|
||||||
[System.Xml.XmlElement]$Content,
|
[System.Xml.XmlElement]$Content,
|
||||||
$ResultantSetPolicy,
|
[string] $ResultsType,
|
||||||
[string] $ComputerName
|
[Microsoft.GroupPolicy.GPRsop] $ResultantSetPolicy,
|
||||||
|
[string] $ComputerName,
|
||||||
|
[string] $Splitter = [System.Environment]::NewLine
|
||||||
)
|
)
|
||||||
$GPOPrimary = [ordered] @{
|
$GPOPrimary = [ordered] @{
|
||||||
Summary = $null
|
Summary = $null
|
||||||
@@ -14,21 +16,22 @@
|
|||||||
$Object = [ordered] @{
|
$Object = [ordered] @{
|
||||||
ComputerName = $ComputerName
|
ComputerName = $ComputerName
|
||||||
ReadTime = [DateTime] $Content.ReadTime
|
ReadTime = [DateTime] $Content.ReadTime
|
||||||
ComputerName1 = $Content.ComputerResults.Name
|
ComputerName1 = $Content.$ResultsType.Name
|
||||||
DomainName = $Content.ComputerResults.Domain
|
DomainName = $Content.$ResultsType.Domain
|
||||||
OrganizationalUnit = $Content.ComputerResults.SOM
|
OrganizationalUnit = $Content.$ResultsType.SOM
|
||||||
Site = $Content.ComputerResults.Site
|
Site = $Content.$ResultsType.Site
|
||||||
SlowLink = if ($Content.ComputerResults.SlowLink -eq 'true') { $true } else { $false };
|
GPOTypes = $Content.$ResultsType.ExtensionData.Name -join $Splitter
|
||||||
|
SlowLink = if ($Content.$ResultsType.SlowLink -eq 'true') { $true } else { $false };
|
||||||
}
|
}
|
||||||
|
|
||||||
$GPOPrimary['Summary'] = $Object
|
$GPOPrimary['Summary'] = $Object
|
||||||
[Array] $GPOPrimary['SecurityGroups'] = foreach ($Group in $Content.ComputerResults.SecurityGroup) {
|
[Array] $GPOPrimary['SecurityGroups'] = foreach ($Group in $Content.$ResultsType.SecurityGroup) {
|
||||||
[PSCustomObject] @{
|
[PSCustomObject] @{
|
||||||
Name = $Group.Name.'#Text'
|
Name = $Group.Name.'#Text'
|
||||||
SID = $Group.SID.'#Text'
|
SID = $Group.SID.'#Text'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[Array] $GPOPrimary['GroupPolicies'] = foreach ($GPO in $Content.ComputerResults.GPO) {
|
[Array] $GPOPrimary['GroupPolicies'] = foreach ($GPO in $Content.$ResultsType.GPO) {
|
||||||
[PSCustomObject] @{
|
[PSCustomObject] @{
|
||||||
Name = $GPO.Name
|
Name = $GPO.Name
|
||||||
#Path = $GPO.Path
|
#Path = $GPO.Path
|
||||||
@@ -43,21 +46,32 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$GPOPrimary['SummaryDetails'] = [Ordered] @{
|
[Array] $GPOPrimary['ScopeOfManagement'] = foreach ($SOM in $Content.$ResultsType.SearchedSOM) {
|
||||||
ActivityId = $Content.ComputerResults.EventsDetails.SinglePassEventsDetails.ActivityId # : {6400d0bf-ac88-4ee6-b2c2-ca2cbbab0695}
|
[PSCustomObject] @{
|
||||||
ProcessingTrigger = $Content.ComputerResults.EventsDetails.SinglePassEventsDetails.ProcessingTrigger # : Periodic
|
Path = $SOM.Path
|
||||||
ProcessingAppMode = $Content.ComputerResults.EventsDetails.SinglePassEventsDetails.ProcessingAppMode # : Background
|
Type = $SOM.Type
|
||||||
LinkSpeedInKbps = $Content.ComputerResults.EventsDetails.SinglePassEventsDetails.LinkSpeedInKbps # : 0
|
Order = $SOM.Order
|
||||||
SlowLinkThresholdInKbps = $Content.ComputerResults.EventsDetails.SinglePassEventsDetails.SlowLinkThresholdInKbps # : 500
|
BlocksInheritance = if ($SOM.BlocksInheritance -eq 'true') { $true } else { $false };
|
||||||
DomainControllerName = $Content.ComputerResults.EventsDetails.SinglePassEventsDetails.DomainControllerName # : AD1.ad.evotec.xyz
|
Blocked = if ($SOM.Blocked -eq 'true') { $true } else { $false };
|
||||||
DomainControllerIPAddress = $Content.ComputerResults.EventsDetails.SinglePassEventsDetails.DomainControllerIPAddress # : 192.168.240.189
|
Reason = if ($SOM.Reason -eq 'true') { $true } else { $false };
|
||||||
PolicyProcessingMode = $Content.ComputerResults.EventsDetails.SinglePassEventsDetails.PolicyProcessingMode # : None
|
}
|
||||||
PolicyElapsedTimeInMilliseconds = $Content.ComputerResults.EventsDetails.SinglePassEventsDetails.PolicyElapsedTimeInMilliseconds # : 1202
|
|
||||||
ErrorCount = $Content.ComputerResults.EventsDetails.SinglePassEventsDetails.ErrorCount # : 0
|
|
||||||
WarningCount = $Content.ComputerResults.EventsDetails.SinglePassEventsDetails.WarningCount # : 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Array] $GPOPrimary['ProcessingTime'] = foreach ($Details in $Content.ComputerResults.EventsDetails.SinglePassEventsDetails.ExtensionProcessingTime) {
|
$GPOPrimary['SummaryDetails'] = [Ordered] @{
|
||||||
|
ActivityId = $Content.$ResultsType.EventsDetails.SinglePassEventsDetails.ActivityId # : {6400d0bf-ac88-4ee6-b2c2-ca2cbbab0695}
|
||||||
|
ProcessingTrigger = $Content.$ResultsType.EventsDetails.SinglePassEventsDetails.ProcessingTrigger # : Periodic
|
||||||
|
ProcessingAppMode = $Content.$ResultsType.EventsDetails.SinglePassEventsDetails.ProcessingAppMode # : Background
|
||||||
|
LinkSpeedInKbps = $Content.$ResultsType.EventsDetails.SinglePassEventsDetails.LinkSpeedInKbps # : 0
|
||||||
|
SlowLinkThresholdInKbps = $Content.$ResultsType.EventsDetails.SinglePassEventsDetails.SlowLinkThresholdInKbps # : 500
|
||||||
|
DomainControllerName = $Content.$ResultsType.EventsDetails.SinglePassEventsDetails.DomainControllerName # : AD1.ad.evotec.xyz
|
||||||
|
DomainControllerIPAddress = $Content.$ResultsType.EventsDetails.SinglePassEventsDetails.DomainControllerIPAddress # : 192.168.240.189
|
||||||
|
PolicyProcessingMode = $Content.$ResultsType.EventsDetails.SinglePassEventsDetails.PolicyProcessingMode # : None
|
||||||
|
PolicyElapsedTimeInMilliseconds = $Content.$ResultsType.EventsDetails.SinglePassEventsDetails.PolicyElapsedTimeInMilliseconds # : 1202
|
||||||
|
ErrorCount = $Content.$ResultsType.EventsDetails.SinglePassEventsDetails.ErrorCount # : 0
|
||||||
|
WarningCount = $Content.$ResultsType.EventsDetails.SinglePassEventsDetails.WarningCount # : 0
|
||||||
|
}
|
||||||
|
|
||||||
|
[Array] $GPOPrimary['ProcessingTime'] = foreach ($Details in $Content.$ResultsType.EventsDetails.SinglePassEventsDetails.ExtensionProcessingTime) {
|
||||||
[PSCustomObject] @{
|
[PSCustomObject] @{
|
||||||
ExtensionName = $Details.ExtensionName
|
ExtensionName = $Details.ExtensionName
|
||||||
ExtensionGuid = $Details.ExtensionGuid
|
ExtensionGuid = $Details.ExtensionGuid
|
||||||
@@ -65,7 +79,19 @@
|
|||||||
ProcessedTimeStamp = $Details.ProcessedTimeStamp
|
ProcessedTimeStamp = $Details.ProcessedTimeStamp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[Array] $GPOPrimary['Events'] = foreach ($Event in $Content.ComputerResults.EventsDetails.SinglePassEventsDetails.EventRecord) {
|
[Array] $GPOPrimary['ExtensionStatus'] = foreach ($Details in $Content.$ResultsType.ExtensionStatus) {
|
||||||
|
[PSCustomObject] @{
|
||||||
|
Name = $Details.Name # : Registry
|
||||||
|
Identifier = $Details.Identifier # : {35378EAC-683F-11D2-A89A-00C04FBBCFA2}
|
||||||
|
BeginTime = $Details.BeginTime # : 2020-04-02T12:05:10
|
||||||
|
EndTime = $Details.EndTime # : 2020-04-02T12:05:10
|
||||||
|
LoggingStatus = $Details.LoggingStatus # : Complete
|
||||||
|
Error = $Details.Error # : 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[Array] $GPOPrimary['ExtensionData'] = $Content.$ResultsType.ExtensionData.Extension
|
||||||
|
|
||||||
|
[Array] $GPOPrimary['Events'] = foreach ($Event in $Content.$ResultsType.EventsDetails.SinglePassEventsDetails.EventRecord) {
|
||||||
[xml] $EventDetails = $Event.EventXML
|
[xml] $EventDetails = $Event.EventXML
|
||||||
$EventInformation = [ordered] @{
|
$EventInformation = [ordered] @{
|
||||||
Description = $Event.EventDescription
|
Description = $Event.EventDescription
|
||||||
|
|||||||
@@ -2,8 +2,10 @@
|
|||||||
[cmdletBinding()]
|
[cmdletBinding()]
|
||||||
param(
|
param(
|
||||||
[ValidateSet('XML', 'Object')][string] $Type = 'Object',
|
[ValidateSet('XML', 'Object')][string] $Type = 'Object',
|
||||||
[string] $ComputerName,
|
[alias('Server')][string] $ComputerName,
|
||||||
[string] $Path
|
[alias('User')][string] $UserName,
|
||||||
|
[string] $Path,
|
||||||
|
[string] $Splitter = [System.Environment]::NewLine
|
||||||
)
|
)
|
||||||
|
|
||||||
$SplatPolicy = @{
|
$SplatPolicy = @{
|
||||||
@@ -14,7 +16,7 @@
|
|||||||
$SplatPolicy['Computer'] = $ComputerName
|
$SplatPolicy['Computer'] = $ComputerName
|
||||||
}
|
}
|
||||||
if ($PSBoundParameters.ContainsKey('UserName')) {
|
if ($PSBoundParameters.ContainsKey('UserName')) {
|
||||||
$SplatPolicy['User'] = 'przemyslaw.klys'
|
$SplatPolicy['User'] = $UserName
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$ResultantSetPolicy = Get-GPResultantSetOfPolicy @SplatPolicy
|
$ResultantSetPolicy = Get-GPResultantSetOfPolicy @SplatPolicy
|
||||||
@@ -38,6 +40,15 @@
|
|||||||
if ($Type -eq 'XML') {
|
if ($Type -eq 'XML') {
|
||||||
$PolicyContent.Rsop
|
$PolicyContent.Rsop
|
||||||
} else {
|
} else {
|
||||||
ConvertFrom-XMLRSOP -Content $PolicyContent.Rsop -ComputerName $ComputerName -ResultantSetPolicy $ResultantSetPolicy
|
$Output = [ordered] @{
|
||||||
|
ResultantSetPolicy = $ResultantSetPolicy
|
||||||
|
}
|
||||||
|
if ($PolicyContent.Rsop.ComputerResults) {
|
||||||
|
$Output.ComputerResults = ConvertFrom-XMLRSOP -Content $PolicyContent.Rsop -ComputerName $ComputerName -ResultantSetPolicy $ResultantSetPolicy -ResultsType 'ComputerResults' -Splitter $Splitter
|
||||||
|
}
|
||||||
|
if ($PolicyContent.Rsop.UserResults) {
|
||||||
|
$Output.UserResults = ConvertFrom-XMLRSOP -Content $PolicyContent.Rsop -ComputerName $ComputerName -ResultantSetPolicy $ResultantSetPolicy -ResultsType 'UserResults' -Splitter $Splitter
|
||||||
|
}
|
||||||
|
$Output
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user