Hallo
Sorry for my english
The problem is:
I have many PC's in my Active Directory, a wont to deploy some scheduled tasks to them. But The problem is thath they "Could Not Start" because of the user creditations maby ... when i set the Password and unchek and chek the Box in Scheduled task that ( RUN Only if Loggd On ) ... the tasks begins, but when log off the user account and change whit another one ... the task "Could not start" and i must set again the password .... it is crude method!
The situtaion is:
I deploy the job operation with: job.vbs in User Configuration >> Log On Scripts
the script of job.vbs is:
-----------------------------------------------------------------------------
ON ERROR RESUME NEXT
Dim WshShell, WshNetwork, FileSystem, WshEnv
Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshShell = CreateObject("WScript.Shell")
Set WshEnv = WshShell.Environment("Process")
SysRoot = WshEnv("SYSTEMROOT")
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set FileSystem = CreateObject("Scripting.FileSystemObject")
WshNetwork.MapNetworkDrive "T:", "\\sticsrv\Jobs"
FileSystem.CopyFile "T:\*.job", (sysroot & "\Tasks")
FileSystem.CopyFile "T:\*.vbs", (sysroot)
WshNetwork.RemoveNetworkDrive "T:"
wscript.quit
----------------------------------------------------------------------------
This script work's and i see the jobs in Scheduled Task Explorer
And the jobs are:
1) Message.job At 17:45 - (Seys the user to do not ShutDown the PC)
2) ChkDsk.job At 18:20 - (Doing the Chkdsk /f command)
3) Restart.job At 18:21 - (Restart to do ChkDsk)
4) Defrag.job At 19:00 - (Doing the defragment All HDD operation)
5) ShutDown.job At 20:00 - (Shutdown the PC)
----------------------------------------------------------------------------
ChkDsk.job Runs ChkDsk.vbs
The code of ChkDsk.vbs is:
---------------------------------------------------------------------------
Option Explicit
Dim WshShell, fso, d, dc, LogFile, Drive
Set WshShell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set dc = fso.Drives
For Each d in DC
If d.DriveType = 2 Then
Drive = d
Exit For
End If
Next
LogFile = Drive & "\chkdskreport.txt"
WshShell.Run "%comspec% /c echo Starting chkdsk of all hard disks " _
& Now & " >" & LogFile, 0, True
For Each d in dc
If d.DriveType = 2 Then
WshShell.Run "%comspec% /c echo ********* Checking drive " & d _
& " ******** >>" & LogFile, 0, True
WshShell.Run "%comspec% /c echo Y | chkdsk c: /f /r", 1, TRUE
End If
Next
WshShell.Run LogFile
-------------------------------------------------------------------------------------------
And it is works
--------------------------------------------------------------------------------------------
And the Message.job runs the message.vbs
And the code is:
----------------------------------------------------------------------------------------------
Option Explicit
Dim Text1, Text2
Dim Title1, Title2,Text3,Text4,Text5,Text6,Text7,result
Title1 = "**********************!"
Title2 = "..:: ************************ ::.."
Text1 = "********************************************************:"
Text3 = "- ***********************************************!"
Text4 = "- **************************************!"
Text5 = "- ****************************:"
Text6 = "***************"
Text7 = "[email=veselin@penguin.dk]*****************[/email]"
Text2 = " ***********************!"
MsgBox Text1 & vbCrLf & vbCrLf + Text3 & vbCrLf + Text4 & vbCrLf + Text5 & vbCrLf & vbCrLf + Text6 & vbCrLf + Text7, vbExclamation + vbOKOnly, Title1
result = MsgBox(Text2, vbOKOnly, Title2)
wscript.quit
------------------------------------------------------------------------------------------------------
And this script work!
-------------------------------------------------------------------------------------
The ather Job Operation are made with Scheduled Task Wizard ... and set correctly ...
Evrtything is Test in my PC and it is works
But when i Change the Account ... Job operation Could not Start ........ [sm=rolleyes.gif]
Please Help me !!!
Thank you in advance!
Best Regards!
<message edited by vveselinn on Friday, November 09, 2007 12:31 AM>