<# .SYNOPSIS Win11 Style GUI for Microsoft Activation Scripts (MAS) .DESCRIPTION A modern, Fluent-inspired interface for MAS with auto-detection of system status. #> # --- Self-Elevation --- $currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent()) if (-not $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { $scriptPath = $MyInvocation.MyCommand.Path Start-Process powershell.exe -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$scriptPath`"" -Verb RunAs Exit } # --- Assemblies --- Add-Type -AssemblyName PresentationFramework Add-Type -AssemblyName System.Windows.Forms Add-Type -AssemblyName System.Drawing # --- Helper: Get System Info --- function Get-SystemInfo { try { $os = Get-CimInstance Win32_OperatingSystem $comp = Get-CimInstance Win32_ComputerSystem $edition = $os.Caption -replace "Microsoft ", "" $version = $os.Version $build = $os.BuildNumber # Simple Activation Check (Partial) # 1=Licensed $license = Get-CimInstance SoftwareLicensingProduct | Where-Object { $_.PartialProductKey -and $_.Name -like "Windows*" } | Select-Object -First 1 $status = if ($license.LicenseStatus -eq 1) { "Permanently Activated" } else { "Not Activated / check details" } if ($license.LicenseStatus -eq 1 -and $license.GracePeriodRemaining -gt 0) { $status = "Volume/KMS Activated" } return @{ Edition = $edition Version = "Build $build" Status = $status PCName = $comp.Name } } catch { return @{ Edition = "Unknown"; Version = ""; Status = "Unknown"; PCName = "Unknown" } } } $sysInfo = Get-SystemInfo # --- XAML --- [xml]$xaml = @"