From f68d838c16c856ec151d0c6eb7bc0477596cdc85 Mon Sep 17 00:00:00 2001 From: JM2K69 Date: Mon, 19 May 2025 10:23:02 +0200 Subject: [PATCH 1/2] Update add somme function and GUI tools --- PSGPOTools/PSGPOTools.psm1 | 251 ++++++++++++++++++++++++++++++++++++- 1 file changed, 248 insertions(+), 3 deletions(-) diff --git a/PSGPOTools/PSGPOTools.psm1 b/PSGPOTools/PSGPOTools.psm1 index c9813e1..466a2c1 100644 --- a/PSGPOTools/PSGPOTools.psm1 +++ b/PSGPOTools/PSGPOTools.psm1 @@ -675,11 +675,14 @@ function Get-PSGPOCategory { } function Get-PSGPOPolicy { [cmdletbinding()] - Param() + Param( + [ValidateSet("User", "Machine")] + [string]$Scope + ) ### VAR ### ### MAIN ### - $Policies = [GpoToolsUtility]::Policies + $Policies = [GpoToolsUtility]::Policies | Where-Object { $_.Scope -eq $Scope } If ($null -eq $Policies){ Write-Warning "Initiate ADMX and ADML files with Initialize-PSGPOAdmx cmdlet." }Else{ @@ -713,5 +716,247 @@ function Initialize-PSGPOAdmx { ### MAIN ### # Empty Statics properties [GPOToolsUtility]::RemoveAll() - [GpotoolsUtility]::InitiateAdmxAdml($Item,$UICulture) + + # Sequential processing to load ADMX and ADML files + [GPOToolsUtility]::InitiateAdmxAdml($Item, $UICulture) } + +function Show-GPOTreeView { + [cmdletbinding()] + Param() + + # Ensure WPF assemblies are loaded for PowerShell 7.5 and .NET 9 compatibility + Add-Type -AssemblyName PresentationFramework + Add-Type -AssemblyName PresentationCore + Add-Type -AssemblyName WindowsBase + + $xaml = @" + + + + + + + + + + + + + + + + +