Powershell获取AD用户信息

Function get-info {
   foreach ($line in Get-Content $args[0]) {
      $a = Get-ADUser -Filter {samaccountname -eq $line}  -Properties DisplayName,CN,samaccountname  | select DisplayName,CN,samaccountname  
      if ($a -eq $null){
         Write-Output "---"
      }
      else{ 
         Write-Output $a

      }
  } 
}

get-info("D:\1.txt")
相关文章
相关标签/搜索