Hello I’ve tried to find out whether secure boot is enabled here is the code of what I tried:
def is_secure_boot_enabled():
try:
# PowerShell command to check Secure Boot status
ps_command = 'Confirm-SecureBootUEFI'
# Execute the PowerShell command
result = subprocess.run(['powershell', '-Command', ps_command], capture_output=True, text=True)
# Process the result
if "True" in result.stdout:
return True
elif "False" in result.stdout:
return False
else:
print(f"Unexpected output: {result.stdout}")
return None
except Exception as e:
print(f"Error: {e}")
return None
This requires Admin / Elevated Permissions to run, so I was unable to run this command
I’ve also tried another script:
https://www.hindicodingcommunity.com/2023/02/how-to-check-whether-secure-boot-is.html
which also had an issue :
Error: (-2147217392, ‘OLE error 0x80041010’, None, None)
None
Let me know if theres another way to find out.