From eb1b9989a17092d1fbb1345256ad37a1bc4b6a41 Mon Sep 17 00:00:00 2001 From: Shirofune-Security <43838376+Shirofune-Security@users.noreply.github.com> Date: Mon, 21 Sep 2026 22:38:22 +0900 Subject: [PATCH] Load the service enum for isolated Windows PowerShell fixtures --- tests/AppLockerScriptProbe.Tests.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/AppLockerScriptProbe.Tests.ps1 b/tests/AppLockerScriptProbe.Tests.ps1 index 48c4d86d..f05edf4b 100644 --- a/tests/AppLockerScriptProbe.Tests.ps1 +++ b/tests/AppLockerScriptProbe.Tests.ps1 @@ -3,6 +3,8 @@ $repo=Split-Path $PSScriptRoot -Parent . "$repo/scripts/AppLockerReadiness.ps1" . "$repo/scripts/WefArrival.ps1" . "$repo/scripts/AppLockerScriptProbe.ps1" +# Mocking Get-Service skips the cmdlet's normal .NET Framework assembly load. +if(-not ('System.ServiceProcess.ServiceControllerStatus' -as [type])){Add-Type -AssemblyName System.ServiceProcess -ErrorAction Stop} $count=0 function Assert($Value,$Message){if(-not $Value){throw $Message};$script:count++} function Reject([scriptblock]$Action,[string]$Pattern){$message='';try{&$Action|Out-Null}catch{$message=$_.Exception.Message};Assert ($message -match $Pattern) "Expected $Pattern; got $message"}