#navi(../)
* Win32_BIOSのサンプルスクリプト [#c30924a5]
WMIを使ったWin32_BIOSでBIOSに関する情報を表示するサンプルスクリプトを以下に記します。

#contents
#htmlinsertpcsp(win-top.html,win-sp.html)

* 関連記事 [#s2259ef4]
-[[PowerShellでWMIを使用するサンプル>PowerShell/PowerShellでWMIを使用するサンプル]]
-[[Win32_ComputerSystemのサンプルスクリプト>WSH/Win32_ComputerSystemのサンプルスクリプト]]
-[[Win32_ComputerSystemProductのサンプルスクリプト>WSH/Win32_ComputerSystemProductのサンプルスクリプト]]
-[[Win32_OperatingSystemのサンプルスクリプト>WSH/Win32_OperatingSystemのサンプルスクリプト]]
-[[Win32_BIOSのサンプルスクリプト>WSH/Win32_BIOSのサンプルスクリプト]]
-[[Win32_LogicalDiskのサンプルスクリプト>WSH/Win32_LogicalDiskのサンプルスクリプト]]
-[[Win32_Processorのサンプルスクリプト>WSH/Win32_Processorのサンプルスクリプト]]
-[[Win32_NetworkAdapterConfigurationのサンプルスクリプト>WSH/Win32_NetworkAdapterConfigurationのサンプルスクリプト]]
-[[Win32_DiskDriveのサンプルスクリプト>WSH/Win32_DiskDriveのサンプルスクリプト]]

* Win32_BIOSを使ったサンプルスクリプト [#e964d2b3]
#ref(bios.vbs)
以下にWin32_BIOSを使用したサンプルスクリプトを記します。~
本サンプルスクリプトでは、以下の値を表示しています。
-BIOS Version
-BIOS Major Version
-BIOS Minor Version
-製造
-キャプション
-バージョン
-シリアル番号

** サンプルスクリプト [#h62a1185]
#ref(bios.vbs)
 hostname="."	' dotは自機を示す
 ' uid = "username"
 ' pwd = "password"
 Set oLocater = CreateObject("WbemScripting.SWbemLocator")
 Set oService = oLocater.ConnectServer(hostname, "root/cimv2")
 ' Set oService = oLocater.ConnectServer(hostname, "root/cimv2", uid, pwd)	'ユーザ、パスワード設定をする場合
 oService.Security_.ImpersonationLevel = 3	' デフォルト値は3のため省略可能
 
 Set items = oService.ExecQuery("Select * From Win32_BIOS", , 48)
 
 For Each item In items
   WScript.Echo("BIOS Version: " & item.SMBIOSBIOSVersion)
   WScript.Echo("BIOS Major Version: " & item.SMBIOSMajorVersion)
   WScript.Echo("BIOS Minor Version: " & item.SMBIOSMinorVersion)
   WScript.Echo("製造: " & item.Manufacturer)
   WScript.Echo("キャプション: " & item.Caption)
   WScript.Echo("バージョン: " & item.Version)
   WScript.Echo("シリアル番号: " & item.SerialNumber)
 Next
 
 Set item = Nothing
 Set oService = Nothing
 Set oLocater = Nothing

** 実行例 [#ce5f3f07]
cscriptを使用して実行した時の出力です。

 C:\Users\sakura\Desktop>cscript bios.vbs
 Microsoft (R) Windows Script Host Version 5.8
 Copyright (C) Microsoft Corporation. All rights reserved.
 
 BIOS Version: H0ET94WW (2.54 )
 BIOS Major Version: 2
 BIOS Minor Version: 7
 製造: LENOVO
 キャプション: H0ET94WW (2.54 )
 バージョン: LENOVO - 2540
 シリアル番号: MPXXXXX

以上、Win32_BIOSを使ったサンプルスクリプトでした。

#htmlinsertpcsp(win-btm.html,win-sp.html)

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS