Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell 访问ConvertTo Html cmdlet中的嵌套属性_Powershell_Azure_Azure Powershell_Azure Resource Manager - Fatal编程技术网

Powershell 访问ConvertTo Html cmdlet中的嵌套属性

Powershell 访问ConvertTo Html cmdlet中的嵌套属性,powershell,azure,azure-powershell,azure-resource-manager,Powershell,Azure,Azure Powershell,Azure Resource Manager,如何在下面的html表格中添加值Sku.Name和Sku.Tier $resourceGroupName = "(my resourcegroup name)" $storageAccounts = Get-AzureRmStorageAccount -ResourceGroupName $resourceGroupName $storageAccounts ` | ConvertTo-Html ` -property ResourceGroupName, StorageAccountN

如何在下面的html表格中添加值
Sku.Name
Sku.Tier

$resourceGroupName = "(my resourcegroup name)"
$storageAccounts = Get-AzureRmStorageAccount -ResourceGroupName $resourceGroupName
$storageAccounts `
 | ConvertTo-Html `
   -property ResourceGroupName, StorageAccountName, Sku, Sku.Name, Sku.Tier, Kind, Encryption, AccessTier `
   -body "<h2>List of Storage Accounts</h2>" `
   -As List `
 | Set-Content "temp.html"
预期 错误 尝试

-property (Sku).Name
结果:

+    -property (Sku).Name
+               ~~~
    + CategoryInfo          : ObjectNotFound: (Sku:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

您需要使用计算属性:

-property ResourceGroupName, StorageAccountName, Sku, @{l='Sku Name'; e={$_.Sku.Name}},  @{l='Sku Tier'; e={$_.Sku.Tier}}, Kind, Encryption, AccessTier
+    -property (Sku).Name
+               ~~~
    + CategoryInfo          : ObjectNotFound: (Sku:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
-property ResourceGroupName, StorageAccountName, Sku, @{l='Sku Name'; e={$_.Sku.Name}},  @{l='Sku Tier'; e={$_.Sku.Tier}}, Kind, Encryption, AccessTier