-
Notifications
You must be signed in to change notification settings - Fork 73
Due to wmic has been deprecated. Replace wmic command in attach process with powershell command. #858
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
due to wmic has been deprecated create this file to replace wmicProcessParser.ts Successfully attach and debug python debugger todo: use pipe to instead powershell file perf data test cases
json format with camelCase Add Get-WmiObject For the legacy compatibility
If PowerShell is unavailable on Windows, the process provider now falls back to using WMIC for process listing. This improves compatibility with older Windows systems where PowerShell may not be present.
The unit tests need to specify list command because we have two commands on Windows now. The AttachProcessProvider now accepts an optional ProcessListCommand parameter in getAttachItems and _getInternalProcessEntries, allowing callers to specify the process listing command. Updated unit tests to use the new parameter for more precise control over process command selection.
Added a unit test to verify that Python processes are listed at the top when using the PowerShell process parser in getAttachItems. This ensures consistent process ordering across both WMIC and PowerShell implementations.
add single powershell unit test add windows powershell call when powershell has been installed add windows wmic call when powershell hasn't been installed
@microsoft-github-policy-service agree |
Remove console.log for processCmd to clean up output.
|
Is it really worth adding the fallback to the old WMI cmdlet? |
Thank you for raising this! You're absolutely right from a technical standpoint – Get-CimInstance has been around since PowerShell v3 and is indeed ubiquitous. I added the fallback logic through Get-WmiObject and even down to WMIC, mostly out of a "just-in-case" mindset, trying to maximize compatibility as a community dev for anyone who might run this in a locked-down or legacy environment. That said, I'm not attached to the extra fallbacks. Think of this PR as a conversation starter. I'm totally fine with any of these approaches:
If Microsoft prefers to simplify the code and drop the legacy support, I'm 100% on board. Just let me know what you'd like, and I'll update the PR accordingly. I'll happily strip it out. |
Hi,
According to issue #744, WMIC is deprecated as of Windows 10 version 21H1 and the 21H1 semi-annual channel release of Windows Server. This utility is superseded by Windows PowerShell for WMI.
Changes:
Additional changes:
Best Regards
Charles