Windows Server 2008 R2 32-bit Task Scheduler - windows

Trying to schedule a task on a Windows Server 2008 R2 box.
I have a vbscript connects to an oracle database to pull data, and I want this to run at intervals.
The vbs is working standalone on the same machine, only when run with 32-bit csript.exe (needs a 32-bit ODBC driver). I can kick the vbs file off with a batch file to call C:\Windows\SysWOW64\cscript.exe "c:\scriptLoc" and it works fine.
But when I try to schedule a task I get the same error I got when trying to run the vbs directly by double clicking - which uses cscript.exe 64-bit (I presume).
I have also tried opening the 32-bit Task Scheduler C:\Windows\SysWOW64\taskschd.msc, and adding the job there, but getting the same results.
Any suggestions?
Thanks
Edit-------------------------------------------------------------------------------------------------------------
The error is that Oracle Client cannot be found, driver is 32-bit and won't work with 64-bit. This error occurs when I manually run vbs with the default cscript.exe, but it all works ok when I manually run with 32-bit cscript.exe

The solution for the scheduled task was:-
Start a Program
Program script = C:\Windows\SysWOW64\cscript.exe (which is the 32-bit csscript.exe)
Add Arguments = C:\Scripts\test.vbs (my vbs script to run)
Start in = C:\Windows\SysWOW64\ (run in the 32-bit directory)

Related

Setup Bootstrap for Visual Basic Setup Toolkit - EXE - silent installation (VB6)

We have an old application which uses has it's executable (EXE) build on VB6 (Setup Bootstrap for Visual Basic Setup Toolkit ). We are trying to silently install the setup by and running it in a scheduled manner using task scheduler.
Command use : Start-Process -FilePath "D:\SETUPXXX.EXE" -Verb runAs -ArgumentList "/qn"
While running this stand alone from a power shell console or command line the setup executes and shows up on the screen , completes installation and goes off(without clicking anything). This installs is successfully.
But wherever we are trying to schedule this on a task scheduler it doesn't pop up anything and neither it installs the application.
We tried other ways "setupxxx.exe /sc:\setup.log" but the results are same it works when executed from command line and pops up the installation completes but fails to do the same when scheduled or run as a batch file.
Is there a way to stop the installer popup coming which might be stopping the instillation while running.
Refer :https://theether.net/kb/100165

Run script without wscript.exe

I am trying to run the ALM test suite from Task Scheduler by writing a VBScript.
My VBScript runs only when executed from command line:
C:\Windows\SysWOW64\wscript.exe "C:\RunTestSet.cls.vbs"
When I run the script directly I get an error:
Unable to create an instance of the TestDirector API OLE.
I get different error when run through Task Scheduler:
Task Scheduler failed to launch action "\SysWOW64\wscript.exe" in instance "XXXXXXX" of task "\UFT Test 2". Additional Data: Error Value: 2147942667.
Please help me to run this script from Task Scheduler.
I tried giving this in start in (without quoted): C:\Windows\SysWOW64\wscript.exe
Since ALM is 32 bit and the OS you are using to execute is 64 bit OS.
There is a way to register the 64 bit compatible wsctipt.exe to diretly execute it as:
regsvr32 "c:\Program Files (x86)\Common Files\Mercury Interactive\Quality Center\OTAClient.dll"
but you can directly call,
C:\Windows\SysWOW64\wscript.exe "C:\RunTestSet.cls.vbs"
for a 64 bit OS as you did above.

Scheduled task not working in Windows Server 2008 R2

We have a Windows Script File X.wsf, which in turn will call Y.vbs. When we run X.wsf from the command window in Windows Server 2008 R2, either as "cscript X.wsf" or "X.wsf", it works fine. However, if we create a task in Windows Scheduler and trigger X.wsf, the only thing that we see is "Running" status, but nothing seems to happen. The task will remain in "Running" status forever, but we don't see anything happening.
Note that "Start In" in the task properties is already set to the folder containing X.wsf, and we also set it to run with SYSTEM and with "Run with highest privileges".
In Windows Server 2003, the same task works just fine. Also, we created a small .bat script and tested running it with a scheduled task in Windows Server 2008 R2, and it worked fine as well. So we suspect that Windows Scheduler must be behaving differently in Windows Server 2008 R2 for .wsf or .vbs files. Anyone know what the root cause is, and what is the solution?
User,
I tried executing a wscript on a command session as well as a task session. Im able to execute from both the ways.
Make sure that you mention the correct path/filename in the trigger section. Also make sure that you provide the complete path of the switch
<Actions Context="Author">
<Exec>
<Command>C:\Windows\System32\wscript.exe</Command>
<Arguments>u:\Scripts\test.vbs</Arguments>
</Exec>
</Actions>
Let me know if this works.

Batch script to update hosts file on boot-up using curl

I am trying to get a .bat script to run on boot-up and purge the hosts file with a new one.
I have this working on Windows Server 2008 Standard X86 and it has been working consistently for over a year. I installed 'curl', hard linked it to System32 and schedule the following .bat script using local group policy:
curl x.x.x.x/latest/hosts > C:\Windows\System32\drivers\etc\hosts
Now I want to get the same script working on windows server 2008 R2. I have the same thing setup and it works if I double-click the .bat file. However, when the script runs on startup via GPO, it simply wipes the hosts file completely and I have to login manually and double-click the .bat script.
Any idea what's causing this?
Is it a difference between Server 2008 R2 and Server 2008 STD?
Try
curl.exe x.x.x.x/latest/hosts > C:\Windows\System32\drivers\etc\hosts.tmp
move C:\Windows\System32\drivers\etc\hosts.tmp C:\Windows\System32\drivers\etc\hosts

Running Batch File in background when windows boots up

How do I run a batch file each time windows boots up also I need to run it in the back ground(without that command window getting displayed)? I use Windows Xp.
My actuall requirement is I want to start the Tracd server using the command line commands whenever Windows boots up.
Add your program in the registry:
Run - These are the most common startup locations for programs to install auto start from. By default these keys are not executed in Safe mode. If you prefix the value of these keys with an asterisk, *, is will run in Safe Mode.
Registry Keys:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run registry key
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run registry key
Then you can launch your batch in an invisible mode:
wscript.exe "C:\yourpath\invis.vbs" "your_file.bat"
In invis.vbs put...
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False
Two other startup posibilties:
you could always add the bat file to the startup folder,
or start it as a Scheduled task setting to run on logon.
You can make an application run as a service.
Check this article for details:
You can use autoexnt for this. It was original designed for windows NT, but is still working in newer versions of windows.
You have to download the Windows 2003 Resource Kit to get it.
There's also hstart, a third party program that's worked well for my needs. It's maintained too. The last version was released on July 7, 2010.

Resources