WMI Fun !! 〜 WMI に興味がある方・システム管理者必見! 〜 |
|
![]() |
WMI Fun !! > WMI Sample (VB) > ネットワークドライブの割り当て状況を取得する |
WMI スクリプトの実行結果を VBS を利用してメールで送信する方法を公開しています
パソコンに負荷のかからないウィルス対策なら ESET パーソナル セキュリティ 話題のプリウス、ディーラーオプションもネットで気軽に購入 ネットワークドライブの割り当て状況を取得する: Win32_MappedLogicalDisk - WMI Sample (VB)Topics
現在のネットワークドライブの割り当て状況を取得するサンプルプログラムです。
Sample Code
Private Sub Command1_Click()
Dim MldSet As SWbemObjectSet Dim Mld As SWbemObject Dim Locator As SWbemLocator Dim Service As SWbemServices Dim MesStr As String Set Locator = New WbemScripting.SWbemLocator Set Service = Locator.ConnectServer Set MldSet = Service.ExecQuery("Select * From Win32_MappedLogicalDisk") For Each Mld In MldSet MesStr = MesStr & "ドライブレター: " & Mld.Name & vbCrLf & _ "ネットワークパス: " & Mld.ProviderName & vbCrLf & _ "ドライブ容量: " & Mld.Size & vbCrLf & _ "空き容量: " & Mld.FreeSpace & vbCrLf Next MsgBox "ネットワークドライブの割り当て状況です。" & vbCrLf & vbCrLf & MesStr Set MldSet = Nothing Set Mld = Nothing Set Locator = Nothing Set Service = Nothing End Sub
![]() Comment
実行するとコンピュータ上で割り当てをしているネットワークドライブの状況を取得し表示します。 ![]() Recommended book
個人的にお勧めする本の紹介です。 ![]() |
ご意見・ご要望・ご感想をこちらのアンケートからお待ちしています |
∧ ページの先頭へ… |