Replace wmic - #4405
Draft
osteffenrh wants to merge 14 commits into
Draft
Replace wmic#4405osteffenrh wants to merge 14 commits into
osteffenrh wants to merge 14 commits into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…all XMLs WMIC is deprecated and removed from Windows Server 2025+. Replace the wmic datafile call copy command with PowerShell Get-PSDrive/Copy-Item to find and copy finish.bat during Windows unattended installation.
Use Get-CimInstance Win32_DiskDrive with -Filter to query disk size by index directly, replacing the wmic diskdrive table output and regex parsing.
Use Get-CimInstance Win32_LogicalDisk to query free disk space, replacing the deprecated wmic logicaldisk command.
Use Get-CimInstance Win32_OperatingSystem to query free physical memory, replacing the deprecated wmic OS command.
This is the function that broke Win2025 testing — wmic is not available on Windows Server 2025. Use Get-CimInstance Win32_LogicalDisk to resolve the WIN_UTILS drive letter.
Replace the wmic nicconfig call enablestatic method invocation with Get-CimInstance piped to Invoke-CimMethod -MethodName EnableStatic.
Use Get-CimInstance Win32_NetworkAdapterConfiguration with Format-List output, replacing the wmic nicconfig table format and its complex regex parsing.
Use Get-CimInstance with Select-Object -ExpandProperty to query NIC attributes. Note: PowerShell ExpandProperty has no header row, so return lines[0] instead of lines[1].
Replace the WMIC command builder with PowerShell equivalents while preserving the public API (make_query, parse_list, is_noinstance, FMT_TYPE_LIST). Callers like drive.py, system.py, and tp-qemu test files that use wmic.make_query()/parse_list() get PowerShell support with zero code changes. Key changes: - make_query() now builds powershell -command Get-CimInstance commands - parse_list() now parses Format-List output (Key : Value) format - is_noinstance() checks for empty output instead of WMIC error string - Added _WMIC_ALIAS_MAP for alias-to-class resolution
osteffenrh
force-pushed
the
replace-wmic
branch
from
August 31, 2026 05:41
7bba18d to
a5e349b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.