1

Java NextGen プラグインを変更する方法が必要です。OSが正しいパスに移動するように、事前にOSを確認する必要があります。OSをチェックするスクリプトがあり、それをチェックして再チェックしましたが、動作します

On Error Resume Next

Const HKEY_LOCAL_MACHINE = &H80000002

set objShell = wscript.createobject("wscript.shell")

strComputer = InputBox("Enter PC name:", "JavaNextGen Disable")
strVersion = InputBox("Enter Java Version:", "JavaNextGen Disable")
If ((strComputer <> "") And (strVersion <> "")) Then
 Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
 Set colOperatingSystems = objWMIService.ExecQuery _
  ("Select * from Win32_OperatingSystem")
 For Each objOperatingSystem in colOperatingSystems
  If objOperatingSystem.Caption = "Microsoft Windows 7 Enterprise" Then
   wscript.echo strComputer & "Is Windows 7"
  Elseif  objOperatingSystem.Caption = "Microsoft Windows XP Professional" Then
   wscript.echo strComputer & "Is Windows XP"
  End If

ここに、レジストリ設定を変更するために使用するコードがあります

   Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
   strKeyPath = "SOFTWARE\Wow6432Node\JavaSoft\Java Plug-in\1.6.0_" & strVersion
   strEntryName = "UseNewJavaPlugin"
   dwValue = 0
   objReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strEntryName, dwValue
wscript.echo strKeyPath
   If Not Err.Number = 0 Then 
    wscript.Echo "Error: "& vbCrLf & strComputer & "Please check to make sure the computer is on the network!  And that you have admin rights on the computer!"
   Else
    wscript.echo strComputer & "NextGen has been turned off."
   End If

今並べてみるとこんな感じ

On Error Resume Next
Const HKEY_LOCAL_MACHINE = &H80000002

set objShell = wscript.createobject("wscript.shell")

strComputer = InputBox("Enter PC name:", "JavaNextGen Disable")
strVersion = InputBox("Enter Java Version:", "JavaNextGen Disable")
If ((strComputer <> "") And (strVersion <> "")) Then
 Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
 Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
 Set colOperatingSystems = objWMIService.ExecQuery _
  ("Select * from Win32_OperatingSystem")
 For Each objOperatingSystem in colOperatingSystems
  If objOperatingSystem.Caption = "Microsoft Windows 7 Enterprise" Then
   strKeyPath = "SOFTWARE\Wow6432Node\JavaSoft\Java Plug-in\1.6.0_" & strVersion
   strEntryName = "UseNewJavaPlugin"
   dwValue = 0
   objReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strEntryName, dwValue

   If Not Err.Number = 0 Then 
    wscript.Echo "Error: "& vbCrLf & strComputer & "Please check to make sure the computer is on the network!  And that you have admin rights on the computer!"
   Else
    wscript.echo strComputer & "NextGen has been turned off."
   End If
  Elseif  objOperatingSystem.Caption = "Microsoft Windows XP Professional" Then
   Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
    strComputer & "\root\default:StdRegProv")
   strKeyPath = "SOFTWARE\JavaSoft\Java Plug-in\1.6.0_" & strVersion
   strEntryName = "UseNewJavaPlugin"
   dwValue = 0
   objReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strEntryName, dwValue

   If Not Err.Number = 0 Then 
    wscript.Echo "Error: "& vbCrLf & strComputer & "Please check to make sure the computer is on the network!  And that you have admin rights on the computer!"
   Else
    wscript.echo strComputer & "NextGen has been turned off."
   End If
  End If
 Next
End If

ただし、この行の後は何もしません。その直後にエコーを追加したため、画面に何も表示されません。objOperatingSystem.Caption = "Microsoft Windows 7 Enterprise" の場合

4

0 に答える 0