【发布时间】:2020-08-14 06:11:09
【问题描述】:
我有一个命令将过滤的服务器列表加载到变量中:
$Computers = Get-adcomputer -filter "OperatingSystem -notlike '*server*'" -properties * |Where-Object {$_.LastLogonDate -gt $time -and ($_.Enabled -eq $true) -and ($_.name -ne 'Rose*')} |select name
我想使用 For each 循环来处理这些计算机名。当我刚刚输入命令时,我会得到一个顶部带有“名称”的列表和一个计算机名称列表
但是当我在循环中使用 Write out the contents of $Computer 时,我会得到一个 @{name=Computer1}
列表发生了什么事?为什么我不能使用干净的计算机阵列?
【问题讨论】:
标签: powershell