WSH/Win32_DiskDriveのサンプルスクリプト
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
開始行:
#navi(../)
* Win32_DiskDriveのサンプルスクリプト [#t7d81e0f]
WMIを使ったWin32_DiskDriveでディスク・ドライブに関する情...
#contents
#htmlinsertpcsp(win-top.html,win-sp.html)
* 関連記事 [#x5c6f6f0]
-[[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_DiskDriveを使ったサンプルスクリプト [#n0b622f4]
以下にWin32_DiskDriveを使用したサンプルスクリプトを記しま...
本サンプルスクリプトでは、以下の値を表示しています。
-モデル名
-容量
** サンプルスクリプト [#g34130e1]
#ref(disk.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_Disk...
For Each item In items
WScript.Echo("モデル: " & item.Model)
WScript.Echo("容量: " & item.Size)
Next
Set item = Nothing
Set oService = Nothing
Set oLocater = Nothing
** 実行例 [#pe4f9701]
cscriptを使って実行した時の出力結果です。
C:\Users\sakura\Desktop>cscript disk.vbs
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
モデル: SDXC Card
容量: 63482711040
モデル: TS128GSSD340
容量: 128034708480
以上、Win32_DiskDriveを使ったサンプルスクリプトでした。
#htmlinsertpcsp(win-btm.html,win-sp.html)
終了行:
#navi(../)
* Win32_DiskDriveのサンプルスクリプト [#t7d81e0f]
WMIを使ったWin32_DiskDriveでディスク・ドライブに関する情...
#contents
#htmlinsertpcsp(win-top.html,win-sp.html)
* 関連記事 [#x5c6f6f0]
-[[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_DiskDriveを使ったサンプルスクリプト [#n0b622f4]
以下にWin32_DiskDriveを使用したサンプルスクリプトを記しま...
本サンプルスクリプトでは、以下の値を表示しています。
-モデル名
-容量
** サンプルスクリプト [#g34130e1]
#ref(disk.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_Disk...
For Each item In items
WScript.Echo("モデル: " & item.Model)
WScript.Echo("容量: " & item.Size)
Next
Set item = Nothing
Set oService = Nothing
Set oLocater = Nothing
** 実行例 [#pe4f9701]
cscriptを使って実行した時の出力結果です。
C:\Users\sakura\Desktop>cscript disk.vbs
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
モデル: SDXC Card
容量: 63482711040
モデル: TS128GSSD340
容量: 128034708480
以上、Win32_DiskDriveを使ったサンプルスクリプトでした。
#htmlinsertpcsp(win-btm.html,win-sp.html)
ページ名: