【.cmd】 バッチファイルスクリプト %15 【.bat】 (907レス)
前次1-
抽出解除 レス栞

409
(1): 2023/07/24(月) 23:51:25.15 ID:wZUfbAlM(1/2) AAS
WMI(CIM)が楽かな。
powershellでもVBScriptでもwmicでもお好きなもので。

PowerShell版:
$enabledCd = 0
$disabledCd = 22
$methodName = $null
$device = Get-CimInstance -Query 'select * from Win32_PnpEntity where Name = "Fax"'
if ($device.Status -eq 'OK' -and $device.ConfigManagerErrorCode -eq $enabledCd) {
  $methodName = 'Disable'
}
elseif ($device.Status -eq 'Error' -and $device.ConfigManagerErrorCode -eq $disabledCd) {
  $methodName = 'Enable'
}
if (! [string]::IsNullOrEmpty($methodName)) {
  $result = Invoke-CimMethod -InputObject $device -MethodName $methodName
省4
413: 2023/07/26(水) 01:41:27.08 ID:HHyO4+3x(1) AAS
>>406 >>409
ありがとうございます
前次1-
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル

ぬこの手 ぬこTOP 0.034s