Last week at the PowerShell Deep Dive in San Diego, I did a short presentation on integrating Microsoft Office applications like Excel and Word with Windows PowerShell. I easily could have spoken much longer and probably tried to cram too much in. I spent a lot of time with my demos. I expect at some point a video of my talk will be posted on the TEC site. In the mean time you can download a PDF of my slide deck and a zip file with all of my demos. Some of the scripts have been revised slightly since my presentation. The scripts are NOT intended for production use. They are demonstration and proof-of-concept scripts. Many of them have hard coded paths for additional files so read them carefully before you try to run. I've tried to comment extensively so you can understand what is going on, but this is admittedly a complicated topic. I'm hoping to create some additional videos around these demos, but if you have questions please post a comment.
ManageEngine ADManager Plus - Download Free Trial
Exclusive offer on ADManager Plus for US and UK regions. Claim now!
Enjoy.
Hi Jeff,
Thanks a lot for sharing you deck and your scripts. Very good work!
By the way I’m encountering an error when trying your Excel script. Indeed, when I execute these 2 lines I got an error. Have ever faced this issue?
PS> $xl=New-Object -ComObject “Excel.Application”
PS> $wb=$xl.Workbooks.Add()
Exception calling “Add” with “0” argument(s): “Old format or invalid type library. (Exception from HRESULT: 0x80028018 (TYPE_E_INVDATAREAD))”
At line:1 char:22
+ $wb=$xl.Workbooks.Add <<<< ()
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ComMethodTargetInvocation
I'm using Excel 2010 build 14.0.6112.5000 (32 bits) French.
I cannot imagine this is caused by the language version with is different than yours.
It is certainly possible that the language may be the cause. Take these three lines:
set xl=wscript.createObject(“Excel.Application”)
set wb=xl.workbooks.add()
xl.Visible=vbTrue
and put them in a VBScript. Run the VBScript and see if you get the same error. If so, then it is definitely an Excel issue.