在PowerShell中,即使有可能知道,如果一个驱动器是一个网络驱动器:看In PowerShell, how can I determine if the current drive is a networked drive or not?在PowerShell中,我怎么能确定驱动器的根目录(假设它是一个网络驱动器)
当我试图让驱动器的“根”,我找回了驱动器盘符。
的设置: MS-DOS “NET USE” 显示,H:真的是一个映射的网络驱动器:
New connections will be remembered.
Status Local Remote Network
-------------------------------------------------------------------------------
OK H: \\spma1fp1\JARAVJ$ Microsoft Windows Network
The command completed successfully.
GET-PSDrive来告诉我们的根是H:
PS:24 H:\temp
>get-psdrive h
Name Provider Root CurrentLocation
---- -------- ---- ---------------
H FileSystem H:\ temp
,并使用system.io.driveinfo不给我们一个完整的答案:
PS:13 H:\
>$x = new-object system.io.driveinfo("h:\")
PS:14 H:\
>$x.DriveType
Network
PS:15 H:\
>$x.RootDirectory
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 29/09/2008 16:45 h:\
如何GE的任何想法那个信息?
由于
A小调挑剔,它的获取 - WmiObject可以代替GET-WMI :) – JJarava 2008-10-01 16:39:42