Exchange Exchange
A community dedicated to Exchange and related technology.
Reading file content with Powershell

This is one of the basic necessities of being an admin and using any type of scripting. How do you read content from a file? For example, you have a text file with usernames that you want to migrate to exchange 2007. Well powershell makes it easy for you.

$a = Get-content c:\usernames.txt

This will read the file and save the contents into an array called $a. Now if you want to use that to move a mailbox, try the following:

Get-content c:\usernames.txt | move-mailbox -targetdatabase databasename

This commands reads the usernames from the files and then pipes each username one at a time to the move-mailbox command. A quick and easy way to move a group of users from a text file.


Posted 01-19-2007 6:36 PM by Victor Martinez
© 2003-2009 NamedPipes Consulting. All other company and product names are property of their owners.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems