Add opt-in virtual machine driver package support - #1
Conversation
Co-authored-by: vartaxe <11176349+vartaxe@users.noreply.github.com>
Co-authored-by: vartaxe <11176349+vartaxe@users.noreply.github.com>
Co-authored-by: vartaxe <11176349+vartaxe@users.noreply.github.com>
Co-authored-by: vartaxe <11176349+vartaxe@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
There are correctness and clarity issues in the VM support implementation (notably detection/matching inconsistencies and misleading debug logging) that should be resolved before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds opt-in virtual-machine (VM) support to ModernDriverManagement while preserving the existing default behavior of refusing to run on VMs unless explicitly allowed, and documents scope boundaries around catalog acquisition/package creation.
Changes:
- Added
-AllowVirtualMachineswitch across deployment modes and implemented VM detection + logging. - Enforced VM-safe package selection by filtering to packages explicitly labeled for virtual hardware (including fallback matching).
- Expanded README scope documentation to clarify content-management responsibilities and VM behavior.
File summaries
| File | Description |
|---|---|
| README.md | Documents scope boundaries and clarifies opt-in VM behavior and DebugMode limitations. |
| Invoke-CMApplyDriverPackage.ps1 | Adds -AllowVirtualMachine, VM detection state, and VM-only package filtering rules for primary and fallback package selection. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| - Switched exact comparisons (OS name, architecture, OS version, computer model) from -like to -eq to avoid wildcard misinterpretation of values containing bracket characters | ||
| 4.2.8 - (2026-08-05) - Documented the Get-ComputerData default branch with a placeholder/template describing how to add support for custom/unlisted manufacturers (WMI/CIM property sources, the Manufacturer-match requirement in Confirm-DriverPackage, and the -Manufacturer debug ValidateSet). | ||
| - Logging improvements for troubleshooting: Invoke-Executable launch failures are now written to the log file (Severity 3) instead of only Write-Warning, and return -1 rather than silently continuing; Get-ComputerData wraps manufacturer detection in try/catch that logs the manufacturer context on failure and degrades gracefully; the unlisted-manufacturer default branch now logs a warning; and a script version + key parameter banner is written at startup. | ||
| 4.2.9 - (2026-08-31) - Added opt-in virtual-machine support with explicit virtual-package matching. DebugMode remains detection-only. |
| $Script:VirtualMachineModels = @("Virtual Machine", "VMware Virtual Platform", "VirtualBox", "HVM domU", "KVM", "VMware7,1") | ||
| $Script:VirtualMachinePackagePattern = "\b(virtual machine|vmware|vmxnet|pvscsi|hyper[- ]?v|parallels|virtualbox|virtio|kvm|xen)\b" |
| if ($AllowVirtualMachine) { | ||
| Write-CMLogEntry -Value " - Virtual machine platform detected: '$($ComputerSystemType)'. Execution explicitly allowed by -AllowVirtualMachine; only virtual-machine driver packages will be eligible" -Severity 2 | ||
| } | ||
| elseif ($Script:PSCmdlet.ParameterSetName -like "Debug") { | ||
| Write-CMLogEntry -Value " - Virtual machine platform detected: '$($ComputerSystemType)'. DebugMode permits detection only; package download and installation remain disabled" -Severity 2 | ||
| } |
|
@copilot Fix the code for all comments in this review thread. When a review comment includes a suggested change, apply the suggestion exactly. Do not make changes beyond what is described in the linked review thread. |
ModernDriverManagement previously rejected virtual machines outside
DebugMode, preventing normal package download and application. The change adds safe, explicit VM support while preserving existing physical-device defaults and keeping catalog acquisition/package creation outside this repository.VM execution
-AllowVirtualMachinefor BareMetal, OSUpgrade, DriverUpdate, PreCache, XMLPackage, and Debug modes.DebugModedetection-only.Safe package matching
Scope documentation