Get-ADUser -Filter '*' -Properties DisplayName, title, Department, Office, OfficePhone, EmailAddress, wWWHomePage, AccountExpires -SearchBase '****' |
Sort-Object -Property DisplayName | Select-Object -Property DisplayName, Title, Department, Office, OfficePhone, EmailAddress, wWWHomePage, AccountExpires | Export-Csv -LiteralPath C:\PowerShell\temp1.csv
我想讓 AccountExpires 是查看獲取此日期的正確屬性?
在此處輸入圖片說明
uj5u.com熱心網友回復:
嘗試使用該AccountExpirationDate屬性:
$properties = 'DisplayName', 'title', 'Department', 'Office', 'OfficePhone', 'EmailAddress', 'wWWHomePage', 'AccountExpirationDate'
Get-ADUser -filter {AccountExpirationDate -like '*'} -Properties $properties |
Sort-Object DisplayName |
Select-Object $properties |
Export-CSV C:\PowerShell\temp1.csv
AccountExpires不是日期格式,但可以在需要時使用。它不應為空:
值 0 或 0x7FFFFFFFFFFFFFF (9223372036854775807) 表示帳戶永不過期。
uj5u.com熱心網友回復:
這應該有效:
Get-ADUser -Filter '*' -Properties DisplayName, title, Department, Office, OfficePhone, EmailAddress, wWWHomePage, AccountExpires -SearchBase '<your searchbase>' |sort displayname | Export-Csv -LiteralPath C:\PowerShell\temp1.csv
您不需要再次選擇物件,因為您已經使用 -properties 引數這樣做了。
像我的魅力一樣作業。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/339017.html
標籤:电源外壳
上一篇:變數未按順序匯出
