| - WMI Fun !! -|WMI Step|WMI Sample|Search|WMI Fun !! Groups|About WMI Fun !! | ||||||
| Top Page >> WMI Step >> 一番最後に振られているドライブ文字を取得する | ||||||
|
一番最後に振られているドライブ文字を取得する
■Topics一番最後に振られているドライブ文字を取得するサンプルです。Win32_BootConfigurationクラスを使用します。 Private Sub Command1_Click()
Dim BtcSet As SWbemObjectSet
Dim Btc As SWbemObject
Dim Locator As SWbemLocator
Dim Service As SWbemServices
Dim MesStr As String
Set Locator = New WbemScripting.SWbemLocator
Set Service = Locator.ConnectServer
Set BtcSet = Service.ExecQuery("Select * From Win32_BootConfiguration")
For Each Btc In BtcSet
MesStr = MesStr & _
"LastDrive:" & Btc.LastDrive & vbCrLf & vbCrLf
Next
MsgBox "一番最後に振られているドライブ文字です。" + vbCrLf & _
vbCrLf & MesStr & "ですよ。"
Set BtcSet = Nothing
Set Btc = Nothing
Set Service = Nothing
Set Locator = Nothing
End Sub
実行すると一番最後に振られているドライブ文字を取得します。
WMI を本で勉強したい方へ。
なかなか WMI のことが乗っている書籍は少ないですが…管理系業務に係る方には楽しめるかも? |
|
| ^ | Copyright(C) 1997-2008 とお All rights reserved. | << |