开发者

Associate mount points with local disks in VBscript / WMI

开发者 https://www.devze.com 2022-12-22 18:22 出处:网络
I have a VBscript that outputs various config items about a system. Both hardware and software. I can output disks and their associated partitions. I can output mount points. I do not seem to be able

I have a VBscript that outputs various config items about a system. Both hardware and software. I can output disks and their associated partitions. I can output mount points. I do not seem to be able to associate a mount point with a local disk (where it actually is a local disk).

I need to be able to do this using VBscript, so as to fit in with the rest of the ~2000 lines of code. I do NO开发者_开发技巧T want to run some other program graphically. I know the disk manager service can show me (My Computer -> Manage -> Disk Management), but this is not what I need. I need to be able to do this remotely via VBscript.

I am open to running an .exe from the VBscript and piping the output back into VBscript and massaging it from there.

Any idea's ? Thanks in advance.


I am not sure what you mean, but I think I have an idea. Have you checked out the the WMI class Win32_LogicalDisktoPartition. Check this out from a command prompt with admin privileges.

wmic path win32_logicaldisktopartition get /?

That will give you the class properties and methods. If you just run this, it will dump all the instances available.

wmic path win32_logicaldisktopartition

This might give you what you need. For Windows XP, this only seems to mention the disk with the boot partition. On Vista and newer, it seems to list everything, including optical disk. Problem is I have always found this info to be unhelpful unless you know what Disk0, Disk1, Disk(N) is, and that is rare beyond a specific computer to computer case. If it is useful, this is easy to put into a WMI call with VBScript. Hope it helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消