Problems with executing scheduled script

J

Jim Vierra

Has anyone else tried it on WS2003. I have on two 2003 servers and it says that the "Location" property action on a Put is "Unsupported" It's works on XP and I think, on W2K Server.

--
Jim Vierra

Hi,

from my point of view, this looks like a bug and not a feature ;-)
It make no sense so.

Regards,
Manfred
Sow now that we have beat that dead horse.

Answer this.

WMI can set Win32_Printer.location on XP and not on Windows Server 2003. Why?
It doesn't make sense to have disabled this so why is it disabled?

--
Jim Vierra

Hi Jim,

finally, it looks like, we see it the same way!
And both interfaces have their pros and cons. AT is just simply remotable by the commandline!

Anyway,
best regards,
Manfred
The major difference is only what get into or stays in the registry. The scheduler still runs all of the jobs. I believe it's only ownership that is different.


--
Jim Vierra

Hi,

behind the scene, it is much more complicated. After the "Scheduled task" have been introduced, MS would ensure compatibility with the old and long existing AT interface. So the new engine, represented by the "Task Scheduler Service" has to execute the "old" AT jobs also. You can create AT jobs with the commandline AT command and you'll see this jobs in the tasklist of the "Scheduled Task", but these jobs are executed under the service account [which is normally LocalSystem] and they do not have any users to impersonate to.

You can create a "Scheduled Task" with the taskschedulers GUI and you'll see both jobs, but that one, you've created with the GUI can have assigned an user to which the taskscheduler impersonates the job if it starts. This is not the case for the jobs created by the AT interface or by WMI. If you've created a job with the GUI, go to the commandline and issue an AT command. You will be surprised, but the jobs created with the GUI are NOT there!

On the other hand, if you use the taskschedulers GUI and you see an AT job, you can apply credentials. This essentially will convert the job from a AT job visible with the AT command and executed with LocalSystem, to a new schedulted task, which could have credentials and is finally only visible in the GUI.

Hope, this helps.

Best regards,
Manfred

Look in Task scheduler and it will be there. You can query fr the jobin the scheduler and manage it.

--
Jim Vierra

Hi,

thats just the name MS gave to the wmi-class, which implements this job, this describes the usual "AT" job, not jobs from the TaskScheduler.

BTW, in line:

LogMsg "Job created:strJobName"

I think, this should possibly mean

LogMsg "Job created:" & strJobName

??

Best regards,
Manfred

WHat's wrong with this - It just happens to be called "ScheduleJob instead of ScheduleTask.

Function ScheduleJob( strJobName,strCommand, strTime,strRepeat) 'As Boolean
' call WMI to scedule this job. ,"********012500.000000-420", WMI format
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objNewJob = objWMIService.Get("Win32_ScheduledJob")
errJobCreated = objNewJob.Create(strCommand,strTime,True , 4, strRepeat, True, JobId)
If errJobCreated <> 0 Then
Select Case errJobCreated
Case 1 : strErr = "Incorrect function called or unknown function called."
Case 10 : strErr = "The environment is incorrect."
Case &H8009000f: strErr = "General Access denied "
End Select
LogMsg "Error on task creation - " & strErr
ScheduleJob = False
Else
LogMsg "Job created:strJobName"
ScheduleJob = True
End If
End Function


--
Jim Vierra

Manfred Braun said:
Hi,

thats not possible! I am not too sure, but I can imagine, that setting a
null-session-share on the machine, which hosts your script, would help. But
if you create a scheduled task remotely, why not copying the script to
execute also onto the machine, which executes your task?

As I mentioned, there is also, the "JT.EXE" from the Resource Kit, which
could create the Scheduled Task on the target machine, it can also set the
credentials for that task.

Here a sample output from "JT.EXE" from my box:
[TRACE] Enumerating jobs and queues
AutoStart.job
Jo.job
m1--AllProfiles.job
NetMsg.job
PseudoCreateUserProfile1.job
RunAsMB.job
W2KP-E-OfflineBackup-20050531.job
xxcopy.job

May be, that helps.

I personally would really like to see a WMI class for the "Scheduled Task"
... ;-)
even better would be a new solution, because the Task Scheduler is not
cluster-enabled :-(

Best regards,
Manfred

haai said:
Hi

Thanks for your advice.
Do you know where I can edit the user-rights of the "system"-account?
Maybe I can fix the problem by that?

Mathias.
 
M

Manfred Braun

Hi Jim,

but no, I never tried this, sorry.

Manfred
Has anyone else tried it on WS2003. I have on two 2003 servers and it says that the "Location" property action on a Put is "Unsupported" It's works on XP and I think, on W2K Server.

--
Jim Vierra

Hi,

from my point of view, this looks like a bug and not a feature ;-)
It make no sense so.

Regards,
Manfred
Sow now that we have beat that dead horse.

Answer this.

WMI can set Win32_Printer.location on XP and not on Windows Server 2003. Why?
It doesn't make sense to have disabled this so why is it disabled?

--
Jim Vierra

Hi Jim,

finally, it looks like, we see it the same way!
And both interfaces have their pros and cons. AT is just simply remotable by the commandline!

Anyway,
best regards,
Manfred
The major difference is only what get into or stays in the registry. The scheduler still runs all of the jobs. I believe it's only ownership that is different.


--
Jim Vierra

Hi,

