我的Get-AzureStorSimpleAccessControlRecord调用返回 2 个对象,其中包含
Name属性值servertest4和servertest3。
然而,
Get-AzureStorSimpleAccessControlRecord | where {$_.Name -like '*servertest4*'}
Run Code Online (Sandbox Code Playgroud)
意外地返回两个对象。
如果我通过 for-each 循环传递它,则 where 语句将捕获该属性。
Get-AzureStorSimpleAccessControlRecord | % {$_.Name} | where {$_ -like 'servertest4'}
servertest4
Run Code Online (Sandbox Code Playgroud)
意外地传递原始命令Get-Member不会显示该Name属性。这是问题所在吗?
如果是这样,为什么它把它作为一列,为什么当我将它传递给 for-each 循环时它会起作用?这是它返回的所有属性(我删除了方法):
Get-AzureStorSimpleAccessControlRecord | gm
TypeName: System.Collections.Generic.List`1[[Microsoft.WindowsAzure.Management.StorSimple.Models.AccessControlRecord, Microsoft.WindowsAzure.Management.StorSimple,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]
Name MemberType Definition
Item ParameterizedProperty
Microsoft.WindowsAzure.Management.StorSimple.Models.AccessControlRecord Item(int index) {get;set;}
Capacity Property int Capacity {get;set;}
Count Property int Count {get;}
IsFixedSize Property bool IsFixedSize {get;}
IsReadOnly Property bool …Run Code Online (Sandbox Code Playgroud)