diff --git a/.azure-pipelines/azure-pipelines.yml b/.azure-pipelines/azure-pipelines.yml index 338637c1..1c2580b5 100644 --- a/.azure-pipelines/azure-pipelines.yml +++ b/.azure-pipelines/azure-pipelines.yml @@ -127,8 +127,8 @@ stages: test: 2022/psrp/https - name: 2022 SSH Key test: 2022/ssh/key - - name: 2025 PSRP HTTPS - test: 2025/psrp/https + - name: 2025 PSRP HTTP + test: 2025/psrp/http - name: 2025 SSH Key test: 2025/ssh/key - stage: Windows_2 @@ -150,8 +150,8 @@ stages: test: 2022/psrp/https - name: 2022 SSH Key test: 2022/ssh/key - - name: 2025 PSRP HTTPS - test: 2025/psrp/https + - name: 2025 PSRP HTTP + test: 2025/psrp/http - name: 2025 SSH Key test: 2025/ssh/key - stage: Windows_3 @@ -173,8 +173,8 @@ stages: test: 2022/psrp/https - name: 2022 SSH Key test: 2022/ssh/key - - name: 2025 PSRP HTTPS - test: 2025/psrp/https + - name: 2025 PSRP HTTP + test: 2025/psrp/http - name: 2025 SSH Key test: 2025/ssh/key - stage: Summary diff --git a/tests/integration/targets/win_package/library/prereq_setup.ps1 b/tests/integration/targets/win_package/library/prereq_setup.ps1 new file mode 100644 index 00000000..95e4db14 --- /dev/null +++ b/tests/integration/targets/win_package/library/prereq_setup.ps1 @@ -0,0 +1,37 @@ +#!powershell + +# Copyright: (c) 2024, Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +#AnsibleRequires -CSharpUtil Ansible.Basic + + +$module = [Ansible.Basic.AnsibleModule]::Create($args, @{}) + +# Server 2025 fails to run Get-AppxPackage and other DISM module commands in +# a PSRemoting (psrp) session as it has a dependency on some dll's not present +# in the GAC and only in the powershell.exe directory. As PSRP runs through +# wsmprovhost.exe, it fails to find those dlls. This hack will manually load +# the 4 requires dlls into the GAC so our tests can work. This is a hack and +# should be removed in the future if MS fix their bug on 2025. +try { + $null = Get-AppxPackage +} +catch { + Add-Type -AssemblyName "System.EnterpriseServices" + $publish = [System.EnterpriseServices.Internal.Publish]::new() + + @( + 'System.Numerics.Vectors.dll', + 'System.Runtime.CompilerServices.Unsafe.dll', + 'System.Security.Principal.Windows.dll', + 'System.Memory.dll' + ) | ForEach-Object { + $dllPath = "$env:SystemRoot\System32\WindowsPowerShell\v1.0\$_" + $publish.GacInstall($dllPath) + } + + $module.Result.changed = $true +} + +$module.ExitJson() diff --git a/tests/integration/targets/win_package/tasks/main.yml b/tests/integration/targets/win_package/tasks/main.yml index bedcfb1b..bd6bbb0d 100644 --- a/tests/integration/targets/win_package/tasks/main.yml +++ b/tests/integration/targets/win_package/tasks/main.yml @@ -4,6 +4,9 @@ path: '{{ test_path }}' state: directory +- name: setup 2025 pre-reqs for testing over PSRP + prereq_setup: + # Some of the registry_tests.yml create a badly formed unisntall string so remove the reg entry in case the test # didn't get to cleaning itself up - name: remove registry package path