Upload files to "AD Scripts"
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
Get-ADUser -Filter * -Properties SamAccountname, DisplayName | ForEach-Object {
|
||||
New-Object PSObject -Property @{
|
||||
UserName = $_.DisplayName
|
||||
oSamAccountname = $_.SamAccountname
|
||||
UserOU = ($_.DistinguishedName -split ",",2)[1]
|
||||
Groups = (Get-ADPrincipalGroupMembership $_.SamAccountname | Select-Object -ExpandProperty Name) -join
|
||||
","
|
||||
}
|
||||
} | Select-Object oSamAccountname, UserName, UserOU, Groups | Export-Csv -Path "C:\Temp\Script Cache\Audit\ADUserandGroupMembers.csv" -NoTypeInformation
|
||||
Reference in New Issue
Block a user