WSH/Win32_ComputerSystemProductのサンプルスクリプト
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
開始行:
#navi(../)
* Win32_ComputerSystemProductのサンプルスクリプト [#n9316...
WMIを使ったWin32_ComputerSystemProductでマシンに関する情...
#contents
#htmlinsertpcsp(win-top.html,win-sp.html)
* 関連記事 [#rfdd5bef]
-[[PowerShellでWMIを使用するサンプル>PowerShell/PowerShel...
-[[Win32_ComputerSystemのサンプルスクリプト>WSH/Win32_Com...
-[[Win32_ComputerSystemProductのサンプルスクリプト>WSH/Wi...
-[[Win32_OperatingSystemのサンプルスクリプト>WSH/Win32_Op...
-[[Win32_BIOSのサンプルスクリプト>WSH/Win32_BIOSのサンプ...
-[[Win32_LogicalDiskのサンプルスクリプト>WSH/Win32_Logica...
-[[Win32_Processorのサンプルスクリプト>WSH/Win32_Processo...
-[[Win32_NetworkAdapterConfigurationのサンプルスクリプト>...
-[[Win32_DiskDriveのサンプルスクリプト>WSH/Win32_DiskDriv...
* Win32_ComputerSystemProductを使ったサンプルスクリプト [...
#ref(comsyspro.vbs)
以下にWin32_ComputerSystemProductを使用したサンプルスクリ...
本サンプルスクリプトでは、以下の4つの値を表示しています。
-プロダクト名
-プロダクトのバージョン
-製品ID
-ベンダー
** サンプルスクリプト [#idd4d09c]
#ref(comsyspro.vbs)
hostname="." ' dotは自機を示す
' uid = "username"
' pwd = "password"
Set oLocater = CreateObject("WbemScripting.SWbemLocator")
Set oService = oLocater.ConnectServer(hostname, "root/ci...
' Set oService = oLocater.ConnectServer(hostname, "root/...
oService.Security_.ImpersonationLevel = 3 ' デフォルト値...
Set items = oService.ExecQuery("Select * From Win32_Comp...
For Each item In items
WScript.Echo("プロダクト名: " & item.Name)
WScript.Echo("プロダクトのバージョン: " & item.Version)
WScript.Echo("製品ID: " & item.IdentifyingNumber)
WScript.Echo("ベンダー: " & item.Vendor)
Next
Set item = Nothing
Set oService = Nothing
Set oLocater = Nothing
** 実行例 [#h6811510]
cscriptを使用して実行した時の出力です。
PS C:\Users\sakura\Desktop> cscript .\comsyspro.vbs
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
プロダクト名: 3254CTO
プロダクトのバージョン: ThinkPad Edge E430
製品ID: MP20G0P
ベンダー: LENOVO
PS C:\Users\sakura\Desktop>
以上、Win32_ComputerSystemProductを使ったサンプルスクリプ...
#htmlinsertpcsp(win-btm.html,win-sp.html)
終了行:
#navi(../)
* Win32_ComputerSystemProductのサンプルスクリプト [#n9316...
WMIを使ったWin32_ComputerSystemProductでマシンに関する情...
#contents
#htmlinsertpcsp(win-top.html,win-sp.html)
* 関連記事 [#rfdd5bef]
-[[PowerShellでWMIを使用するサンプル>PowerShell/PowerShel...
-[[Win32_ComputerSystemのサンプルスクリプト>WSH/Win32_Com...
-[[Win32_ComputerSystemProductのサンプルスクリプト>WSH/Wi...
-[[Win32_OperatingSystemのサンプルスクリプト>WSH/Win32_Op...
-[[Win32_BIOSのサンプルスクリプト>WSH/Win32_BIOSのサンプ...
-[[Win32_LogicalDiskのサンプルスクリプト>WSH/Win32_Logica...
-[[Win32_Processorのサンプルスクリプト>WSH/Win32_Processo...
-[[Win32_NetworkAdapterConfigurationのサンプルスクリプト>...
-[[Win32_DiskDriveのサンプルスクリプト>WSH/Win32_DiskDriv...
* Win32_ComputerSystemProductを使ったサンプルスクリプト [...
#ref(comsyspro.vbs)
以下にWin32_ComputerSystemProductを使用したサンプルスクリ...
本サンプルスクリプトでは、以下の4つの値を表示しています。
-プロダクト名
-プロダクトのバージョン
-製品ID
-ベンダー
** サンプルスクリプト [#idd4d09c]
#ref(comsyspro.vbs)
hostname="." ' dotは自機を示す
' uid = "username"
' pwd = "password"
Set oLocater = CreateObject("WbemScripting.SWbemLocator")
Set oService = oLocater.ConnectServer(hostname, "root/ci...
' Set oService = oLocater.ConnectServer(hostname, "root/...
oService.Security_.ImpersonationLevel = 3 ' デフォルト値...
Set items = oService.ExecQuery("Select * From Win32_Comp...
For Each item In items
WScript.Echo("プロダクト名: " & item.Name)
WScript.Echo("プロダクトのバージョン: " & item.Version)
WScript.Echo("製品ID: " & item.IdentifyingNumber)
WScript.Echo("ベンダー: " & item.Vendor)
Next
Set item = Nothing
Set oService = Nothing
Set oLocater = Nothing
** 実行例 [#h6811510]
cscriptを使用して実行した時の出力です。
PS C:\Users\sakura\Desktop> cscript .\comsyspro.vbs
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
プロダクト名: 3254CTO
プロダクトのバージョン: ThinkPad Edge E430
製品ID: MP20G0P
ベンダー: LENOVO
PS C:\Users\sakura\Desktop>
以上、Win32_ComputerSystemProductを使ったサンプルスクリプ...
#htmlinsertpcsp(win-btm.html,win-sp.html)
ページ名: