以下代码片段不 return ShareUsageBytes
The following Code snippet doesn't return ShareUsageBytes
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));
}
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));
}