Archive for the ‘PowerShell’ Category

Bulk Creating Mail Objects with PowerShell

 

The following takes the input variables of ‘$_’ reference and passes them through to the associated AD attribute via the -attributename command. This is for the -room object, you can also use the -mailbox object and others, just be aware of the requirements per object type.
Import-CSV C:\test\room.csv | foreach {new-mailbox -alias $_.alias -organizationalunit $_.ou -name $_.name -database $_.database -samaccountname $_.samaccountname -UserPrincipalName $_.upn -room}

 

For the input file, please download the following: Room CSV (This hsould be renamed back to .csv, I named it .xls because of some security risk aparently csv poses!)