Page 1 of 1
[SOLVED] Retrieving hardware inventory parameters
Published: September 20, 2023 - 10:32 AM
by tux
Hello,
how can I retrieve the value of the `wuauserv_status/reboot_needed` parameter (hardware inventory) in a Python script?
I'm using the latest Enterprise version.
Thank you.
Re: Retrieving hardware inventory parameters
Published: September 21, 2023 - 12:26 PM
by dcardon
Hello Sébastien,
WAPT OS version, etc. (see forum rules).
Is the requirement server-side or client-side within a WAPT package?
Regards,
Denis
Re: Retrieving hardware inventory parameters
Published: September 22, 2023 - 1:28 PM
by tux
Hello,
Indeed, my request is not clear enough and does not comply with the rules.
WAPT Enterprise version 2.4.
The need is on the Windows client side.
In a package deployed on a Windows workstation, I am trying to retrieve, in the Python script (setup.py), the value of the parameter wuauserv_status/reboot_needed (displayed in the console in the workstation's hardware inventory).
I have not found anything in the "WAPT Setuphelpers Usage" documentation for this use case.
Regards
Re: Retrieving hardware inventory parameters
Published: September 22, 2023 - 2:27 PM
by sfonteneau
Good morning
Code: Select all
from waptwua.utils import waiting_for_reboot
print(waiting_for_reboot())
The code below:
Code: Select all
def waiting_for_reboot():
"""Return True if system is waiting for reboot to finish an install/update process
"""
# Query WUAU from the registry
if reg_key_exists(HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired") or \
reg_key_exists(HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending") or \
reg_key_exists(HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\Updates\UpdateExeVolatile'):
return True
return False
Re: Retrieving hardware inventory parameters
Published: September 27, 2023 - 5:32 PM
by tux
Thank you, that's exactly what I was looking for.