diff --git a/windows/guest_customization/win_gosc_verify.yml b/windows/guest_customization/win_gosc_verify.yml index 97eb14947..fbc233b17 100644 --- a/windows/guest_customization/win_gosc_verify.yml +++ b/windows/guest_customization/win_gosc_verify.yml @@ -27,3 +27,18 @@ include_tasks: check_runonce_command.yml - name: "Check timezone configured" include_tasks: check_timezone.yml + - name: "Get 'explorer.exe' process status" + include_tasks: ../utils/win_get_explorer_process.yml + - name: "Check 'explorer.exe' process status" + ansible.builtin.assert: + that: + - win_explorer_running + fail_msg: > + Failed to get process 'explorer.exe' in guest OS after GOSC, black screen issue may happen, + please check the screenshot or log files in the current test case log folder. + +- name: "Take a screenshot after GOSC" + include_tasks: ../../common/vm_take_screenshot.yml + vars: + vm_screenshot_local_dir: "{{ current_test_log_folder }}" + vm_screenshot_local_name: "screenshot_after_gosc.png" diff --git a/windows/utils/win_get_explorer_process.yml b/windows/utils/win_get_explorer_process.yml new file mode 100644 index 000000000..01ff5d2fc --- /dev/null +++ b/windows/utils/win_get_explorer_process.yml @@ -0,0 +1,26 @@ +# Copyright 2025 VMware, Inc. +# SPDX-License-Identifier: BSD-2-Clause +--- +# Description: +# Get process 'explorer.exe' in Windows guest OS to check +# if there is black screen issue occurs. +# Return: +# win_explorer_running: true or false. Whether the process +# 'explorer.exe' is running in guest OS. +# +- name: "Initialize the status of process 'explorer.exe'" + ansible.builtin.set_fact: + win_explorer_running: false + +- name: "Get the status of process 'explorer.exe'" + include_tasks: win_execute_cmd.yml + vars: + win_powershell_cmd: "Get-Process -Name explorer" + win_execute_cmd_ignore_error: true + +- name: "Set fact of the status of process 'explorer.exe'" + ansible.builtin.set_fact: + win_explorer_running: true + when: + - win_powershell_cmd_output.rc is defined + - win_powershell_cmd_output.rc == 0