powershell - 获取 NAS 驱动器信息
问题描述
我想使用以下命令获取 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$
但没有得到。知道如何获取它吗?
解决方案
问题是,你正在使用Root
但你想要DisplayRoot
.
我认为您也可以使用select
:
Get-PSDrive -PSProvider FileSystem | Select DisplayRoot
将输出如下内容:
A:\
C:\
D:\
\\exmaple.hac.com\opp$
Z:\
这将只选择 Root 列。如果您想要更多,例如 Name 和 DisplayRoot:
Get-PSDrive -PSProvider FileSystem | Select Name,Root
推荐阅读
- android - Bar graph X axis labels disappeared after Shunting the viewport to show the full width of bars
- java - ojAlgo 使用 ExpressionsBasedModel 解决最小二乘问题
- sql - What are the security benefits (or drawbacks) to wrapping a HTTP server around a SQL Server?
- aws-lambda - AWS Lambda 通过 PG.js 连接到 RDS Postgres 数据库(已建立连接,没有超时,但没有数据库?)
- angular - 角 | 打字稿 | 数据表不分页/排序
- c# - `RequestPermissionAsync` 没有返回,也没有按预期工作。Ask Permission wait for it and GetLocation when permission is allowed 问题
- google-app-engine - 没有可用于谷歌云任务的日志?
- raku - 日志类参考
- flutter - How to save values selected from a flutter multiselect widget in to a list
- reactjs - 在 React Native 中,如何在状态更改时更改导航选项?