Disable a PnP device using the Disable() method of Win32_PNPEntity Class
hi,
i trying detect presence of yellow bang plug , play device in control panel , if present, disable , enable device using powershell scripting. using following command detecting device in erroneous state -
$computer = "localhost"
$namespace = "root\cimv2"
get-wmiobject -class win32_pnpentity -computername $computer -namespace $namespace | where{$_.status -ne "ok" -and ![string]::isnullorempty($_.status) -and $_.deviceid.contains('wxyz')}
can kindly suggest me how use disable() , enable() methods of win32_pnpentity class? have tried using following ways; end corresponding errors
get-wmiobject -class win32_pnpentity -computername $computer -namespace $namespace | where{$_.status -ne "ok" -and ![string]::isnullorempty($_.status) -and $_.deviceid.contains('wxyz')} | disable() - "an expression expected after '('. "
(get-wmiobject -class win32_pnpentity -computername $computer -namespace $namespace | where{$_.status -ne "ok" -and ![string]::isnullorempty($_.status) -and $_.deviceid.contains('wxyz')}).disable() - "method invocation failed because [system.management.managementobject] not contain method named 'disable'. "
what exact syntax using disable() , enable() methods? also, there parameter must passed these methods?
hi braham20,
i, myself had figured out morning. sorry not sharing information on time.
but, appreciate regarding matter.
thanks lot!!
swastik.
Windows Server > Windows PowerShell
Comments
Post a Comment