behind the scene, it is much more complicated. After the "Scheduled task" have been introduced, MS would ensure compatibility with the old and long existing AT interface. So the new engine, represented by the "Task Scheduler Service" has to execute the "old" AT jobs also. You can create AT jobs with the commandline AT command and you'll see this jobs in the tasklist of the "Scheduled Task", but these jobs are executed under the service account [which is normally LocalSystem] and they do not have any users to impersonate to.

You can create a "Scheduled Task" with the taskschedulers GUI and you'll see both jobs, but that one, you've created with the GUI can have assigned an user to which the taskscheduler impersonates the job if it starts. This is not the case for the jobs created by the AT interface or by WMI. If you've created a job with the GUI, go to the commandline and issue an AT command. You will be surprised, but the jobs created with the GUI are NOT there!

On the other hand, if you use the taskschedulers GUI and you see an AT job, you can apply credentials. This essentially will convert the job from a AT job visible with the AT command and executed with LocalSystem, to a new schedulted task, which could have credentials and is finally only visible in the GUI.

Hope, this helps.

Best regards,
Manfred

Look in Task scheduler and it will be there. You can query fr the jobin the scheduler and manage it.

--
Jim Vierra

Hi,

thats just the name MS gave to the wmi-class, which implements this job, this describes the usual "AT" job, not jobs from the TaskScheduler.

BTW, in line:

LogMsg "Job created:strJobName"

I think, this should possibly mean

LogMsg "Job created:" & strJobName

??

Best regards,
Manfred

WHat's wrong with this - It just happens to be called "ScheduleJob instead of ScheduleTask.

Function ScheduleJob( strJobName,strCommand, strTime,strRepeat) 'As Boolean
' call WMI to scedule this job. ,"********012500.000000-420", WMI format
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objNewJob = objWMIService.Get("Win32_ScheduledJob")
errJobCreated = objNewJob.Create(strCommand,strTime,True , 4, strRepeat, True, JobId)
If errJobCreated <> 0 Then
Select Case errJobCreated
Case 1 : strErr = "Incorrect function called or unknown function called."
Case 10 : strErr = "The environment is incorrect."
Case &H8009000f: strErr = "General Access denied "
End Select
LogMsg "Error on task creation - " & strErr
ScheduleJob = False
Else
LogMsg "Job created:strJobName"
ScheduleJob = True
End If
End Function


--
Jim Vierra

Manfred Braun said:
Hi,

thats not possible! I am not too sure, but I can imagine, that setting a
null-session-share on the machine, which hosts your script, would help. But
if you create a scheduled task remotely, why not copying the script to
execute also onto the machine, which executes your task?

As I mentioned, there is also, the "JT.EXE" from the Resource Kit, which
could create the Scheduled Task on the target machine, it can also set the
credentials for that task.

Here a sample output from "JT.EXE" from my box:
[TRACE] Enumerating jobs and queues
AutoStart.job
Jo.job
m1--AllProfiles.job
NetMsg.job
PseudoCreateUserProfile1.job
RunAsMB.job
W2KP-E-OfflineBackup-20050531.job
xxcopy.job

May be, that helps.

I personally would really like to see a WMI class for the "Scheduled Task"
... ;-)
even better would be a new solution, because the Task Scheduler is not
cluster-enabled :-(

Best regards,
Manfred

haai said:
Hi

Thanks for your advice.
Do you know where I can edit the user-rights of the "system"-account?
Maybe I can fix the problem by that?

Mathias.
 
J

Jim Vierra

I'm getting irked! No one at MS will "cop" to this. Most of us feel that it is a bug - but no response.

I just tagged it on here because everyone was being so "silent".

--
Jim Vierra

Hi Jim,

but no, I never tried this, sorry.

Manfred
Has anyone else tried it on WS2003. I have on two 2003 servers and it says that the "Location" property action on a Put is "Unsupported" It's works on XP and I think, on W2K Server.

--
Jim Vierra

Hi,

from my point of view, this looks like a bug and not a feature ;-)
It make no sense so.

Regards,
Manfred
Sow now that we have beat that dead horse.

Answer this.

WMI can set Win32_Printer.location on XP and not on Windows Server 2003. Why?
It doesn't make sense to have disabled this so why is it disabled?

--
Jim Vierra

Hi Jim,

finally, it looks like, we see it the same way!
And both interfaces have their pros and cons. AT is just simply remotable by the commandline!

Anyway,
best regards,
Manfred
The major difference is only what get into or stays in the registry. The scheduler still runs all of the jobs. I believe it's only ownership that is different.


--
Jim Vierra

Hi,

behind the scene, it is much more complicated. After the "Scheduled task" have been introduced, MS would ensure compatibility with the old and long existing AT interface. So the new engine, represented by the "Task Scheduler Service" has to execute the "old" AT jobs also. You can create AT jobs with the commandline AT command and you'll see this jobs in the tasklist of the "Scheduled Task", but these jobs are executed under the service account [which is normally LocalSystem] and they do not have any users to impersonate to.

You can create a "Scheduled Task" with the taskschedulers GUI and you'll see both jobs, but that one, you've created with the GUI can have assigned an user to which the taskscheduler impersonates the job if it starts. This is not the case for the jobs created by the AT interface or by WMI. If you've created a job with the GUI, go to the commandline and issue an AT command. You will be surprised, but the jobs created with the GUI are NOT there!

On the other hand, if you use the taskschedulers GUI and you see an AT job, you can apply credentials. This essentially will convert the job from a AT job visible with the AT command and executed with LocalSystem, to a new schedulted task, which could have credentials and is finally only visible in the GUI.

Hope, this helps.

Best regards,
Manfred

