c盤清理的步驟是什么(如何清理C盤空間)
如何清理C盤空間怎么清理C盤的垃圾文件?每天上網會給電腦帶來很多臨時文件,這些垃圾文件不清理掉時間久了就會影響到電腦的運行速度。那怎
2022/12/08
(資料圖片僅供參考)
Powershell獲取1年內未改密碼的用戶
1、定義OU搜索范圍:OU=BYSSOFT_OBJECT,DC=byssoft,DC=com
2、定義輸出結果文件
#建議保存編碼為:bom頭 + utf8$輸入ou = "OU=BYS_Users,OU=BYS_Object,DC=byssoft,DC=com"$輸出文件 = "d:\expireduser.txt"$1年前 = (Get-Date).addyears(0)$users = Get-ADUser -SearchBase $輸入ou -filter { PasswordLastSet -lt $1年前 } -Properties samaccountname,msDS-UserPasswordExpiryTimeComputed,PasswordNeverExpires,PasswordLastSet$結果 = @()foreach ($user in $users){ $a = [PSCustomObject]@{ samaccountname = $user.samaccountname ou = $user.DistinguishedName 密碼更改日期 = $user.PasswordLastSet 密碼過期日期 = [datetime]::FromFileTime($user."msDS-UserPasswordExpiryTimeComputed") #密碼永不過期 = $user.PasswordNeverExpires } $結果 += $a}#$結果 | Sort-Object -Unique | Export-Csv -LiteralPath $輸出文件 -Encoding unicode -NoTypeInformation$結果 | Export-Csv -LiteralPath $輸出文件 -Encoding unicode -NoTypeInformation
3、執行成功
4、輸出結果