New-Object -Com Excel.Application : FALSE

by spacewalk at 2012-11-06 06:10:40


my powershell script does the following :

- get some computer information
- open an excel object "$x = New-Object -Com Excel.Application"
- fills the computer information into the excel object "$y = $x.Workbooks.Add()"
- save and close the excel object "$y.SaveAs("$fid")"
- sends the excel file attached by email to a receiver

I start it as scheduled task with administrative privilegs.
This works with Windows XP32, 64.

When I run it on W7 on command line, it works, too.

But when I run it as scheduled task on W7, it runs, too.
But with one error :
It does not starts a new excel object !

Any ideas why ?
by nohandle at 2012-11-06 10:15:34
do you recieve any error? Can you post it please?
by cweislak at 2012-11-07 03:29:31
Have you tried $x.Visible = $False ?
It might be trying to throw the window on the desktop.
by spacewalk at 2012-11-07 05:11:24
No error message, I just got Returncode "False" if I ask for it in the script.

I work already with "$x.visible = $false".