這一個班輪將讓你知道某個日期後的變化。有一個更改屬性與您可以過濾對象。
Get-ADObject -Filter 'whenchanged -gt $dte' | Group-Object objectclass
那麼你可以使用:
get-adgroup -filter * | sort name | select Name
Get-adgroupmember "Name"
或
Get-ADGroup -filter "GroupCategory -eq 'Security'" –properties Member |
Select Name,@{Name="Members";
Expression={($_.member | Measure-Object).count}},
GroupCategory,GroupScope,Distinguishedname |
Out-GridView -Title "Select one or more groups to export" -OutputMode Multiple |
foreach {
Write-Host "Exporting $($_.name)" -ForegroundColor cyan
#replace spaces in name with a dash
$name = $_.name -replace " ","-"
$file = Join-Path -path "C:\work" -ChildPath "$name.csv"
Get-ADGroupMember -identity $_.distinguishedname -Recursive |
Get-ADUser -Properties Title,Department |
Select Name,Title,Department,SamAccountName,DistinguishedName |
Export-CSV -Path $file -NoTypeInformation
Get-Item -Path $file
}
什麼不行呢?爲什麼不使用本機EventLog事件? [在Active Directory上創建新用戶帳戶時的事件ID](https://social.technet.microsoft.com/wiki/contents/articles/17055.event-ids-when-a-new-user-account-is -created-on-active-directory.aspx) – Seth
我們有很多域控制器,事件日誌在一天內被覆蓋,所以這不是一個選項。 – Jaap2016
如果您從左側刪除了'Get-ACL |',則您的代碼將起作用。 :) – Clayton