Active Directory

Active directory and Microsoft Exchange Usefull

Microsoft has several commands available through the Powershell server with Windows, allowing access to Active Directory. This simplifies tasks that previously required the introduction of long lines of code involving. The Active Directory module via PowerShell must be installed.

Active Directory Cmdlet

// Export members list of a group

Get-ADGroupMember -identity “Account” | select name | Export-csv -path C:\temp\Groupmembers.csv -NoTypeInformation

// Export members list of a group

Get-ADGroupMember -identity “Account” | select name,samaccountname,mail | Export-csv -path C:\temp\Groupmembers.csv -NoTypeInformation

// Export the list of groups

Get-ADGroup -filter *  | * | Export-csv -path C:\temp\Groupmembers.csv -NoTypeInformation

// Export user list

Get-ADUser -filter *  | select * | Export-csv -path C:\temp\userlist.csv -NoTypeInformation

// Export OU list

Get-ADOrganizationalUnit -filter *  | select * | Export-csv -path C:\temp\OUlist.csv -NoTypeInformation

// Export computer list

Get-ADComputer -filter *  | select * | Export-Csv c:\temp\computerlists.csv -NoTypeInformation

// Export email list

get-mailbox -filter *  | select * | Export-csv -path C:\temp\emaillist.csv -NoTypeInformation

// Change email password

Set-Mailbox [email protected] -Password (ConvertTo-SecureString -String ‘temp2017’ -AsPlainText -Force)

// Test mail flow 

Test-Mailflow -TargetEmailAddress [email protected]

// Empty BlockedSendersAndDomains list

Set-MailboxJunkEmailConfiguration -Identity [email protected] -BlockedSendersAndDomains $null

// Retrieve a delivery report

Get-MessageTrackingReport -Identity [email protected]


Sources :