将Get-MsolUser的所有参数放入数组

想要将Get-MsolUser支持的所有参数的名称放入一个数组中,以便能够动态地从用户那里获取不同的信息。

Get-Command Get-MsolUser

上面的命令没有显示参数,只有命令本身。

xqxqwps 回答:将Get-MsolUser的所有参数放入数组

您可以运行以下命令,该命令只需链接成员访问操作符$array = (Get-Command Get-MSolUser).Parameters.Values.Name

Parameters

Values是具有内置Name属性的Dictionary对象。该属性是一个包含有关每个参数的属性的集合。由于只需要名称,因此只需访问$exclude = 'Debug','ErrorAction','ErrorVariable','InformationAction','InformationVariable','OutVariable','OutBuffer','PipelineVariable','Verbose','WarningAction','WarningVariable' ((Get-Command Get-MSolUser).Parameters.Values | Where Name -notin $exclude).Name 属性。

如果要排除某些参数,我只介绍一个排除列表。

scala.collection.JavaConverters.asScalaIteratorConverter(list.iterator()).asScala().toSeq();
本文链接:https://www.f2er.com/3149965.html

大家都在问