我们已将用户分配给计算机。该关联包含在计算机对象的“描述”字段中。看起来像这样:
department, user's firstname lastname, serial number, location.
我有一个.ps1脚本,用于获取单个用户的计算机。为了我一生,我无法从脚本中提取txt或csv文件中的用户列表并返回计算机。
我使用Get-Content
和Import-Csv
尝试了许多变体:
$a = Import-Csv C:\temp\getusers.csv |
Get-ADComputer * -Filter "Description -Like '*$a*'" -properties Name,description |
Select Name, Description | Sort-Object Name
任何帮助将不胜感激。