Look in Task scheduler and it will be there. You can query fr the jobin the scheduler and manage it.

--
Jim Vierra

Hi,

thats just the name MS gave to the wmi-class, which implements this job, this describes the usual "AT" job, not jobs from the TaskScheduler.

BTW, in line:

LogMsg "Job created:strJobName"

I think, this should possibly mean

LogMsg "Job created:" & strJobName

??

Best regards,
Manfred

WHat's wrong with this - It just happens to be called "ScheduleJob instead of ScheduleTask.

Function ScheduleJob( strJobName,strCommand, strTime,strRepeat) 'As Boolean
' call WMI to scedule this job. ,"********012500.000000-420", WMI format
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objNewJob = objWMIService.Get("Win32_ScheduledJob")
errJobCreated = objNewJob.Create(strCommand,strTime,True , 4, strRepeat, True, JobId)
If errJobCreated <> 0 Then
Select Case errJobCreated
Case 1 : strErr = "Incorrect function called or unknown function called."
Case 10 : strErr = "The environment is incorrect."
Case &H8009000f: strErr = "General Access denied "
End Select
LogMsg "Error on task creation - " & strErr
ScheduleJob = False
Else
LogMsg "Job created:strJobName"
ScheduleJob = True
End If
End Function


--
Jim Vierra

Manfred Braun said:
Hi,

thats not possible! I am not too sure, but I can imagine, that setting a
null-session-share on the machine, which hosts your script, would help. But
if you create a scheduled task remotely, why not copying the script to
execute also onto the machine, which executes your task?

As I mentioned, there is also, the "JT.EXE" from the Resource Kit, which
could create the Scheduled Task on the target machine, it can also set the
credentials for that task.

Here a sample output from "JT.EXE" from my box:
[TRACE] Enumerating jobs and queues
AutoStart.job
Jo.job
m1--AllProfiles.job
NetMsg.job
PseudoCreateUserProfile1.job
RunAsMB.job
W2KP-E-OfflineBackup-20050531.job
xxcopy.job

May be, that helps.

I personally would really like to see a WMI class for the "Scheduled Task"
... ;-)
even better would be a new solution, because the Task Scheduler is not
cluster-enabled :-(

Best regards,
Manfred

haai said:
Hi

Thanks for your advice.
Do you know where I can edit the user-rights of the "system"-account?
Maybe I can fix the problem by that?

Mathias.
 
J

Jim Vierra

Thankyou Manfred. Yes, CodeProject is quite good. Didn't think to look
there. Did find schddtask in the resource kit. It can't be run remotely
except with "remote" on XP and 2003 and, I suspect, with WMI command.

--
Jim Vierra

Manfred Braun said:
Jim,

have you looked at google?? ;-)

I do not know excactly about membership on http://www.codeproject.com, but
there, I found the following references:

http://www.codeproject.com/csharp/taskschedulerlibrary.asp
http://www.codeproject.com/csharp/tsnewlib.asp

"Naturally", they offer the source too. It's not VB, it's C#, but you can
just use the libraries. I personally find it a pain to maintain my own
class
library - which is only needed for my admin jobs !! - and to have/deploy
this on all boxes, I ever work with.

The taskscheduler is not well supported by MS and possibly more importent,
it is not "cluster-aware" !!!!!! Wether WMi nor CLR do have any support
for
this :-(

So I can only still repeat my humble opinion [which is already somewhere
within this thread ;-) ], that there should come a new supported solution
....

Hope, this helps!

Best regards,
Manfred

Jim Vierra said:
So who has a COM wrapper for mstask.dll?

I set out to build one but VB Express doesn't have support and I don't have
VB6 loaded at this time. It's fairly straight forward. Only a half
dozen
interfaces to set up and it could be callable from scripts. I don't
understand why MS didn't build it.

--
Jim Vierra


Morten schreef:

Hi

The problem is, in wmi with this method:
Set objNewJob = objWMIService.Get("Win32_Sched­uledJob")
errJobCreated = objNewJob.Create ....

It isn't possible to say which user has to execute the script.
The alternative of Manfred Braun is ok, with the dll-files, but than I
have to run the command with wshshell.exec, and that gives some
problems :-(

Best regards

Mathias
 
M

Manfred Braun

Hi Jim,

that's MS-life, sorry, sometimes I am very cynic about some behavior, because the most of us and I don't exclude me from that type of people, try thiere best to use MS technology that naturally has to include that it is allows to talk about bug.

The MS people in the groups, so I am quit sure, do their best to support us;But it is like everywhere:It just business.....

I made three tries inside the wmi newsgroup to get an answer of a question about WMI connections and I've done this via "supported newsgroup" [I am universal MSDN abonnent and this type of support is part of the contract], but never got an answer. I am under "havvy" stress in the company, so I don't find [yet] the time to call MSN by phone and make my complaint.

I am sorry that I do not have a Windows 2003 Server at home to make a test to help you.

Best regards,
Manfred

I'm getting irked! No one at MS will "cop" to this. Most of us feel that it is a bug - but no response.

I just tagged it on here because everyone was being so "silent".

--
Jim Vierra

Hi Jim,

but no, I never tried this, sorry.

Manfred
Has anyone else tried it on WS2003. I have on two 2003 servers and it says that the "Location" property action on a Put is "Unsupported" It's works on XP and I think, on W2K Server.

--
Jim Vierra

Hi,

from my point of view, this looks like a bug and not a feature ;-)
It make no sense so.

Regards,
Manfred
Sow now that we have beat that dead horse.

Answer this.

