So I have a PowerShell script to help me document various server attributes. Most of the script creates tables in a Word document and populates them cell by cell. This is pretty slow and takes about 10 minutes to create a 50 page document. Some of my larger environments ended up with thousand page documents that took a day to create.
However; a few sections in my script create Excel tables because the data just didn't lend itself to being broken up into tables that would fit in Word. With these tables I used the method I found in this blog http://powertoe.wordpress.com/2010/11/05/how-to-get-data-into-an-excel-spreadsheet-very-quickly-with-powershell-contd/ so that instead of populating the tables cell by cell you create a multi-dimensional array and populate the table in all at once. Using this method a decent size Excel table can be created by PowerShell in about 1/2 second.
I've tried to modify the methods from the blog post to work with Word in addition to Excel but I haven't been able to get anything to work.
Since I have it working in Excel my problem is not creating the multi-dimensional array it's how to get it into Word.
Any tips on how to modify the short sample script at the top of the blog post to work with Word would be extremely appreciated.
Thanks