Get-AzRmStorageShare -ResourceGroupName "ResourceGroup" -StorageAccountName "StorageAccount" -GetShareUsage
这是我正在使用的代码,但带有实际 RG 和 SAN 名称的替代名称。这是我得到的输出
Name QuotaGiB EnabledProtocols AccessTier Deleted Version ShareUsageBytes snapshotTime
---- -------- ---------------- ---------- ------- ------- --------------- ------------
name1 100 SMB Premium
name2 100 SMB Premium
name3 100 SMB Premium
name4 100 SMB Premium
name5 100 SMB Premium
因此,尽管我调用了特定参数来在 -GetShareUsage 中提取 ShareUsageBytes,但它实际上并未将其输出到列,尽管输出了所有其他正确的信息。我觉得我快要疯了,因为我不确定自己做错了什么。
最佳答案
我相信您只有在获取单个文件共享的详细信息时才能获取共享使用情况,即 -GetShareUsage
仅在指定 -Name
参数时才有效.
这是基于源代码here
:
if (!string.IsNullOrEmpty(this.Name))
{
string expend = null;
if(this.GetShareUsage)
{
expend = ShareGetExpand.Stats;
}
var Share = this.StorageClient.FileShares.Get(
this.ResourceGroupName,
this.StorageAccountName,
this.Name,
expend,
xMsSnapshot: this.SnapshotTime is null? null : this.SnapshotTime.Value.ToUniversalTime().ToString("o"));
WriteObject(new PSShare(Share));
}
关于azure - 以下代码片段不返回 ShareUsageBytes,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71581824/