Skip to content

Commit

Permalink
win_guest_debugging_tool: Support new feature
Browse files Browse the repository at this point in the history
win_guest_debugging_tool is a new feature for windows guest to
gather a wide range of information. including system configuration
 event logs, drivers, registry settings, update logs, services,
uptime, processes, installed applications,network configuration
 installed KBs (knowledge base articleand optionally, memory dumps
It's a powershell script is designed for comprehensive system
diagnostics.

Signed-off-by: Dehan Meng <[email protected]>
  • Loading branch information
6-dehan committed Dec 25, 2024
1 parent d516da1 commit 388a56a
Show file tree
Hide file tree
Showing 2 changed files with 728 additions and 0 deletions.
87 changes: 87 additions & 0 deletions qemu/tests/cfg/win_guest_debugging_tool.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
- win_guest_debugging_tool: install setup image_copy unattended_install.cdrom
only Windows
type = win_guest_debugging_tool
tmp_dir = %TEMP%
runtimeout = 360
shutdown_command = "shutdown -s -t 0"
reboot_command = "shutdown -r -t 0"
cmd_unrestrict_policy = 'powershell.exe Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process -Force'
test_tmp_dir = "%TEMP%\testtmpdir"
cmd_create_dir = "mkdir %s >nul 2>&1"
cmd_remove_dir = "rmdir /S /Q %s"
cdroms += " virtio"
cdrom_virtio = isos/windows/virtio-win.iso
cmd_findstr_in_file = type %s | findstr "%s"
include_sensitive_data = False
variants:```
- check_script_execution:
windegtool_check_type = script_execution
- check_zip_package:
windegtool_check_type = zip_package
cmd_extract_zip = 'powershell.exe Expand-Archive -Path "%s" -DestinationPath %s -Force'
cmd_check_folder_size = powershell -c "$folderPath='%s'; $folderSize=(Get-ChildItem -Path $folderPath -Recurse | Measure-Object -Property Length -Sum).Sum; Write-Output $folderSize"
- check_run_tools_multi_times:
windegtool_check_type = run_tools_multi_times
- check_user_friendliness:
windegtool_check_type = user_friendliness
cmd_kill_powershell_process = taskkill /IM powershell.exe /F; powershell.exe -Command "Stop-Process -Name msinfo32 -Force"
invalid_params = "-invalidparam,IncludeSensitiveData,0000,hell,-H,-IncludeSensitiveData -h"
expect_output_prompt = "Usage: .\CollectSystemInfo.ps1 [-IncludeSensitiveData] [-Help]"
script_interrupt_signal_file = 'Collecting_Status.txt'
cmd_dir_del = powershell.exe -Command "Remove-Item -Path '%s' -Recurse -Force -ErrorAction SilentlyContinue"
cmd_query_path = powershell.exe "$lastDir = dir | Select-String 'System*' | Select-Object -Last 1; write-output $lastDir"
- check_disk_registry_collection:
windegtool_check_type = disk_registry_collection
virtio_disk_filepath = "%s\virtio_disk.txt"
new_reg_item = "HKLM:\SYSTEM\CurrentControlSet\Services\viostor\Parameters"
exist_reg_item = "HKLM:\SYSTEM\CurrentControlSet\Services\Disk"
cmd_reg_query = powershell.exe -Command "(Get-ItemProperty -Path %s).%s"
cmd_reg_add_item = powershell.exe "if (-not (Test-Path -Path '%s')) {New-Item -Path %s | Out-Null}"
cmd_reg_add_item_key = powershell.exe "if (-not (Test-Path -Path '%s')) {New-Item -Path %s -Name %s -ItemType Key | Out-Null}"
cmd_reg_set_value = powershell.exe -Command "Set-ItemProperty -Path '%s' -Name '%s' -Value %d"
cmd_reg_del = powershell.exe -Command "Remove-Item -Path '%s' -Recurse -Force -ErrorAction SilentlyContinue"
reg_subkey1 = IoTimeoutValue
reg_subkey2 = TimeoutValue
key_value1 = 100
key_value2 = 150
- check_includeSensitiveData_collection:
windegtool_check_type = includeSensitiveData_collection
include_sensitive_data = True
timeout = 360
reboot_method = system_reset
memory_dmp_file = "%SystemRoot%\Memory.dmp"
mini_dmp_folder = "%SystemRoot%\Minidump"
crash_method = nmi
cmd_check_files = powershell.exe ls %s
- check_trigger_driver_msinfo_collection:
windegtool_check_type = trigger_driver_msinfo_collection
image_snapshot = yes
transfer_timeout = 720
msinfo_file_path = "%s\msinfo32.txt"
drv_list_file_path = "%s\drv_list.csv"
target_driver = pvpanic
cmd_query_oem_inf = powershell.exe -Command "pnputil.exe /enum-drivers | Select-String -Pattern '%s.inf' -Context 1,1 | ForEach-Object { if ($_ -match 'Published Name:\s+(oem\d+\.inf)') { $matches[1] } }"
cmd_install_driver = pnputil.exe /add-driver "%s.inf" /install
cmd_uninstall_driver = pnputil.exe /delete-driver %s /uninstall /force
cmd_scan_device = pnputil.exe /scan-devices
cmd_backup_driver = Export-WindowsDriver -Online -Destination "C:\DriverBackup"
cmd_check_driver_ver = powershell.exe -Command "Get-WmiObject Win32_PnPSignedDriver | Where-Object DeviceName -eq '%s'"
new_system_name = "NewsystemName"
cmd_change_systemname = powershell.exe -Command "Rename-Computer -NewName %s"
cmd_query_from_file = powershell.exe -Command "Get-Content %s | Select-String '%s'"
cmd_check_systemname = echo %computername%
- check_networkadapter_collection:
windegtool_check_type = networkadapter_collection
check_adapter_name = powershell.exe -Command "Get-NetAdapter | Select-Object -ExpandProperty Name"
check_adapter_jp_info = powershell.exe -Command "Get-NetAdapterAdvancedProperty -Name '%s' | Where-Object { $_.DisplayName -eq 'Jumbo Packet' } | Select-Object -ExpandProperty DisplayValue"
cmd_set_adapter_jp_info = powershell.exe -Command "Set-NetAdapterAdvancedProperty -Name '%s' -DisplayName 'Jumbo Packet' -DisplayValue %d"
cmd_disable_adapter = powershell.exe -Command "Disable-NetAdapter -Name '%s' -Confirm:$false"
cmd_enable_adapter = powershell.exe -Command "Enable-NetAdapter -Name '%s' -Confirm:$false"
networkfile_path = "%s\NetworkInterfaces.txt"
ipconfigfile_path = "%s\IPConfiguration.txt"
static_dns = 8.8.8.8
cmd_get_dns = powershell.exe -Command (Get-DnsClientServerAddress -AddressFamily IPv4).ServerAddresses
cmd_set_dns = netsh interface ipv4 set dns name="%s" static %s
cmd_set_dns_dhcp = netsh interface ipv4 set dns name="%s" dhcp
- check_documentation:
windegtool_check_type = documentation
Loading

0 comments on commit 388a56a

Please sign in to comment.