background img

The New Stuff

Autoit: Изменение режимов запуска служб Windows

Пример работы связки Autoit + WMI



$strComputer = "."
$strChangeMode = "Disabled" ; режимы запуска: "Manual", "Automatic", "Disabled"

$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") 
$objShare = $objWMIService.Get("Win32_Service.Name='Ati HotKey Poller'")
$objInParam = $objShare.Methods_("ChangeStartMode").inParameters.SpawnInstance_()
$objInParam.Properties_.Item("StartMode") =  $strChangeMode
$objOutParams = $objWMIService.ExecMethod("Win32_Service.Name='Ati HotKey Poller'", "ChangeStartMode", $objInParam)

ConsoleWrite( "ReturnValue: " & $objOutParams.ReturnValue & @CR)

Источник: http://autoit-script.ru/index.php?topic=5525.0
Пример работы связки Autoit + WMI



$strComputer = "."
$strChangeMode = "Disabled" ; режимы запуска: "Manual", "Automatic", "Disabled"

$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") 
$objShare = $objWMIService.Get("Win32_Service.Name='Ati HotKey Poller'")
$objInParam = $objShare.Methods_("ChangeStartMode").inParameters.SpawnInstance_()
$objInParam.Properties_.Item("StartMode") =  $strChangeMode
$objOutParams = $objWMIService.ExecMethod("Win32_Service.Name='Ati HotKey Poller'", "ChangeStartMode", $objInParam)

ConsoleWrite( "ReturnValue: " & $objOutParams.ReturnValue & @CR)

Источник: http://autoit-script.ru/index.php?topic=5525.0

0 коммент.:

Отправить комментарий

Popular Posts