3

インストールから windows-update サービスを無効にする必要があります。私はすでに vbscript を使用していくつかのことを行っているので、vbscript で実行したいと考えています。

vbscript (またはその他のスクリプト言語) に関する私の知識は非常に限られているため、誰か助けてもらえますか? 本当に感謝します!

ありがとう。

4

3 に答える 3

6

トマラクとパトリック・カフに感謝します。本当にありがとうございました。これは良い完全な答えになると思います。

方法 1: マシンの起動時に「自動更新」サービスが自動的に開始されないようにします。

strComputer = "."  'could be any computer, not just the local one '
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colServiceList = objWMIService.ExecQuery _
("Select * from Win32_Service where Name = 'wuauserv'")

For Each objService in colServiceList
  objService.ChangeStartMode("Disabled")
Next

方法 2: [自動更新] 構成を [自動] から [自動更新を無効にする] に変更します。(MSDN には、他の NotificationLevel 定数が一覧表示されています)

Const AU_DISABLED = 1

Set objAutoUpdate = CreateObject("Microsoft.Update.AutoUpdate")
Set objSettings = objAutoUpdate.Settings

objSettings.NotificationLevel = AU_DISABLED
objSettings.Save

どちらの場合も、自動更新は行われません。方法 1 では開始されませんが、方法 2 ではサービスがまだ実行されており、何もしていません。

GUI を使用して、これらの両方を行うことができます。

  • 方法 1: 管理ツール\サービス\自動更新で、[スタートアップの種類] を [自動] から [無効] に変更します。
  • 方法 2: コントロール パネル\自動更新で、[自動更新を無効にする] を選択します。
于 2008-11-18T15:25:04.900 に答える
2

Tomalakありがとう。

私はまたそれを見つけました:

Const SCHEDULED_INSTALLATION = 1

Set objAutoUpdate = CreateObject("Microsoft.Update.AutoUpdate")
Set objSettings = objAutoUpdate.Settings

objSettings.NotificationLevel = SCHEDULED_INSTALLATION
objSettings.Save

これはリンクです:http://www.microsoft.com/technet/scriptcenter/resources/tales/sg0705.mspx

于 2008-11-17T13:53:14.103 に答える
1

VBScriptを使用する場合は、WMIを使用します。

strComputer = "."  'could be any computer, not just the local one '
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colServiceList = objWMIService.ExecQuery _
("Select * from Win32_Service where Name = 'wuauserv'")

For Each objService in colServiceList
  objService.ChangeStartMode("Disabled")
Next

WMI Win32_Serviceクラスのドキュメントを調べて、他に何ができるかを確認してください。

より簡単なのは:の使用sc.exeです

sc config wuauserv start = auto

これができることの抜粋sc.exeです:

C:\>sc config
Modifies a service entry in the registry and Service Database.
SYNTAX:
sc <server> config [service name] <option1> <option2>...
CONFIG OPTIONS:
NOTE: The option name includes the equal sign.
 type= <own|share|interact|kernel|filesys|rec|adapt>
 start= <boot|system|auto|demand|disabled>
 error= <normal|severe|critical|ignore>
 binPath= <BinaryPathName>
 group= <LoadOrderGroup>
 tag= <yes|no>
 depend= <Dependencies(separated by / (forward slash))>
 obj= <AccountName|ObjectName>
 DisplayName= <display name>
 password= <password>
于 2008-11-17T13:48:23.830 に答える