Reputation: 11
I've tried working off this post link below and looked up the documentation for WMI module, but the class structure seems different now from the solns posted online (see point 1).
All I want is to find the subclass that contains Secureboot (key/value) and check the state via python.
Please don't close my question off as I have explored answers online, they are out of date/incorrect:
This link following, gives an incorrect subclass to query the variable (i.e. "FROM Win32_BIOS"). How to check whether secure boot is enabled using python in windows os
Going via the documentation on Querying, you can interrogate the WMI calls only if you know what the subclass is to start with (therein lies the problem). https://timgolden.me.uk/python/wmi/tutorial.html#querying
I've used above approach to see what bios WMI classes might be available, and checking some manually hasn't given me the result. i.e. following lists 10 subclasses...
#### Initialize WMI client
c = wmi.WMI()
for subclass in c.classes:
if "bios" in subclass.lower():
print(subclass)
Found you can view a subclass contents like this:
#### Simple example to print out one class detail
for os in c.Win32_OperatingSystem():
print(os)
Tried to scope how many subclasses in WMI, and my count yields 1320 !!
count=0
for item in c.classes:
count = count + 1
print("Final count: ", count)
## Final count: 1320
Unfortuately my attempts to find the detail have been thwarted as subclasses may be nested classes with key/values, or not iterable, or too confusing and time consuming for me...
Short of printing every subclass to a file and doing a text search offline, how would I find where "Secureboot" resides (now) ?
Upvotes: 0
Views: 31