Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion test/powershell/engine/Security/FileSignature.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,15 @@ Describe "Windows platform file signatures" -Tags 'Feature' {
}

Describe "Windows file content signatures" -Tags @('Feature', 'RequireAdminOnWindows') {
$PSDefaultParameterValues = @{ "It:Skip" = (-not $IsWindows) }
$shouldSkip = (-not $IsWindows) -or (Test-IsWinServer2012R2)

$PSDefaultParameterValues = @{ "It:Skip" = $shouldSkip }

BeforeAll {
if ($shouldSkip) {
return
}

$session = New-PSSession -UseWindowsPowerShell
try {
# New-SelfSignedCertificate runs in implicit remoting so do all the
Expand Down Expand Up @@ -83,6 +89,11 @@ Describe "Windows file content signatures" -Tags @('Feature', 'RequireAdminOnWin
}

AfterAll {

if ($shouldSkip) {
return
}

Remove-Item -Path Cert:\LocalMachine\Root\$caRootThumbprint -Force
Remove-Item -Path Cert:\LocalMachine\TrustedPublisher\$signingThumbprint -Force
Remove-Item -Path Cert:\CurrentUser\My\$signingThumbprint -Force
Expand Down