OK、レジストリ エントリを取得しようとしていますが、機能しません。試行するたびに空の値が取得されます。個々のexeを管理者として実行して、権限を再確認してみました。同じ機能を実行するバッチ ファイルを作成し、正常に動作しました。また、スクリプトの他の部分で同じ方法を使用してレジストリ値を取得しましたが、問題が見つからないようです。プログラムは正常に実行され、0 エラーが表示されます。
ソースコード:
' Check Auto Update settings
Dim AUOptions_Value = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update", "AUOptions", Nothing)
Dim AUOptions_level
If AUOptions_Value = 4 Then
AUOptions_level = "Auto Update Options set to: Install Updates Automatically."
Display_AUOptions.ForeColor = Color.Green
ElseIf AUOptions_Value = 3 Then
AUOptions_level = "Download Updates but let me choose whether to install them."
Display_AUOptions.ForeColor = Color.Blue
ElseIf AUOptions_Value = 2 Then
AUOptions_level = "Check for updates but let me choose whether to download them and install them."
Display_AUOptions.ForeColor = Color.Blue
ElseIf AUOptions_Value = 1 Then
AUOptions_level = "Never check for updates."
Display_AUOptions.ForeColor = Color.Red
Else
AUOptions_level = "Unable to detect settings"
Display_AUOptions.ForeColor = Color.Red
End If
Display_AUOptions.Text = AUOptions_level
End Sub
レジストリ エントリ:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update]
"AUOptions"=dword:00000004