how can i get this powershell info to list all devices
Get-WmiObject Win32_PNPEntity | Select Name, Description, Present, Status, Service
Please refer below procedure to execute PowerShell commands,
Note: Before executing PowerShell command, script will set PowerShell execution policy as “Remotely signed”
import ctypes
import os
class disable_file_system_redirection:
_disable = ctypes.windll.kernel32.Wow64DisableWow64FsRedirection
_revert = ctypes.windll.kernel32.Wow64RevertWow64FsRedirection
def __enter__(self):
self.old_value = ctypes.c_long()
self.success = self._disable(ctypes.byref(self.old_value))
def __exit__(self, type, value, traceback):
if self.success:
self._revert(self.old_value)
policy=r'powershell "Set-ExecutionPolicy RemoteSigned"'
cmd=r'powershell.exe "Get-WmiObject Win32_PNPEntity | Select Name, Description, Present, Status, Service" '
with disable_file_system_redirection():
print os.popen(policy).read()
print os.popen(cmd).read()
yebo.
now this can be used as Hardware Inventry with service name if applicable. and can help understand better.
like patch-managment, 1 day we might have Driver managment, for driver updates.
Thanks @mkannan