So basically I have this VBScript that opens up an Excel 2010 instance, run a macro in it and close the spreadsheet. I am calling it using Scheduled Task to automate it. It ran beautifully when I was on Windows XP, but recently my company upgraded to Windows 7 and when I tried to schedule it using the new Task Scheduler in Windows 7, the task was stuck at running status but nothing was ever run if I choose Run whether user is logged in or not, with or without run with highest privileges checked. However if I use Run only when user is logged on, everything runs fine.
Here are a few things I've tried to test/verify the issue:
-
The same script could be scheduled in Windows XP with the scheduled task, without the need for user to log on. The script itself, of course, would work when I double-clicked it.
-
Another script that does not use Excel instance could be scheduled without any issue.
-
I have created a .bat file to call the VBS script and use Windows task scheduler to schedule the bat file with no luck, the bat file is one line of code:
C:\Windows\System32\CScript.exe //Nologo //B "C:\myscript.vbs"
When I ran it, it showed the task was completed but nothing was ever launched nor run.
Other things I have tried include using CMD as the program./script and /c start "" "C:\myscript.vbs" as the argument, or using C:\Windows\System32\CScript.exe as the program/script and //Nologo //B "C:\myscript.vbs" as the argument. All with no luck.
-
Excel was not even launched in this case as I can see there is no additional Excel process in task manager.
-
There seems to be an option to schedule the task in compatibility mode with Windows XP but when I tried to right click and select Properties, under General tab, the only thing I can see in Configure for: is Windows 7 and server 2008 R2, second option is Windows Vista and server 2008.
-
My account has admin privileges on the PC.
Therefore, is there any way I can schedule this script somehow to run without the need of me to log on? I am open to any options. The PC is on Windows 7 Enterprise 64 bit with Excel 2010 installed.
Thanks in advance for your help!
Best Answer
Fixing Group Policy problems by using log files
Enable Logging for Group Policy Object Editor Client Side Extensions
0/ see logs:
1/ 32-bit run vbscript:
2/ Programs may be unable to access some network locations after you turn on User Account Control in Windows Vista or in Windows 7
3/ Disable UAC
command line:
vbs-32.cmd:
SheetName.vbs: