Skip to content

Replace wmic - #4405

Draft
osteffenrh wants to merge 14 commits into
avocado-framework:masterfrom
osteffenrh:replace-wmic
Draft

osteffenrh wants to merge 14 commits into
avocado-framework:masterfrom
osteffenrh:replace-wmic

Conversation

@osteffenrh

Copy link
Copy Markdown

No description provided.

@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…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
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.

1 participant