E14 PowerShell - Bulk Modify AD Attributes via Import CSV – Part1

 

http://help.outlook.com/zh-tw/140/dd251224.aspx

1. Export CSV from Source Domain

C:\Batch>csvde -f c:\Batch\aliax.csv -d OU=BI40,OU=System_Accounts,OU=TestLaber,DC=TestLab,DC=corp,DC=com -r (mailnickname=*) -l mailnickname,proxyaddresses,sAMAAccountname -p subtree

C:\Batch>csvde -f c:\Batch\aliax.csv -d OU=BI40,OU=System_Accounts,OU=TestLaber,DC=TestLab,DC=corp,DC=com -r (mailnickname=*) -p subtree

 

2. Modify CSV for Import

image

 

3. Read MailNickName and import to PhysicalOfficeLocation before MailEnable
3.1 Get-User –Filter

[PS] C:\>Get-User -Filter {samaccountname -eq "FlowerOnline"}

Name                                                        RecipientType
----                                                        -------------
FlowEROnLine                                                UserMailbox

3.2

ForEach {Get-User -identity $_.SAMAccountName}


[PS] C:\Batch>$users = Import-Csv alias.csv
[PS] C:\Batch>$users | ForEach {Get-User -identity $_.SAMAccountName}

Name                                                        RecipientType
----                                                        -------------
FlowEROnLineTest                                            UserMailbox
FlowEROnLine                                                UserMailbox


3.3
[PS] C:\Batch>$users | ForEach {Get-User -identity $_.SAMAccountName | ft Name,Office}

Name                                                        Office
----                                                        ------
FlowEROnLineTest                                            BQT/B40

Name                                                        Office
----                                                        ------
FlowEROnLine                                                BQT/B40

 

3.4
[PS] C:\Batch>$users | ForEach {Get-User -identity $_.SAMAccountName | Set-User -Office $_.Office}


3.5
[PS] C:\Batch>$users | ForEach {Get-User -identity $_.SAMAccountName | ft Name,Office}

Name                                                        Office
----                                                        ------
FlowEROnLineTest                                            FlowEROnLineTest

Name                                                        Office
----                                                        ------
FlowEROnLine                                                FlowERonline

Comments

Popular posts from this blog

E15 CU3–Update Failed–AD replicated Exceeded the tombstone lifetime.

202301 - Exchange onpreme - PowerShell Serialization Payload Signing

Ticket: RemoteAPP certificate revocation check error