WMI can set Win32_Printer.location on XP and not on Windows Server 2003. Why?
It doesn't make sense to have disabled this so why is it disabled?

--
Jim Vierra

Hi Jim,

finally, it looks like, we see it the same way!
And both interfaces have their pros and cons. AT is just simply remotable by the commandline!

Anyway,
best regards,
Manfred
The major difference is only what get into or stays in the registry. The scheduler still runs all of the jobs. I believe it's only ownership that is different.


--
Jim Vierra

Hi,

behind the scene, it is much more complicated. After the "Scheduled task" have been introduced, MS would ensure compatibility with the old and long existing AT interface. So the new engine, represented by the "Task Scheduler Service" has to execute the "old" AT jobs also. You can create AT jobs with the commandline AT command and you'll see this jobs in the tasklist of the "Scheduled Task", but these jobs are executed under the service account [which is normally LocalSystem] and they do not have any users to impersonate to.

You can create a "Scheduled Task" with the taskschedulers GUI and you'll see both jobs, but that one, you've created with the GUI can have assigned an user to which the taskscheduler impersonates the job if it starts. This is not the case for the jobs created by the AT interface or by WMI. If you've created a job with the GUI, go to the commandline and issue an AT command. You will be surprised, but the jobs created with the GUI are NOT there!

On the other hand, if you use the taskschedulers GUI and you see an AT job, you can apply credentials. This essentially will convert the job from a AT job visible with the AT command and executed with LocalSystem, to a new schedulted task, which could have credentials and is finally only visible in the GUI.

Hope, this helps.

Best regards,
Manfred

Look in Task scheduler and it will be there. You can query fr the jobin the scheduler and manage it.

--
Jim Vierra

Hi,

thats just the name MS gave to the wmi-class, which implements this job, this describes the usual "AT" job, not jobs from the TaskScheduler.

BTW, in line:

LogMsg "Job created:strJobName"

I think, this should possibly mean

LogMsg "Job created:" & strJobName

??

Best regards,
Manfred

WHat's wrong with this - It just happens to be called "ScheduleJob instead of ScheduleTask.

Function ScheduleJob( strJobName,strCommand, strTime,strRepeat) 'As Boolean
' call WMI to scedule this job. ,"********012500.000000-420", WMI format
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objNewJob = objWMIService.Get("Win32_ScheduledJob")
errJobCreated = objNewJob.Create(strCommand,strTime,True , 4, strRepeat, True, JobId)
If errJobCreated <> 0 Then
Select Case errJobCreated
Case 1 : strErr = "Incorrect function called or unknown function called."
Case 10 : strErr = "The environment is incorrect."
Case &H8009000f: strErr = "General Access denied "
End Select
LogMsg "Error on task creation - " & strErr
ScheduleJob = False
Else
LogMsg "Job created:strJobName"
ScheduleJob = True
End If
End Function


--
Jim Vierra

Manfred Braun said:
Hi,

thats not possible! I am not too sure, but I can imagine, that setting a
null-session-share on the machine, which hosts your script, would help. But
if you create a scheduled task remotely, why not copying the script to
execute also onto the machine, which executes your task?

As I mentioned, there is also, the "JT.EXE" from the Resource Kit, which
could create the Scheduled Task on the target machine, it can also set the
credentials for that task.

Here a sample output from "JT.EXE" from my box:
[TRACE] Enumerating jobs and queues
AutoStart.job
Jo.job
m1--AllProfiles.job
NetMsg.job
PseudoCreateUserProfile1.job
RunAsMB.job
W2KP-E-OfflineBackup-20050531.job
xxcopy.job

May be, that helps.

I personally would really like to see a WMI class for the "Scheduled Task"
... ;-)
even better would be a new solution, because the Task Scheduler is not
cluster-enabled :-(

Best regards,
Manfred

haai said:
Hi

Thanks for your advice.
Do you know where I can edit the user-rights of the "system"-account?
Maybe I can fix the problem by that?

Mathias.
 
J

Jim Vierra

Manfred - thanks for the interest. I was only half serious in my jibe. I know this is an unusual issue but it is interesting as it could quickly sole the printer location misconfigurations that we find but it won't work on 2003 for some reason.

Keep you ear to the ground and maybe something will pop up. It's not a crisis so I will keep poking around. I may try to modify the mof and see if it will work.

--
Jim Vierra

Hi Jim,

that's MS-life, sorry, sometimes I am very cynic about some behavior, because the most of us and I don't exclude me from that type of people, try thiere best to use MS technology that naturally has to include that it is allows to talk about bug.

The MS people in the groups, so I am quit sure, do their best to support us;But it is like everywhere:It just business.....

I made three tries inside the wmi newsgroup to get an answer of a question about WMI connections and I've done this via "supported newsgroup" [I am universal MSDN abonnent and this type of support is part of the contract], but never got an answer. I am under "havvy" stress in the company, so I don't find [yet] the time to call MSN by phone and make my complaint.

I am sorry that I do not have a Windows 2003 Server at home to make a test to help you.

Best regards,
Manfred

I'm getting irked! No one at MS will "cop" to this. Most of us feel that it is a bug - but no response.

I just tagged it on here because everyone was being so "silent".

--
Jim Vierra

Hi Jim,

but no, I never tried this, sorry.

Manfred
Has anyone else tried it on WS2003. I have on two 2003 servers and it says that the "Location" property action on a Put is "Unsupported" It's works on XP and I think, on W2K Server.

--
Jim Vierra

Hi,

from my point of view, this looks like a bug and not a feature ;-)
It make no sense so.

Regards,
Manfred
Sow now that we have beat that dead horse.

Answer this.

WMI can set Win32_Printer.location on XP and not on Windows Server 2003. Why?
It doesn't make sense to have disabled this so why is it disabled?

--
Jim Vierra

Hi Jim,

finally, it looks like, we see it the same way!
And both interfaces have their pros and cons. AT is just simply remotable by the commandline!

Anyway,
best regards,
Manfred
The major difference is only what get into or stays in the registry. The scheduler still runs all of the jobs. I believe it's only ownership that is different.


--
Jim Vierra

Hi,

behind the scene, it is much more complicated. After the "Scheduled task" have been introduced, MS would ensure compatibility with the old and long existing AT interface. So the new engine, represented by the "Task Scheduler Service" has to execute the "old" AT jobs also. You can create AT jobs with the commandline AT command and you'll see this jobs in the tasklist of the "Scheduled Task", but these jobs are executed under the service account [which is normally LocalSystem] and they do not have any users to impersonate to.

You can create a "Scheduled Task" with the taskschedulers GUI and you'll see both jobs, but that one, you've created with the GUI can have assigned an user to which the taskscheduler impersonates the job if it starts. This is not the case for the jobs created by the AT interface or by WMI. If you've created a job with the GUI, go to the commandline and issue an AT command. You will be surprised, but the jobs created with the GUI are NOT there!

On the other hand, if you use the taskschedulers GUI and you see an AT job, you can apply credentials. This essentially will convert the job from a AT job visible with the AT command and executed with LocalSystem, to a new schedulted task, which could have credentials and is finally only visible in the GUI.

Hope, this helps.

Best regards,
Manfred

Look in Task scheduler and it will be there. You can query fr the jobin the scheduler and manage it.

--
Jim Vierra

Hi,

thats just the name MS gave to the wmi-class, which implements this job, this describes the usual "AT" job, not jobs from the TaskScheduler.

BTW, in line:

LogMsg "Job created:strJobName"

I think, this should possibly mean

LogMsg "Job created:" & strJobName

??

Best regards,
Manfred

WHat's wrong with this - It just happens to be called "ScheduleJob instead of ScheduleTask.

Function ScheduleJob( strJobName,strCommand, strTime,strRepeat) 'As Boolean
' call WMI to scedule this job. ,"********012500.000000-420", WMI format
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objNewJob = objWMIService.Get("Win32_ScheduledJob")
errJobCreated = objNewJob.Create(strCommand,strTime,True , 4, strRepeat, True, JobId)
If errJobCreated <> 0 Then
Select Case errJobCreated
Case 1 : strErr = "Incorrect function called or unknown function called."
Case 10 : strErr = "The environment is incorrect."
Case &H8009000f: strErr = "General Access denied "
End Select
LogMsg "Error on task creation - " & strErr
ScheduleJob = False
Else
LogMsg "Job created:strJobName"
ScheduleJob = True
End If
End Function


--
Jim Vierra

Manfred Braun said:
Hi,

thats not possible! I am not too sure, but I can imagine, that setting a
null-session-share on the machine, which hosts your script, would help. But
if you create a scheduled task remotely, why not copying the script to
execute also onto the machine, which executes your task?

As I mentioned, there is also, the "JT.EXE" from the Resource Kit, which
could create the Scheduled Task on the target machine, it can also set the
credentials for that task.

Here a sample output from "JT.EXE" from my box:
[TRACE] Enumerating jobs and queues
AutoStart.job
Jo.job
m1--AllProfiles.job
NetMsg.job
PseudoCreateUserProfile1.job
RunAsMB.job
W2KP-E-OfflineBackup-20050531.job
xxcopy.job

May be, that helps.

