Manjish Posted December 30, 2008 Share Posted December 30, 2008 I am using the following script to schedule a task on vista pc from a win2k3 server:$create="schtasks /create /s " & $var & " /ru administrator /rp " & '"xxxxxx"' &" /sc weekly /d tue /tn crude1 /tr c:\Temp\Device.exe /ST 02:00:00"$run="schtasks /run /s " & $var &" /u administrator /p "& '"xxxxxx"' & " /tn " & '"crude1"'$delete="schtasks /delete /s " & $var &" /u administrator /p "& '"xxxxxx"' & " /tn " & '"crude1"' & " /f"Run($delete)sleep(5000)Run($create)sleep(5000)Run($run)sleep(5000)Run($delete)What this script does is that it takes the computer name($var) from an inputbox and schedules a task on that computer to run a compiled autoit script exe (device.exe) located in temp folder of the remote m/c. It creates this task, runs it immediately and deletes it. PROBLEM: My basic problem with this script is that when i try to schedule this task on a vista pc i keep on getting the error: "ERROR: C:\WINDOWS\system32\kernel32.dll". The script runs fine for win xp pro and win2k3 server OS m/cs. The main reason for this maybe that the versions of task scheduler in Vista and Win2k3 /Xp Pro are different. I really need to get around this problem as soon as possible. PSExec is a really big hassle, so if possible please help me find another solution.Thanks. [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com Link to comment Share on other sites More sharing options...
99ojo Posted December 30, 2008 Share Posted December 30, 2008 I am using the following script to schedule a task on vista pc from a win2k3 server:What this script does is that it takes the computer name($var) from an inputbox and schedules a task on that computer to run a compiled autoit script exe (device.exe) located in temp folder of the remote m/c. It creates this task, runs it immediately and deletes it. PROBLEM: My basic problem with this script is that when i try to schedule this task on a vista pc i keep on getting the error: "ERROR: C:\WINDOWS\system32\kernel32.dll". The script runs fine for win xp pro and win2k3 server OS m/cs. The main reason for this maybe that the versions of task scheduler in Vista and Win2k3 /Xp Pro are different. I really need to get around this problem as soon as possible. PSExec is a really big hassle, so if possible please help me find another solution.Thanks.Hi,maybe your problem is UAC on the Vista computer. Try to create/delete the scheduled tasks by WMI.See http://msdn.microsoft.com/en-us/library/aa394399(VS.85).aspx for description. There is a basic WMI Script example which you can simply translate into autoit.;-))Stefan Link to comment Share on other sites More sharing options...
Manjish Posted December 30, 2008 Author Share Posted December 30, 2008 (edited) Hi,maybe your problem is UAC on the Vista computer. Try to create/delete the scheduled tasks by WMI.See http://msdn.microsoft.com/en-us/library/aa394399(VS.85).aspx for description. There is a basic WMI Script example which you can simply translate into autoit.;-))StefanThanks for your reply. I checked out the above link. But it is clearly mentioned in the posts beneath the article, that this is not supported for vista. You can reffer to the following quote to find what I am reffering to:Scheduled tasks don't interact with desktop in Vista Script run "notepad.exe" after 2 minutes in WinXP SP1 it works well and I can see "notepad" on my desktop, but it don't appears in Vista Basic (process "notepad.exe" is exists)That I do not so?t=DateAdd("n",2,time)min=Minute(t)hou=Hour(t)if Len(min)=1 then min="0"&minif Len(hou)=1 then hou="0"&houCreateObject("WbemScripting.SWbemLocator").ConnectServer.get("Win32_ScheduledJob").create "notepad.exe","********"&hou&min&"00.000000+180",1,"","",1I tried out a WMI script which i had for scheduling tasks. Its not working for Vista.Please help me.Thanks Edited December 30, 2008 by Manjish [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now