DIR /b will just give you a list with the filenames. No need to delete extraneous headers or filesizes

----- Original Message ----- From: "David Lum" <[email protected]>
To: "NT System Admin Issues" <[email protected]>
Sent: Saturday, February 05, 2011 10:12 PM
Subject: Knock me down a notch (aka some days, I am too proud of myself)


So today I am rolling back an abortive outsourcing Exchange attempt. Long story but here's what gives me one of those "maybe I am Dr. Evil" moments.

I have 600+ .PST files I need to import into Exchange 2007. The PST file names match the mailbox names.

Michael and other PS guru's probably have a better solution than mine so I am game to here it, but here's my dorkatude:

1. In the directory with the PST's (about 100pst's per folder), I do DIR > GROUPx.TXT 2. Open said TXT file in Excel, setting columns to separate out file names from other garbage (delete all columns except file names) 3. Now having just the list of files, I add a columns to the left and right
3a Column A is part of a powershell command dir D:\ExchangeImport\Groupx\
3b Column B is the list of PST file names
3c Column C is | import-mailbox -Confirm:$false
3d Column D is =A1&B1&C1 and concatenates each line into a tidy PS command like dir D:\ExchangeImport\Group4\bob.johnson.pst | import-mailbox -Confirm:$false
4. Take column D and paste into Notepad and save as .PS1 file
5. Run PS1 file

Start to finish it's *maybe* 5 mins per group of PST's to make a .PS1 file.

I laugh that overall it's command prompt, Excel, cut and paste to Notepad, and PowerShell. In my particular case Excel isn't on the target box so I am actually pasting to my local notepad and saving it before opening in Excel. Also having 7 groups means I open 7 PowerShell sessions and let 'em rip

So...am I actually clever, or is this really a long way around?

Dave "2hs sleep might impair my judgement" Lum


~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: http://lyris.sunbelt-software.com/read/my_forums/
or send an email to [email protected]
with the body: unsubscribe ntsysadmin


~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to [email protected]
with the body: unsubscribe ntsysadmin

Reply via email to