I personally would really like to see a WMI class for the "Scheduled Task"
... ;-)
even better would be a new solution, because the Task Scheduler is not
cluster-enabled :-(

Best regards,
Manfred

haai said:
Hi

Thanks for your advice.
Do you know where I can edit the user-rights of the "system"-account?
Maybe I can fix the problem by that?

Mathias.
 
M

Manfred Braun

Hello Jim,

sorry, I am very late .... hopefully, you'll read this.

So far I remember, in this or another therad about this theme, I mentioned
the JT.EXE tool from the "Windows 2000 Resource Kit", this tool can do this:
jt /sm \\mb-m100 /se
[TRACE] Setting target computer to '\\mb-m100'
[TRACE] Enumerating jobs and queues
TestJob1.job

[To find the right syntax for a given command can really give a nightmare
with this tool, I know :-( ]

Hope, this helps!
Manfred

Jim Vierra said:
Thankyou Manfred. Yes, CodeProject is quite good. Didn't think to look
there. Did find schddtask in the resource kit. It can't be run remotely
except with "remote" on XP and 2003 and, I suspect, with WMI command.

--
Jim Vierra

Manfred Braun said:
Jim,

have you looked at google?? ;-)

I do not know excactly about membership on http://www.codeproject.com, but
there, I found the following references:

http://www.codeproject.com/csharp/taskschedulerlibrary.asp
http://www.codeproject.com/csharp/tsnewlib.asp

"Naturally", they offer the source too. It's not VB, it's C#, but you can
just use the libraries. I personally find it a pain to maintain my own
class
library - which is only needed for my admin jobs !! - and to have/deploy
this on all boxes, I ever work with.

The taskscheduler is not well supported by MS and possibly more importent,
it is not "cluster-aware" !!!!!! Wether WMi nor CLR do have any support
for
this :-(

So I can only still repeat my humble opinion [which is already somewhere
within this thread ;-) ], that there should come a new supported solution
....

Hope, this helps!

Best regards,
Manfred

Jim Vierra said:
So who has a COM wrapper for mstask.dll?

I set out to build one but VB Express doesn't have support and I don't have
VB6 loaded at this time. It's fairly straight forward. Only a half
dozen
interfaces to set up and it could be callable from scripts. I don't
understand why MS didn't build it.

--
Jim Vierra


Morten schreef:
Hi!

It might work if you execute the script as a user that exists (same
user
name and password) on all your servers. The user would need admin
rights.

Best regards

Morten


Hi

The problem is, in wmi with this method:
Set objNewJob = objWMIService.Get("Win32_Sched­uledJob")
errJobCreated = objNewJob.Create ....

It isn't possible to say which user has to execute the script.
The alternative of Manfred Braun is ok, with the dll-files, but than I
have to run the command with wshshell.exec, and that gives some
problems :-(

Best regards

Mathias
 
J

Jim Vierra

Hi Manfred. Thanks for the update.

I went through every copy of Windows Resource Kit Tools and cannot find any
reference to JT.EXE.

Are you sure you didn't get it from somewhere else?

--
Jim Vierra

Manfred Braun said:
Hello Jim,

sorry, I am very late .... hopefully, you'll read this.

So far I remember, in this or another therad about this theme, I mentioned
the JT.EXE tool from the "Windows 2000 Resource Kit", this tool can do
this:
jt /sm \\mb-m100 /se
[TRACE] Setting target computer to '\\mb-m100'
[TRACE] Enumerating jobs and queues
TestJob1.job

[To find the right syntax for a given command can really give a nightmare
with this tool, I know :-( ]

Hope, this helps!
Manfred

Jim Vierra said:
Thankyou Manfred. Yes, CodeProject is quite good. Didn't think to look
there. Did find schddtask in the resource kit. It can't be run remotely
except with "remote" on XP and 2003 and, I suspect, with WMI command.

--
Jim Vierra

Manfred Braun said:
Jim,

have you looked at google?? ;-)

I do not know excactly about membership on http://www.codeproject.com, but
there, I found the following references:

http://www.codeproject.com/csharp/taskschedulerlibrary.asp
http://www.codeproject.com/csharp/tsnewlib.asp

"Naturally", they offer the source too. It's not VB, it's C#, but you can
just use the libraries. I personally find it a pain to maintain my own
class
library - which is only needed for my admin jobs !! - and to
have/deploy
this on all boxes, I ever work with.

The taskscheduler is not well supported by MS and possibly more importent,
it is not "cluster-aware" !!!!!! Wether WMi nor CLR do have any support
for
this :-(

So I can only still repeat my humble opinion [which is already
somewhere
within this thread ;-) ], that there should come a new supported solution
....

Hope, this helps!

Best regards,
Manfred

So who has a COM wrapper for mstask.dll?

I set out to build one but VB Express doesn't have support and I don't
have
VB6 loaded at this time. It's fairly straight forward. Only a half
dozen
interfaces to set up and it could be callable from scripts. I don't
understand why MS didn't build it.

--
Jim Vierra


Morten schreef:
Hi!

It might work if you execute the script as a user that exists (same
user
name and password) on all your servers. The user would need admin
rights.

Best regards

Morten


Hi

The problem is, in wmi with this method:
Set objNewJob = objWMIService.Get("Win32_Sched­uledJob")
errJobCreated = objNewJob.Create ....

It isn't possible to say which user has to execute the script.
The alternative of Manfred Braun is ok, with the dll-files, but than I
have to run the command with wshshell.exec, and that gives some
problems :-(

Best regards

Mathias
 
M

Manfred Braun

Hmm,

I do not really have another info, but in my own ResKit it is also missing.
But I have a link: ftp://ftp.microsoft.com/reskit/win2000/ (look for
JT.ZIP).

Best regards,
Manfred

Jim Vierra said:
Hi Manfred. Thanks for the update.

I went through every copy of Windows Resource Kit Tools and cannot find any
reference to JT.EXE.

Are you sure you didn't get it from somewhere else?

--
Jim Vierra

Manfred Braun said:
Hello Jim,

sorry, I am very late .... hopefully, you'll read this.

So far I remember, in this or another therad about this theme, I mentioned
the JT.EXE tool from the "Windows 2000 Resource Kit", this tool can do
this:
jt /sm \\mb-m100 /se
[TRACE] Setting target computer to '\\mb-m100'
[TRACE] Enumerating jobs and queues
TestJob1.job

[To find the right syntax for a given command can really give a nightmare
with this tool, I know :-( ]

Hope, this helps!
Manfred

Jim Vierra said:
Thankyou Manfred. Yes, CodeProject is quite good. Didn't think to look
there. Did find schddtask in the resource kit. It can't be run remotely
except with "remote" on XP and 2003 and, I suspect, with WMI command.

--
Jim Vierra

Jim,

have you looked at google?? ;-)

I do not know excactly about membership on
http://www.codeproject.com,
but
there, I found the following references:

http://www.codeproject.com/csharp/taskschedulerlibrary.asp
http://www.codeproject.com/csharp/tsnewlib.asp

"Naturally", they offer the source too. It's not VB, it's C#, but you can
just use the libraries. I personally find it a pain to maintain my own
class
library - which is only needed for my admin jobs !! - and to
have/deploy
this on all boxes, I ever work with.

The taskscheduler is not well supported by MS and possibly more importent,
it is not "cluster-aware" !!!!!! Wether WMi nor CLR do have any support
for
this :-(

So I can only still repeat my humble opinion [which is already
somewhere
within this thread ;-) ], that there should come a new supported solution
....

Hope, this helps!

Best regards,
Manfred

So who has a COM wrapper for mstask.dll?

I set out to build one but VB Express doesn't have support and I don't
have
VB6 loaded at this time. It's fairly straight forward. Only a half
dozen
interfaces to set up and it could be callable from scripts. I don't
understand why MS didn't build it.

--
Jim Vierra


Morten schreef:
Hi!

It might work if you execute the script as a user that exists (same
user
name and password) on all your servers. The user would need admin
rights.

Best regards

Morten


Hi

The problem is, in wmi with this method:
Set objNewJob = objWMIService.Get("Win32_Sched­uledJob")
errJobCreated = objNewJob.Create ....

It isn't possible to say which user has to execute the script.
The alternative of Manfred Braun is ok, with the dll-files, but than I
have to run the command with wshshell.exec, and that gives some
problems :-(

Best regards

Mathias
 
J

Jim Vierra

Manfred - Thanks.

Great little utility for managing tasks. Too bad it doesn't have a COM
interface. Still - it should come in very handy.

--
Jim Vierra

Manfred Braun said:
Hmm,

I do not really have another info, but in my own ResKit it is also
missing.
But I have a link: ftp://ftp.microsoft.com/reskit/win2000/ (look for
JT.ZIP).

Best regards,
Manfred

Jim Vierra said:
Hi Manfred. Thanks for the update.

I went through every copy of Windows Resource Kit Tools and cannot find any
reference to JT.EXE.

Are you sure you didn't get it from somewhere else?

--
Jim Vierra

Manfred Braun said:
Hello Jim,

sorry, I am very late .... hopefully, you'll read this.

So far I remember, in this or another therad about this theme, I mentioned
the JT.EXE tool from the "Windows 2000 Resource Kit", this tool can do
this:

jt /sm \\mb-m100 /se
[TRACE] Setting target computer to '\\mb-m100'
[TRACE] Enumerating jobs and queues
TestJob1.job

[To find the right syntax for a given command can really give a nightmare
with this tool, I know :-( ]

Hope, this helps!
Manfred

Thankyou Manfred. Yes, CodeProject is quite good. Didn't think to look
there. Did find schddtask in the resource kit. It can't be run remotely
except with "remote" on XP and 2003 and, I suspect, with WMI command.

--
Jim Vierra

Jim,

have you looked at google?? ;-)

I do not know excactly about membership on http://www.codeproject.com,
but
there, I found the following references:

http://www.codeproject.com/csharp/taskschedulerlibrary.asp
http://www.codeproject.com/csharp/tsnewlib.asp

"Naturally", they offer the source too. It's not VB, it's C#, but
you
can
just use the libraries. I personally find it a pain to maintain my own
class
library - which is only needed for my admin jobs !! - and to
have/deploy
this on all boxes, I ever work with.

The taskscheduler is not well supported by MS and possibly more
importent,
it is not "cluster-aware" !!!!!! Wether WMi nor CLR do have any support
for
this :-(

So I can only still repeat my humble opinion [which is already
somewhere
within this thread ;-) ], that there should come a new supported
solution
....

Hope, this helps!

Best regards,
Manfred

So who has a COM wrapper for mstask.dll?

I set out to build one but VB Express doesn't have support and I don't
have
VB6 loaded at this time. It's fairly straight forward. Only a
half
dozen
interfaces to set up and it could be callable from scripts. I
don't
understand why MS didn't build it.

--
Jim Vierra


Morten schreef:
Hi!

It might work if you execute the script as a user that exists (same
user
name and password) on all your servers. The user would need admin
rights.

Best regards

Morten


Hi

The problem is, in wmi with this method:
Set objNewJob = objWMIService.Get("Win32_Sched­uledJob")
errJobCreated = objNewJob.Create ....

It isn't possible to say which user has to execute the script.
The alternative of Manfred Braun is ok, with the dll-files, but
than I
have to run the command with wshshell.exec, and that gives some
problems :-(

Best regards

Mathias
 
M

Manfred Braun

Hi Jim,

hope it helps! But do you remember the other two COM interfaces I pointed to
in my threads entry [see my first entry to this thread]!!!!

Best regards,
Manfred

Jim Vierra said:
Manfred - Thanks.

Great little utility for managing tasks. Too bad it doesn't have a COM
interface. Still - it should come in very handy.

--
Jim Vierra

Manfred Braun said:
Hmm,

I do not really have another info, but in my own ResKit it is also
missing.
But I have a link: ftp://ftp.microsoft.com/reskit/win2000/ (look for
JT.ZIP).

Best regards,
Manfred

Jim Vierra said:
Hi Manfred. Thanks for the update.

I went through every copy of Windows Resource Kit Tools and cannot find any
reference to JT.EXE.

Are you sure you didn't get it from somewhere else?

--
Jim Vierra

Hello Jim,

sorry, I am very late .... hopefully, you'll read this.

So far I remember, in this or another therad about this theme, I mentioned
the JT.EXE tool from the "Windows 2000 Resource Kit", this tool can do
this:

jt /sm \\mb-m100 /se
[TRACE] Setting target computer to '\\mb-m100'
[TRACE] Enumerating jobs and queues
TestJob1.job

[To find the right syntax for a given command can really give a nightmare
with this tool, I know :-( ]

Hope, this helps!
Manfred

Thankyou Manfred. Yes, CodeProject is quite good. Didn't think to look
there. Did find schddtask in the resource kit. It can't be run remotely
except with "remote" on XP and 2003 and, I suspect, with WMI command.

--
Jim Vierra

Jim,

have you looked at google?? ;-)

I do not know excactly about membership on http://www.codeproject.com,
but
there, I found the following references:

http://www.codeproject.com/csharp/taskschedulerlibrary.asp
http://www.codeproject.com/csharp/tsnewlib.asp

"Naturally", they offer the source too. It's not VB, it's C#, but
you
can
just use the libraries. I personally find it a pain to maintain my own
class
library - which is only needed for my admin jobs !! - and to
have/deploy
this on all boxes, I ever work with.

The taskscheduler is not well supported by MS and possibly more
importent,
it is not "cluster-aware" !!!!!! Wether WMi nor CLR do have any support
for
this :-(

So I can only still repeat my humble opinion [which is already
somewhere
within this thread ;-) ], that there should come a new supported
solution
....

Hope, this helps!

Best regards,
Manfred

So who has a COM wrapper for mstask.dll?

I set out to build one but VB Express doesn't have support and I don't
have
VB6 loaded at this time. It's fairly straight forward. Only a
half
dozen
interfaces to set up and it could be callable from scripts. I
don't
understand why MS didn't build it.

--
Jim Vierra


Morten schreef:
Hi!

It might work if you execute the script as a user that exists (same
user
name and password) on all your servers. The user would need admin
rights.

Best regards

Morten


Hi

The problem is, in wmi with this method:
Set objNewJob = objWMIService.Get("Win32_Sched­uledJob")
errJobCreated = objNewJob.Create ....

It isn't possible to say which user has to execute the script.
The alternative of Manfred Braun is ok, with the dll-files, but
than I
have to run the command with wshshell.exec, and that gives some
problems :-(

Best regards

Mathias
 
J

Jim Vierra

Thanks Manfred.

I think I will re-do this in VS2005 as soon as I get it installed. Have to
build a straight COM wrapper for the API and it will have to be installed
remotely to work. Need to secure it too. Call it a distributed job
scheduler.

--
Jim Vierra

Manfred Braun said:
Hi Jim,

hope it helps! But do you remember the other two COM interfaces I pointed
to
in my threads entry [see my first entry to this thread]!!!!

Best regards,
Manfred

Jim Vierra said:
Manfred - Thanks.

Great little utility for managing tasks. Too bad it doesn't have a COM
interface. Still - it should come in very handy.

--
Jim Vierra

Manfred Braun said:
Hmm,

I do not really have another info, but in my own ResKit it is also
missing.
But I have a link: ftp://ftp.microsoft.com/reskit/win2000/ (look for
JT.ZIP).

Best regards,
Manfred

Hi Manfred. Thanks for the update.

I went through every copy of Windows Resource Kit Tools and cannot
find
any
reference to JT.EXE.

Are you sure you didn't get it from somewhere else?

--
Jim Vierra

Hello Jim,

sorry, I am very late .... hopefully, you'll read this.

So far I remember, in this or another therad about this theme, I
mentioned
the JT.EXE tool from the "Windows 2000 Resource Kit", this tool can do
this:

jt /sm \\mb-m100 /se
[TRACE] Setting target computer to '\\mb-m100'
[TRACE] Enumerating jobs and queues
TestJob1.job

[To find the right syntax for a given command can really give a
nightmare
with this tool, I know :-( ]

Hope, this helps!
Manfred

Thankyou Manfred. Yes, CodeProject is quite good. Didn't think to
look
there. Did find schddtask in the resource kit. It can't be run
remotely
except with "remote" on XP and 2003 and, I suspect, with WMI command.

--
Jim Vierra

Jim,

have you looked at google?? ;-)

I do not know excactly about membership on
http://www.codeproject.com,
but
there, I found the following references:

http://www.codeproject.com/csharp/taskschedulerlibrary.asp
http://www.codeproject.com/csharp/tsnewlib.asp

"Naturally", they offer the source too. It's not VB, it's C#, but
you
can
just use the libraries. I personally find it a pain to maintain
my
own
class
library - which is only needed for my admin jobs !! - and to
have/deploy
this on all boxes, I ever work with.

The taskscheduler is not well supported by MS and possibly more
importent,
it is not "cluster-aware" !!!!!! Wether WMi nor CLR do have any
support
for
this :-(

So I can only still repeat my humble opinion [which is already
somewhere
within this thread ;-) ], that there should come a new supported
solution
....

Hope, this helps!

Best regards,
Manfred

So who has a COM wrapper for mstask.dll?

I set out to build one but VB Express doesn't have support and I
don't
have
VB6 loaded at this time. It's fairly straight forward. Only a
half
dozen
interfaces to set up and it could be callable from scripts. I
don't
understand why MS didn't build it.

--
Jim Vierra


Morten schreef:
Hi!

It might work if you execute the script as a user that exists
(same
user
name and password) on all your servers. The user would need admin
rights.

Best regards

Morten


Hi

The problem is, in wmi with this method:
Set objNewJob = objWMIService.Get("Win32_Sched­uledJob")
errJobCreated = objNewJob.Create ....

It isn't possible to say which user has to execute the script.
The alternative of Manfred Braun is ok, with the dll-files, but
than
I
have to run the command with wshshell.exec, and that gives some
problems :-(

Best regards

Mathias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top