Skip to content

Supporting WMIC and PowerShell#3285

Open
Tibor17 wants to merge 1 commit intomasterfrom
windows-wmic
Open

Supporting WMIC and PowerShell#3285
Tibor17 wants to merge 1 commit intomasterfrom
windows-wmic

Conversation

@Tibor17
Copy link
Contributor

@Tibor17 Tibor17 commented Feb 25, 2026

@michael-o
@olamy
@slawekjaranowski
The fix should be like this instead of making tons of unnecessary changes with Java 9. Microsoft removed WMIC command in Windows 11 and added PowerShell, so this is what we support as well.
If we are participating on this discussion in the mailing list and we are still not finished clarifying the things, we cannot push make a proactive commit since it is very childish and then it will be finished by the revert as before.

@olamy
Copy link
Member

olamy commented Feb 26, 2026

I have a few questions and concerns about this change.
Given that Maven 4 is expected to require Java 17, I’m wondering whether it makes sense to add additional complexity for functionality that may have a limited life and limited usage.
The change addresses a narrow use case (Java 8 on Windows without PowerShell, users on Java 9+ or Linux are fully covered), so the question of whether the extra complexity/code is justified relative to the expected benefit.
Furthermore, enableProcessChecker is disabled by default, so it may not be widely used. Since Surefire already handles forked JVM cleanup, ProcessChecker seems to function mainly as an additional not much used safety net.
From this perspective, I'm -0 for the change.

return reader.execute(psPath + "powershell", "-NoProfile", "-NonInteractive", "-Command", psCommand);
ProcessInfo checkPpid() {
if (hasWmicStandardSystemPath64()) {
return execute("CMD", "/A", "/X", "/C",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can execute wmic directly, no need to use the cmd cruft.

+ "wmic process where (ProcessId=" + ppid + ") get " + WMIC_CREATION_DATE);
} else {
isPowershell = true;
return execute("CMD", "/A", "/X", "/C",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here.

@michael-o
Copy link
Member

@Tibor17 Can you rebase please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants