mirror of
https://github.com/EvotecIT/GPOZaurr.git
synced 2026-08-31 12:47:59 +00:00
Update
This commit is contained in:
@@ -6,10 +6,11 @@
|
|||||||
[alias('ForestName')][string] $Forest,
|
[alias('ForestName')][string] $Forest,
|
||||||
[string[]] $ExcludeDomains,
|
[string[]] $ExcludeDomains,
|
||||||
[alias('Domain', 'Domains')][string[]] $IncludeDomains,
|
[alias('Domain', 'Domains')][string[]] $IncludeDomains,
|
||||||
[System.Collections.IDictionary] $ExtendedForestInformation
|
[System.Collections.IDictionary] $ExtendedForestInformation,
|
||||||
|
[switch] $AsHashtable
|
||||||
)
|
)
|
||||||
|
$Dictionary = [ordered] @{}
|
||||||
$wmiFilterAttr = 'msWMI-Name', 'msWMI-Parm1', 'msWMI-Parm2', 'msWMI-Author', 'msWMI-ID', 'CanonicalName', 'Created', 'Modified'
|
$wmiFilterAttr = 'msWMI-Name', 'msWMI-Parm1', 'msWMI-Parm2', 'msWMI-Author', 'msWMI-ID', 'CanonicalName', 'Created', 'Modified'
|
||||||
|
|
||||||
$ForestInformation = Get-WinADForestDetails -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -ExtendedForestInformation $ExtendedForestInformation
|
$ForestInformation = Get-WinADForestDetails -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -ExtendedForestInformation $ExtendedForestInformation
|
||||||
foreach ($Domain in $ForestInformation.Domains) {
|
foreach ($Domain in $ForestInformation.Domains) {
|
||||||
$QueryServer = $ForestInformation['QueryServers'][$Domain]['HostName'][0]
|
$QueryServer = $ForestInformation['QueryServers'][$Domain]['HostName'][0]
|
||||||
@@ -52,7 +53,7 @@
|
|||||||
-join ($WMI[$i + 5], ';' , $WMI[$i + 6])
|
-join ($WMI[$i + 5], ';' , $WMI[$i + 6])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[PSCustomObject] @{
|
$WMIObject = [PSCustomObject] @{
|
||||||
DisplayName = $_.'msWMI-Name'
|
DisplayName = $_.'msWMI-Name'
|
||||||
Description = $_.'msWMI-Parm1'
|
Description = $_.'msWMI-Parm1'
|
||||||
DomainName = $Domain
|
DomainName = $Domain
|
||||||
@@ -68,9 +69,17 @@
|
|||||||
CanonicalName = $_.CanonicalName
|
CanonicalName = $_.CanonicalName
|
||||||
DistinguishedName = $_.'DistinguishedName'
|
DistinguishedName = $_.'DistinguishedName'
|
||||||
}
|
}
|
||||||
|
if (-not $AsHashtable) {
|
||||||
|
$WMIObject
|
||||||
|
} else {
|
||||||
|
$Dictionary[$WMIObject.ID] = $WMIObject
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if ($AsHashtable) {
|
||||||
|
$Dictionary
|
||||||
|
}
|
||||||
}
|
}
|
||||||
<#
|
<#
|
||||||
CanonicalName : ad.evotec.xyz/System/WMIPolicy/SOM/{E988C890-BDBC-4946-87B5-BF70F39F4686}
|
CanonicalName : ad.evotec.xyz/System/WMIPolicy/SOM/{E988C890-BDBC-4946-87B5-BF70F39F4686}
|
||||||
|
|||||||
@@ -52,13 +52,14 @@
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
#Write-Verbose "Request-GPOZaurr - ComputerName: $($SplatPolicy['Computer']) UserName: $($SplatPolicy['User'])"
|
#Write-Verbose "Request-GPOZaurr - ComputerName: $($SplatPolicy['Computer']) UserName: $($SplatPolicy['User'])"
|
||||||
$ResultantSetPolicy = Get-GPResultantSetOfPolicy @SplatPolicy
|
$ResultantSetPolicy = Get-GPResultantSetOfPolicy @SplatPolicy -ErrorAction Stop
|
||||||
} catch {
|
} catch {
|
||||||
if ($_.Exception.Message -eq 'Exception from HRESULT: 0x80041003') {
|
if ($_.Exception.Message -eq 'Exception from HRESULT: 0x80041003') {
|
||||||
Write-Warning "Request-GPOZaurr - Are you running as admin? $($_.Exception.Message)"
|
Write-Warning "Request-GPOZaurr - Are you running as admin? $($_.Exception.Message)"
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
Write-Warning "Request-GPOZaurr - Error: $($_.Exception.Message)"
|
$ErrorMessage = $($_.Exception.Message).Replace([Environment]::NewLine, ' ')
|
||||||
|
Write-Warning "Request-GPOZaurr - Error: $ErrorMessage"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -100,9 +101,11 @@
|
|||||||
if ($PolicyContent.Rsop.UserResults) {
|
if ($PolicyContent.Rsop.UserResults) {
|
||||||
$Output.UserResults = ConvertFrom-XMLRSOP -Content $PolicyContent.Rsop -ResultantSetPolicy $ResultantSetPolicy -ResultsType 'UserResults' -Splitter $Splitter
|
$Output.UserResults = ConvertFrom-XMLRSOP -Content $PolicyContent.Rsop -ResultantSetPolicy $ResultantSetPolicy -ResultsType 'UserResults' -Splitter $Splitter
|
||||||
}
|
}
|
||||||
if ($Type -eq 'Object') {
|
|
||||||
|
New-GPOZaurrReportConsole -Results $Output
|
||||||
|
if ($Type -contains 'Object') {
|
||||||
$Output
|
$Output
|
||||||
} elseif ($Type -eq 'HTML') {
|
} elseif ($Type -contains 'HTML') {
|
||||||
New-GPOZaurrReportHTML -Path $Path -Offline:$Offline -Open:(-not $PreventShow) -Support $Output
|
New-GPOZaurrReportHTML -Path $Path -Offline:$Offline -Open:(-not $PreventShow) -Support $Output
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user