PS脚本保存位置

时间:2017-10-05 18:44:34

标签: powershell

我正在尝试将其保存到笔记本电脑上的.csv

Search-ADAccount -UsersOnly -AccountInactive -TimeSpan 90 | Get-ADUser -1 Properties Name, sAMAccountName, givenName, sn, userAccountControl | Where {($_.userAccountControl -band 2) -eq $False} | Select Name, sAMAccountName, givenName, sn | Export-Csv -NoTypeInformation -Path c:\ExportTest.csv

脚本根据需要运行,此部分不运行:

| Export-Csv -NoTypeInformation -Path c:\ExportTest.csv

1 个答案:

答案 0 :(得分:0)

此脚本适用于将非活动帐户导出为.CSV文件

Search-ADAccount -UsersOnly -AccountInactive -TimeSpan 90 | 
Get-ADUser -Properties Name, sAMAccountName, givenName, sn, userAccountControl |
Where {($_.userAccountControl -band 2) -eq $False} |
Select Name, sAMAccountName, givenName, sn |
Export-CSV c:\YOURFOLDER\FILENAME.csv -NoTypeInformation