![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Unable to schedule this one! Hello, I wrote a simple script to extract files from zip archives and move them around. It works ok regarding extract and move operations. Problem is that after scheduling it to run on Win2003R2 every 10 minutes something funny seems to happen to windows task scheduler. Often after running this the task scheduler seems to stop responding. My other 3 scheduled tasks wont run. Server just updates the next run time but not the last run time. All exit codes are 0x0. When this happens the task sceduler service won't even restart and I have to reboot whole server to get it back running. Below is the script. Can you tell if there's something that might cause this? Problems with scheduler started around tha same time I added this to the tasks. There has not been any other changes to this server lately except normal Microsoft patching... Thanks! Will strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Const OverwriteExisting = TRUE Const DeleteReadOnly = TRUE 'read Inbox Set FileList = objWMIService.ExecQuery _ ("ASSOCIATORS OF {Win32_Directory.Name='D:\Sender\SenderFTPinbox'} Where " _ & "ResultClass = CIM_DataFile") 'Process Inbox zips For Each objFile In FileList If objFile.Extension = "zip" Then 'Wscript.Echo objFile.Name 'Copy to backup strCopy = "D:\Sender\SenderInvoiceBackup\" & objFile.FileName & "." & objFile.Extension objFile.Copy(strCopy), OverwriteExisting 'extract Extract strCopy, "D:\Sender\SenderFTPunzip" 'Garbage handling Else strCopy = "D:\Sender\SenderGarbage\" & objFile.FileName & "." & objFile.Extension objFile.Copy(strCopy), OverwriteExisting objFile.Delete End If Next 'Clean Inbox Set objFSO = CreateObject("Scripting.FileSystemObject") objFSO.DeleteFile("D:\Sender\SenderFTPinbox\*.*"), DeleteReadOnly 'move unzipped files 'luetteloi unzipatut tiedostot Set FileList = objWMIService.ExecQuery _ ("ASSOCIATORS OF {Win32_Directory.Name='D:\Sender\SenderFTPunzip'} Where " _ & "ResultClass = CIM_DataFile") For Each objFile In FileList If objFile.Extension = "xml" or objFile.Extension = "pdf" Then strCopy = "D:\finvoice\Sender\" & objFile.FileName & "." & objFile.Extension objFile.Copy(strCopy), OverwriteExisting objFile.Delete Else 'Move 2 garbage strCopy = "D:\Sender\SenderGarbage\" & objFile.FileName & "." & objFile.Extension objFile.Copy(strCopy), OverwriteExisting objFile.Delete End If Next Sub Extract( ByVal myZipFile, ByVal myTargetDir ) intOptions = 16 Dim intOptions, objShell, objSource, objTarget ' Create the required Shell objects Set objShell = CreateObject( "Shell.Application" ) ' Create a reference to the files and folders in the ZIP file Set objSource = objShell.NameSpace( myZipFile ).Items( ) ' Create a reference to the target folder Set objTarget = objShell.NameSpace( myTargetDir ) ' UnZIP the files objTarget.CopyHere objSource, intOptions ' Release the objects Set objSource = Nothing Set objTarget = Nothing Set objShell = Nothing End Sub |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Unable to schedule this one! any clues in event viewer regarding why the task scheduler is failing? are we sure this script is causing the problem with the task scheduler? to test this, disable this particular task. does wscript properly close? when running the script manually, how does it affect the task scheduler? On Mar 18, 3:28*am, "William Stokes" <w...@xxxxxx> wrote: Quote: > Hello, > > I wrote a simple script to extract files from zip archives and move them > around. It works ok regarding extract and move operations. Problem is that > after scheduling it to run on Win2003R2 every 10 minutes something funny > seems to happen to windows task scheduler. Often after running this the task > scheduler seems to stop responding. My other 3 scheduled tasks wont run. > Server just updates the next run time but not the last run time. All exit > codes are 0x0. When this happens the task sceduler service won't even > restart and I have to reboot whole server to get it back running. > > Below is the script. Can you tell if there's something that might cause > this? Problems with scheduler started around tha same time I added this to > the tasks. There has not been any other changes to this server lately except > normal Microsoft patching... > > Thanks! > Will > > strComputer = "." > Set objWMIService = GetObject("winmgmts:" _ > * * & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") > > Const OverwriteExisting = TRUE > Const DeleteReadOnly = TRUE > > 'read Inbox > Set FileList = objWMIService.ExecQuery _ > * * ("ASSOCIATORS OF {Win32_Directory.Name='D:\Sender\SenderFTPinbox'} Where > " _ > * * * * & "ResultClass = CIM_DataFile") > > 'Process Inbox zips > For Each objFile In FileList > * * If objFile.Extension = "zip" Then > * * * * 'Wscript.Echo objFile.Name > > * * * * 'Copy to backup > * strCopy = "D:\Sender\SenderInvoiceBackup\" & objFile.FileName & "."& > objFile.Extension > * objFile.Copy(strCopy), OverwriteExisting > > * 'extract > * * * * Extract strCopy, "D:\Sender\SenderFTPunzip" > > * * 'Garbage handling > * * Else > * * strCopy = "D:\Sender\SenderGarbage\" & objFile.FileName & "." & > objFile.Extension > *objFile.Copy(strCopy), OverwriteExisting > *objFile.Delete > * * End If > Next > > 'Clean Inbox > Set objFSO = CreateObject("Scripting.FileSystemObject") > objFSO.DeleteFile("D:\Sender\SenderFTPinbox\*.*"), DeleteReadOnly > > 'move unzipped files > 'luetteloi unzipatut tiedostot > Set FileList = objWMIService.ExecQuery _ > * * ("ASSOCIATORS OF {Win32_Directory.Name='D:\Sender\SenderFTPunzip'} Where > " _ > * * * * & "ResultClass = CIM_DataFile") > > For Each objFile In FileList > * * If objFile.Extension = "xml" or objFile.Extension = "pdf" Then > * * *strCopy = "D:\finvoice\Sender\" & objFile.FileName & "." & > objFile.Extension > * objFile.Copy(strCopy), OverwriteExisting > * objFile.Delete > *Else 'Move 2 garbage > * * *strCopy = "D:\Sender\SenderGarbage\" & objFile.FileName & "." & > objFile.Extension > * objFile.Copy(strCopy), OverwriteExisting > * objFile.Delete > *End If > Next > > Sub Extract( ByVal myZipFile, ByVal myTargetDir ) > > intOptions = 16 > > * * Dim intOptions, objShell, objSource, objTarget > > * * ' Create the required Shell objects > * * Set objShell = CreateObject( "Shell.Application" ) > > * * ' Create a reference to the files and folders in the ZIP file > * * Set objSource = objShell.NameSpace( myZipFile ).Items( ) > > * * ' Create a reference to the target folder > * * Set objTarget = objShell.NameSpace( myTargetDir ) > > * * ' UnZIP the files > * * objTarget.CopyHere objSource, intOptions > > * * ' Release the objects > * * Set objSource = Nothing > * * Set objTarget = Nothing > * * Set objShell *= Nothing > End Sub |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Unable to schedule this one! "William Stokes" <will@xxxxxx> wrote in message news:%23siWos5pJHA.996@xxxxxx Quote: > Hello, > > I wrote a simple script to extract files from zip archives and move them > around. It works ok regarding extract and move operations. Problem is that > after scheduling it to run on Win2003R2 every 10 minutes something funny > seems to happen to windows task scheduler. Often after running this the > task scheduler seems to stop responding. My other 3 scheduled tasks wont > run. Server just updates the next run time but not the last run time. All > exit codes are 0x0. When this happens the task sceduler service won't even > restart and I have to reboot whole server to get it back running. > > Below is the script. Can you tell if there's something that might cause > this? Problems with scheduler started around tha same time I added this to > the tasks. There has not been any other changes to this server lately > except normal Microsoft patching... > > Thanks! > Will > > In the last job I had, the systems-administrator set up a special user to run scheduled jubs. When jobs were attached, they failed to run UNLESS that particular user had a live session attached, so that if you logged in as that user, (like you'd do for testing, for instance) then the job WOULD run. Naturally, when I pointed out that the job WOULD run if someone had signed in to the user-account, but would NOT run otherwise, the systems-administrator screamed at me for nearly two hours, calling me a liar and screaming at the top of her voice that it was a well-known problem that NO-ONE IN THE WORLD HAD EVER FOUND A SOLUTION FOR. Her husband, the assistant-general-manager just sat there watching her go red-in-the-face and jumping up-and-down like an overweight hippo. A Google search revealed Microsoft's solution that had been published two years earlier, and had been installed on the machine. I've since been informed by people who actually have some knowledge of this area (security is NOT my area) that it's a permissions problem. May or may not be an appropriate avenue for investigation... |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Unable to schedule this one! This job is ment to run in a Terminal Server box. Was your client using TS in the situation you described? "billious" <billious_1954@xxxxxx> kirjoitti viestissä:49c1a68d$0$5638$5a62ac22@xxxxxx-qv1-newsreader-01.iinet.net.au... Quote: > > "William Stokes" <will@xxxxxx> wrote in message > news:%23siWos5pJHA.996@xxxxxx Quote: >> Hello, >> >> I wrote a simple script to extract files from zip archives and move them >> around. It works ok regarding extract and move operations. Problem is >> that after scheduling it to run on Win2003R2 every 10 minutes something >> funny seems to happen to windows task scheduler. Often after running this >> the task scheduler seems to stop responding. My other 3 scheduled tasks >> wont run. Server just updates the next run time but not the last run >> time. All exit codes are 0x0. When this happens the task sceduler service >> won't even restart and I have to reboot whole server to get it back >> running. >> >> Below is the script. Can you tell if there's something that might cause >> this? Problems with scheduler started around tha same time I added this >> to the tasks. There has not been any other changes to this server lately >> except normal Microsoft patching... >> >> Thanks! >> Will >> >> > Hmm. *Sore point* > > In the last job I had, the systems-administrator set up a special user to > run scheduled jubs. When jobs were attached, they failed to run UNLESS > that particular user had a live session attached, so that if you logged in > as that user, (like you'd do for testing, for instance) then the job WOULD > run. > > Naturally, when I pointed out that the job WOULD run if someone had signed > in to the user-account, but would NOT run otherwise, the > systems-administrator screamed at me for nearly two hours, calling me a > liar and screaming at the top of her voice that it was a well-known > problem that NO-ONE IN THE WORLD HAD EVER FOUND A SOLUTION FOR. Her > husband, the assistant-general-manager just sat there watching her go > red-in-the-face and jumping up-and-down like an overweight hippo. > > A Google search revealed Microsoft's solution that had been published two > years earlier, and had been installed on the machine. > > I've since been informed by people who actually have some knowledge of > this area (security is NOT my area) that it's a permissions problem. > > May or may not be an appropriate avenue for investigation... > |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Unable to schedule this one! "William Stokes" <will@xxxxxx> wrote in message news:%236RJLBHqJHA.1184@xxxxxx Quote: > This job is ment to run in a Terminal Server box. Was your client using TS > in the situation you described? > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Can a schedule be riped to a bat or .ps1 | PowerShell | |||
| Unable to use Schtasks command to schedule task for users group | Vista General | |||
| Schedule backups | Vista account administration | |||
| Schedule Task | Vista performance & maintenance | |||
| Still on schedule. | Vista General | |||