人気ブログランキング | 話題のタグを見る
VBSでOS判定
' OSの判定
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
For Each objOperatingSystem In colOperatingSystems
intOSType = objOperatingSystem.OSType
strOSVer = Left(objOperatingSystem.Version, 3)
intProductType = objOperatingSystem.ProductType
'strOSArchitecture = objOperatingSystem.OSArchitecture
Next
Select Case intOSType
Case 16 'Windows 95
OS = "Windows 95"
Case 17 'Windows 98
OS = "Windows 98"
Case 18 'WINNT
Select Case strOSVer
Case 4.0
OS = "Windows NT 4.0"
Case 5.0
OS = "Windows 2000"
Case 5.1
OS = "Windows XP"
Case 5.2
OS = "Windows Server 2003"
Case 6.0
If intProductType = 1 Then
OS = "Windows Vista"
Else
OS = "Windows Server 2008"
End If
Case 6.1
If intProductType = 1 Then
OS = "Windows 7"
Else
OS = "Windows Server 2008 R2"
End If
Case Else
OS = strOSVer & " (unidentified)"
End Select
Case Else
OS = strOSVer & " (unidentified)"
End Select

' アーキテクチャの判定
Set shell = CreateObject("WScript.Shell")
strOSArchitecture = shell.ExpandEnvironmentStrings("%PROCESSOR_ARCHITECTURE%")

' インストーラの選択
If OS = "Windows XP" Or OS = "Windows Server 2003" Then
If strOSArchitecture = "x86" Then

ElseIf strOSArchitecture = "x64" Then

Else
MsgBox "サポートされていないアーキテクチャです:" & strOSArchitecture
End If
ElseIf OS = "Windows Vista" Or OS = "Windows Server 2008" Or OS = "Windows Server 2008 R2" Then
If strOSArchitecture = "x86" Then

ElseIf strOSArchitecture = "x64" Then

Else
MsgBox "サポートされていないアーキテクチャです:" & strOSArchitecture
End If
Else
MsgBox "サポートされていないOSです:" & OS
End If

ソニーストア

by isoq | 2009-07-02 14:13
<< 腰痛で変な歩き方に... デル情報:Studio XPS... >>