-
-
Notifications
You must be signed in to change notification settings - Fork 477
Open
Description
Checklist
- Issue has a meaningful title
- I have searched the existing issues. See all issues
- I have tested using the latest version of Pester. See Installation and update guide.
What is the issue?
Since we switched our CI Windows agents to not run as Administrator, when running tests a (non-failing) error is shown in Pester output at the end of each test suite.
Ex:
[2026-02-21T16:06:56.254Z] Running tests from 'sshAgent.Tests.ps1'
[2026-02-21T16:07:03.675Z] Describing [nanoserver-ltsc2019-jdk17] image has setup-sshd.ps1 in the correct location
[2026-02-21T16:07:04.806Z] [+] has setup-sshd.ps1 in C:/ProgramData/Jenkins 1.04s (912ms|125ms)
[2026-02-21T16:07:11.726Z]
[2026-02-21T16:07:11.726Z] Describing [nanoserver-ltsc2019-jdk17] image has no pre-existing SSH host keys
[2026-02-21T16:07:12.462Z] [+] has has no SSH host key present in C:\ProgramData\ssh 772ms (762ms|10ms)
[2026-02-21T16:07:12.881Z]
[2026-02-21T16:07:12.881Z] Describing [nanoserver-ltsc2019-jdk17] checking image metadata
[2026-02-21T16:07:13.002Z] [+] has correct volumes 130ms (117ms|13ms)
[2026-02-21T16:07:13.223Z] [+] has the source GitHub URL in docker metadata 121ms (115ms|6ms)
[2026-02-21T16:07:19.416Z]
[2026-02-21T16:07:19.416Z] Describing [nanoserver-ltsc2019-jdk17] image has correct version of java and git-lfs installed and in the PATH
[2026-02-21T16:07:21.052Z] [+] has java installed and in the path 1.58s (1.57s|10ms)
[2026-02-21T16:07:22.091Z] [+] has git-lfs (and thus git) installed and in the path 1.06s (1.06s|7ms)
[2026-02-21T16:07:28.899Z]
[2026-02-21T16:07:28.899Z] Describing [nanoserver-ltsc2019-jdk17] create agent container with pubkey as argument
[2026-02-21T16:07:32.000Z] [+] runs commands via ssh 3.09s (3.08s|11ms)
[2026-02-21T16:07:38.727Z]
[2026-02-21T16:07:38.727Z] Describing [nanoserver-ltsc2019-jdk17] create agent container with pubkey as envvar
[2026-02-21T16:07:41.388Z] [+] runs commands via ssh 2.67s (2.66s|14ms)
[2026-02-21T16:07:47.993Z]
[2026-02-21T16:07:47.993Z] Describing [nanoserver-ltsc2019-jdk17] create agent container like docker-plugin with '/usr/sbin/sshd -D -p 22' as argument
[2026-02-21T16:07:50.655Z] [+] runs commands via ssh 2.61s (2.6s|9ms)
[2026-02-21T16:07:51.078Z]
[2026-02-21T16:07:51.079Z] Describing [nanoserver-ltsc2019-jdk17] image can be built
[2026-02-21T16:09:26.544Z] [+] builds image 95.42s (95.4s|12ms)
[2026-02-21T16:09:26.544Z]
[2026-02-21T16:09:26.544Z] Describing [nanoserver-ltsc2019-jdk17] image can be built with custom build args
[2026-02-21T16:09:51.886Z] [+] uses build args correctly 25.28s (25.27s|13ms)
[2026-02-21T16:09:53.015Z] Tests completed in 177.6s
[2026-02-21T16:09:53.016Z] Tests Passed: 11, Failed: 0, Skipped: 0, Inconclusive: 0, NotRun: 0
[2026-02-21T16:09:58.707Z] powershell.exe : Get-CimInstance : Access denied
[2026-02-21T16:09:58.707Z] At Z:\agent\workspace\ackaging_docker-ssh-agent_PR-611@tmp\durable-f6c57dcc\powershellWrapper.ps1:3 char:1
[2026-02-21T16:09:58.707Z] + & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Comm ...
[2026-02-21T16:09:58.707Z] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[2026-02-21T16:09:58.707Z] + CategoryInfo : NotSpecified: (Get-CimInstance : Access denied :String) [], RemoteException
[2026-02-21T16:09:58.707Z] + FullyQualifiedErrorId : NativeCommandError
[2026-02-21T16:09:58.707Z]
[2026-02-21T16:09:58.707Z] At Z:\Users\jenkins\Documents\WindowsPowerShell\Modules\Pester\5.7.1\Pester.psm1:18443 char:33
[2026-02-21T16:09:58.707Z] + ... ormation = (& $SafeCommands['Get-CimInstance'] Win32_OperatingSystem) ...
[2026-02-21T16:09:58.707Z] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[2026-02-21T16:09:58.707Z] + CategoryInfo : PermissionDenied: (root\cimv2:Win32_OperatingSystem:String) [Get-CimInstance], CimExcept
[2026-02-21T16:09:58.707Z] ion
[2026-02-21T16:09:58.707Z] + FullyQualifiedErrorId : HRESULT 0x80041003,Microsoft.Management.Infrastructure.CimCmdlets.GetCimInstanceCommand
[2026-02-21T16:09:58.708Z]
[2026-02-21T16:09:58.828Z] There were 11 passed tests in jenkins/ssh-agent:nanoserver-ltsc2019-jdk17
Expected Behavior
No error message about Get-CimInstace is shown in Pester output.
Steps To Reproduce
Execute tests from a user not Administrator.
Describe your environment
Pester version: 5.7.1
PowerShell version: 5
OS name: "windows server 2025", version: "10.0", arch: "amd64"
Possible Solution?
Hide those error logs or don't try to execute Get-CimInstance if not running as Administrator.
Note
Opening this issue for awareness, no urgency our tests are still working as intended.
Related:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels