复制代码 代码如下:
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery( _
"associators of {win32_logicaldisk.deviceid='G:'} WHERE ResultClass=Win32_DiskPartition")
For Each objItem in colItems
TargetIndex = objItem.DiskIndex
Set Items = objWMIService.ExecQuery( _
"SELECT * FROM Win32_DiskDrive Where DeviceID Like '%" & objItem.DiskIndex & "'",,48)
For Each Item in Items
Wscript.Echo "Model: " & Item.Model
Next
Next
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery( _
"associators of {win32_logicaldisk.deviceid='G:'} WHERE ResultClass=Win32_DiskPartition")
For Each objItem in colItems
TargetIndex = objItem.DiskIndex
Set Items = objWMIService.ExecQuery( _
"SELECT * FROM Win32_DiskDrive Where DeviceID Like '%" & objItem.DiskIndex & "'",,48)
For Each Item in Items
Wscript.Echo "Model: " & Item.Model
Next
Next
标签:
vbs,盘符,设备名
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
内蒙古资源网 Copyright www.nmgbbs.com
暂无“VBScript根据盘符找设备名的代码”评论...