我想使用下面的命令获取NAS驱动器的详细信息,如所有者、访问权限、路径等,但是,它并没有给出我期望得到的内容:
Get-PSDrive -PSProvider FileSystem | %{$_.Root }
A:\
C:\
D:\
Y:\
Z:\
When I run only first part of the command like below..
Get-PSDrive -PSProvider FileSystem
Name Used (GB) Free (GB) Provider Root CurrentLocation
---- --------- --------- -------- ---- ---------------
A FileSystem A:\
C 26.82 23.18 FileSystem C:\ Users\sa-its-sd-na-vco2d-d
D .03 9.96 FileSystem D:\
Y 112.84 137.16 FileSystem \\exmaple.hac.com\opp$
Z FileSystem Z:\
我的目的是得到\\exmaple.hac.com\opp$
,但没有得到它。知道怎么去取吗?
发布于 2018-08-09 08:35:17
问题是,您使用的是Root
,但是您需要DisplayRoot
。
我认为您也可以使用select
:
Get-PSDrive -PSProvider FileSystem | Select DisplayRoot
将输出类似以下内容:
A:\
C:\
D:\
\\exmaple.hac.com\opp$
Z:\
这将只选择根列。如果您需要更多信息,例如名称和DisplayRoot:
Get-PSDrive -PSProvider FileSystem | Select Name,Root
https://stackoverflow.com/questions/51762098
复制相似问题