WSH/Win32_Processorのサンプルスクリプト
の編集
Top
/
WSH
/
Win32_Processorのサンプルスクリプト
[
トップ
] [
編集
|
差分
|
バックアップ
|
添付
|
リロード
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
-- 雛形とするページ --
(no template pages)
#navi(../) * Win32_Processorのサンプルスクリプト [#e2edd64b] WMIを使ったWin32_ProcessorでCPUに関する情報を表示するサンプルスクリプトを以下に記します。 #contents #htmlinsertpcsp(win-top.html,win-sp.html) * 関連記事 [#x48089e0] -[[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_Processorを使ったサンプルスクリプト [#i712b789] 以下にWin32_Processorを使用したサンプルスクリプトを記します。~ 本サンプルスクリプトでは、以下の値を表示しています。 -CPU名 -CPUの種類 -論理プロセッサ数 -製造 -カレントクロック -データ幅 -L2キャッシュ ** サンプルスクリプト [#sdc00202] #ref(cpu.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_Processor", , 48) For Each item In items WScript.Echo("CPU名: " & item.Name) WScript.Echo("CPUの種類: " & item.Description) WScript.Echo("論理プロセッサ数数: " & item.NumberOfLogicalProcessors) WScript.Echo("製造: " & item.Manufacturer) WScript.Echo("カレントクロック: " & item.CurrentClockSpeed) WScript.Echo("データ幅: " & item.DataWidth) WScript.Echo("L2キャッシュ: " & item.L2CacheSize) Next Set item = Nothing Set oService = Nothing Set oLocater = Nothing ** 実行例 [#k1b42564] cscriptを使用して実行した時の出力です。~ C:\Users\sakura\Desktop>cscript cpu.vbs Microsoft (R) Windows Script Host Version 5.8 Copyright (C) Microsoft Corporation. All rights reserved. CPU名: Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz CPUの種類: Intel64 Family 6 Model 58 Stepping 9 論理プロセッサ数数: 4 製造: GenuineIntel カレントクロック: 2500 データ幅: 64 L2キャッシュ: 256 以上、Win32_Processorを使ったサンプルスクリプトでした。 #htmlinsertpcsp(win-btm.html,win-sp.html)
タイムスタンプを変更しない
#navi(../) * Win32_Processorのサンプルスクリプト [#e2edd64b] WMIを使ったWin32_ProcessorでCPUに関する情報を表示するサンプルスクリプトを以下に記します。 #contents #htmlinsertpcsp(win-top.html,win-sp.html) * 関連記事 [#x48089e0] -[[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_Processorを使ったサンプルスクリプト [#i712b789] 以下にWin32_Processorを使用したサンプルスクリプトを記します。~ 本サンプルスクリプトでは、以下の値を表示しています。 -CPU名 -CPUの種類 -論理プロセッサ数 -製造 -カレントクロック -データ幅 -L2キャッシュ ** サンプルスクリプト [#sdc00202] #ref(cpu.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_Processor", , 48) For Each item In items WScript.Echo("CPU名: " & item.Name) WScript.Echo("CPUの種類: " & item.Description) WScript.Echo("論理プロセッサ数数: " & item.NumberOfLogicalProcessors) WScript.Echo("製造: " & item.Manufacturer) WScript.Echo("カレントクロック: " & item.CurrentClockSpeed) WScript.Echo("データ幅: " & item.DataWidth) WScript.Echo("L2キャッシュ: " & item.L2CacheSize) Next Set item = Nothing Set oService = Nothing Set oLocater = Nothing ** 実行例 [#k1b42564] cscriptを使用して実行した時の出力です。~ C:\Users\sakura\Desktop>cscript cpu.vbs Microsoft (R) Windows Script Host Version 5.8 Copyright (C) Microsoft Corporation. All rights reserved. CPU名: Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz CPUの種類: Intel64 Family 6 Model 58 Stepping 9 論理プロセッサ数数: 4 製造: GenuineIntel カレントクロック: 2500 データ幅: 64 L2キャッシュ: 256 以上、Win32_Processorを使ったサンプルスクリプトでした。 #htmlinsertpcsp(win-btm.html,win-sp.html)
テキスト整形のルールを表示する
添付ファイル:
cpu.vbs
504件
[
詳細
]