是的,我知道了!!
这就是答案。
使用 VB 脚本,我设法创建了一个脚本来完成我正在寻找的任务,然后我将其转换为 Powershell,下面是脚本。
$drive = gwmi Win32_Volume | where {$_.DeviceID -like "*b0f012f6-82b1-11df-a41c-001f29e8f0be*"}
$drive.AddMountPoint("T:\")
$drive.DriveLetter = "T:"
$drive.Put_
$drive.Mount()
我通过运行以下脚本获得的设备 ID:
# get volumes on this system
$volumes = get-wmiobject Win32_Volume
# display volume info
# There are {0} volumes on this system, as follows: " -f ($volumes.length)
# Iterate through volumes and display information
foreach ($vol in $volumes) {
"Volume: {0}" -f ++$i
"============================="
$vol | Format-List Access,Automount,Availability,BlockSize,BootVolume,Capacity,Caption,Compressed,ConfigManagerErrorCode,ConfigManagerUserConfig,CreationClassName,Description,DeviceID,DirtyBitSet,DriveLetter,DriveType,ErrorCleared,ErrorDescription,ErrorMethodology,FileSystem,FreeSpace,IndexingEnabled,InstallDate,Label,LastErrorCode,MaximumFileNameLength,Name,NumberOfBlocks,PageFilePresent,PNPDeviceID,PowerManagementCapabilities,PowerManagementSupported,Purpose,QuotasEnabled,QuotasIncomplete,QuotasRebuilding,SerialNumber,Status,StatusInfo,SupportsDiskQuotas,SupportsFileBasedCompression,SystemCreationClassName,SystemName,SystemVolume
}
从一个帖子msdn 关于 Win32_Volume 类 http://msdn.microsoft.com/en-us/library/aa394515%28v=VS.85%29.aspx#4.
我希望这可以帮助别人
感谢所有提供帮助的人!