q968 发表于 2018-9-1 11:37:13

Powershell导出CSV文件中指定的AD账户的属性

#导出CSV中用户所有属性  $username=Import-Csv C:\userinfo.csv
  foreach ($i in $username)
  {
  Get-ADUser $i.name -Properties * | `
  Export-Csv c:\alluser.csv -NoTypeInformation -Encoding Default
  }
  #导出CSV中用户部分属性
  $username=Import-Csv C:\userinfo.csv
  foreach ($i in $username)
  {
  Get-ADUser $i.name -Properties * | select SamAccountName,Name,Department | `
  Export-Csv c:\alluser.csv -NoTypeInformation -Encoding Default
  }

页: [1]
查看完整版本: Powershell导出CSV文件中指定的AD账户的属性