How to schedule the Batch file to run from task scheduler

Hello Everyone,
I have a batch file which kills the wscript.exe process, I am doing this manually, I need to schedule this batch file to run from task scheduler whenever the process wscript.exe reaches to specific numbers,  i.e if the wscript.exe process count in task
manager reaches to 30,  the task schedular should execute this batch file,
Is there a way to do so.
dibu

Hi,
àI need to schedule
this batch file to run from task scheduler whenever the process wscript.exe reaches to specific numbers.
As I know, it will not help you to achieve this target via Scheduled Task. When configure Scheduled Task, there
seems no Trigger option that help you specify this condition (process counts reaches to specific numbers) to trigger the batch file.
You could consider that improve this batch file. Adding the
Check function to the script will be a better option. For script issue, you can post it in the
Official Scripting Guys Forum. I believe we will get a better assistance there.
If any update, please feel free to let me know.
Best regards,
Justin Gu

Similar Messages

  • Batch/Powershell file wont run via Task Scheduler

    Hello,
    I'm having trouble getting my Powershell file to run from Task Schedule during logoff. In short, I'm trying to upload my NTUSER.DAT (roaming profile) to my profiles folder on the file server. Dynamic VLAN switching does not support roaming profiles thus
    I have to use a script to solve this issue.
    My powershell script is as follows:
    start-sleep -s 15
    Set-Content -Path "C:\Temp\log.txt" -Value "Hello World"
    $FileServer = 10.10.5.5
    $FQDN = "$Env:UserDomain"
    $User = Get-WmiObject -Class Win32_NetworkLoginProfile | Sort-Object -Property LastLogon -Descending | Select-Object -Property * -First 1 | Where-Object {$_.LastLogon -match "(\d{14})"} | Foreach-Object { New-Object PSObject -Property @{ Name=$_.Name.TrimStart("$FQDN\") }} | Select -ExpandProperty Name
    copy-item -path C:\Users\$User\NTUSER.DAT -destination \\$FileServer\Profiles$\$user.V2\ -force
    copy-item -path C:\Users\$User\NTUSER.DAT -destination \\$FileServer\Profiles$\$user.V3\ -force
    I have a task schedule to run as Domain Admin when event ID 4647 occurs (logoff). It is set to run with the Highest Privileges checked, also I have enabled to run weather the user is logged in or no. The Domain Admin account also has access to ever file,
    both at source and destination. Set-ExecutionPolicy is set to unrestricted. The way I call the powershell script in Task Scheduler is:
    Action: Start a program
    Program/Script: C:\temp\launch.bat
    The launch.bat contains the following:
    Powershell.exe -executionpolicy unrestricted -File "CALL C:\temp\powershell.ps1"
    The task is triggered each time when the user logs off, I have confirmed this in the logs. But the NTUSER.DAT file fails to copy over to the network, in fact the log.txt file isn't even generated. I have confirmed my code to work, it's just the task scheduler
    part calling the code where I think it fails.
    Can you guys point me in the right direction here? I know I'm close, but not sure what I'm missing. 

    Jrv,
    Yes in my testing the task schedule is unreliable, I don't have any info on how long the profile is locked, thus I can't copy the profile to the server when the OS still has it locked.
    What do you propose I change my vlan configuration to?
    Thanks.
    What you are trying to do cannot be done.  That is why it is not being done.  If you set up roaming profiles and redirected folders this would happen automatically.  It would also happen very quickly.  THat is because Windows posts cahnges
    to teh roamed image as they happen.  Only changes are copied. Items in teh registry which are only valid during logon (Dynamic Entries) are nver copied so updates that are not needed are not posted.  It is these updates thaat can keep the registry
    locked for a very long time.
    If you scan your network you will likely find hives thaat are loaded with no one logged in.  WIndows 7 and later have a utility that forces and unload after a few minutes.  It posts the reson for the forced unload to the event log.
    As for the VLAN it is likely not configured correctly.  THe profile must be on a server that is available on the same net ID as the PC.  YOu may also have to allow the switch to suspend if you are using per-user conenctions.  Contact the VLAN
    vendor and tell them about issues with Roamed profiles.  THey will walk you through the setup.  THe most common issue is thaat the switch specifies 1Gb and the server is set to 100Mb and the switch is not set to match the speed.  THisis a simplpe
    configuration error done by a tech who does not have much experience with VLANs.  THey tend to think that setting everything to 1Gb or some other maximum will work but it won't.  It can also be caused by a files server with a 1Gb card that is a pront
    spooler spooling to a 100 or 10Mb older printer. This disrupts the card and the VLAN cannot attach to it until the spooler is dona nd the card can switch.  It can also be caused by a bad card or a bad switch.
    Then VLAN vendors techs are usually very good at troubleshooting this kind of issue.  Remote VLAN logging and diagnostics can also pick out the issue.
    ¯\_(ツ)_/¯

  • SyncToy 2.1 Can't Find NAS Folder When Run From Task Scheduler

    I'm using SyncToy 2.1 to keep two WIN7 computers and a Synology DS414j NAS drive in sync. I have several folder pairs configured, some between the two PC's and three between one PC and the NAS drive. I have a task set up for automatic syncing. The problem
    is SyncToy can't find the destination folders on the NAS drive if it's run from Task Scheduler. If I run SyncToy manually, everything works fine. I've even tried opening the command prompt and running the exact same program Task Scheduler is running (SyncToyCmd.exe
    -R), and it works perfectly. But when Task Scheduler runs the task, it fails to find the NAS folders with the following error message:
    SYNC: 08/21/2014 14:12:26:140: *** Failed to execute folder pair Downloads to NAS. Could not locate folder \\DISKSTATION\Downloads\.
    I've been looking for days for a solution and have not found anyone with this problem. Any ideas?

    Hi Texxxas,
    Apparently the problem is not with SyncToy, it is with Task Scheduler. If you have had Task Scheduler work for you in the past, then I don't have an answer for that. I have never been able to get Task Scheduler to work correctly with SyncToy and a NAS drive.
    I have found that for some reason it works with USB external HDD's but will not work with a network connected hard drive. The same bug exists in Win8.1 as well. However, I have since found a third party task scheduler that works perfectly with SyncToy and
    my NAS drive. It is called System Scheduler by Splinterware. The free version only works when you are logged in but they have a paid version that runs as a service and will execute without being logged in. This has solved my problem.

  • How to quit the J2ME emulator when running from a batch?

    I am launching the J2me emulator from a batch file in order to run unit tests (J2meUnit). I am using "emulator.exe -classpath ... -Xdevice:mediaControlSkin -Xdomain@trusted com.mydomain.TestMyMidlet".
    This works fine, and some of the tests even pass (;-)) but after the last one the emulator sits there waiting for me to shut it down, which would get a little tiresome at 4.00am every morning when the rest of the automated unit tests run ;-) How should I terminate it please? I tried to call destroyApp(true) after the last test but got "java.lang.SecurityException: Application not authorized to access the restricted API". What am I missing please? Thanks for any ideas...

    You can extend j2meunit.midletui.TestRunner (which you are probably already doing),
    copy-and-paste the start method from the source package, then change the end to look like this:
                                  System.out.println("Exception while running test: " + e);
                             e.printStackTrace();
    // start change
                   finally
                             notifyDestroyed();
    // end change
              }.start();
         }In other words, when all the tests are done, notify the application manager that you're all done. (destroyApp is what the app manager calls, notifyDestroyed is what you call)
    On the same topic (risking modestly hijacking the thread here) I'd like to ask if anyone knows how to just run some class inside a J2ME VM without having to pop up the UI.
    I know there is a j2meunit.textui.TestRunner, but I haven't figured out any way to get a command-line KVM without an UI at all. AWT throws exceptions when no X server is running (or you unset $DISPLAY). Of course, everything runs fine (except that you can't specify an exit code, which gives you some more hoops to jump through with ant), but I don't think an unit test should need an X server running / should pop up a window for half a second.

  • How to make the class files to run in a particular platform only

    Class files which are created from the java files should only run on a particular platform only..say i'm going to create the class files for windows environment then those class files should only run on that environment only. it should not run on unix environment etc..how to do this..

    hi,
    i cant think of a reason why you would do something like that.. You cant prevent your class files to be read by the JVM of a different OS, but anyway you could do something to stop your code from running in a different OS, for eg.
    Properties prop = System.getProperties();
    if (prop.getProperty("os.name").startsWith("Windows")==true)
          //code
    else
           System.out.println("Sorry i will not run in this OS");
    }cheerz
    ynkrish

  • How to achieve the maximum file transfer rate from PXI to local host?

    I will have to copy a huge amount of data (as big as 50 GB) from a PXI-8106 unit on site to a laptop. Currently it would take several hours. It is critical to max out the data transfer rate.
    The standard method we've been using is just drag and drop using Windows Explorer via FTP. I tried to use FTP VIs with Filezilla Server as well but the transfer rate is only like 1.5 MB/s. Is this normal? Once I saw it was 3.0 MB/s but for some reason, that isn't happening now.
    For another option, I tried to transfer data to a USB flash drive but it's even slower. As far as I know, USB 2.0 transfer rate is supposed to be around 60 MB/s but why would it be slower than 1.5 MB/s? What could be the speed limiting factor in my file transfer setup?
    Any tips on improving file transfer rate would be appreciated!

    Sustained 40 MB/s? That is my dream speed! The maximum speed I've ever seen here was about 25 MB/s, which is still very good, and that happened only after copying back and forth, which I explained above. Let me go through what I did with screencaps first.
    These are the test tdms files to transfer in the PXI: an original file witten in the PXI and its copy file. I copied the original file from PXI to laptop and renamed it (added '_copy') and then copied it back to PXI.
    FTP module is transferring the original file to the Filezilla server on laptop. Note the low speed.
    FTP module is transferring the copy file to the Filezilla server on laptop. Note the higher speed.
    This is the FTP sub VI I'm using. It transfers files in sub-folders (one level lower), too. The data connection is set to 'passive' on the FTP Put Multiple Files VI but it doesn't seem to make any difference. I attach the sub VI.
    You tried the file transfer with a 500 MB text file. Would there be any difference if the file type was tdms? Would the RAM size matter? It is 2GB here.
    And the LED is orange, which means Gigabit.
    Another question: Is there any way to programmatically stop file transfer in progress? Currently, I just have to restart the PXI.
    Thank you!
    Attachments:
    FTP.vi ‏40 KB

  • Workflow does not start when PowerShell Script is run from Task Scheduler

    I have a PS script that updates an item in a SP2010 list so that a workflow will be started.  When I run the PS script manually from the PS window on the server it resides, the script runs flawlessly.  If I set a scheduled task on the same server
    to run the script with the same credentials as are being used in the PS window, the script runs, updated the info on the list, but DOES NOT start the workflow.  As we know, SPD workflows cannot be started by anonymous or system accounts.  It is as
    if the task scheduler adds a bit of information that makes the SP2010 list think the information was updated by one of these accounts even though the field in the list for the item being updated shows the correct account.
    HELP!!!
    D

    Hi,
    The issue might be related to the script or schedule task settings your configured. You’d better check the settings.
    For example, which option do you set to run the scheduled task? You may select “Run whether user is logged on or not” instead of “run only when user is logged on” as shown in this article:
    http://blog.pointbeyond.com/2010/04/23/run-powershell-script-using-windows-server-2008-task-scheduler/
    Hope it helps.
    Best Regards,
    Sally Tang

  • How to access the C# file in server from Lightswitch HTML Client

    Hi,
    In that LightSwitch HTML Application i have some c# file in the server project.How can i access those C# file in the screens (HTML Client project )
    thanks,
    goblalakrishnan s
    gobalakrishnan S

    Hi,
    with implementing Generic File Handlers (.ashx)
    See follow link:
    http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/174/Full-Control-LightSwitch-ServerApplicationContext-And-Generic-File-Handlers-And-Ajax-Calls.aspx
    regards
    j.nord

  • Execution of a batch file fails if the batch file has a date

    Hi All,
    I have a batch file which copies files from one folder to another based on the date condition( if the files are modified or created today copy them). Below is my code
    set curr_date=%DATE:~4,2%/%DATE:~7,2%/%DATE:~10,4% & XCOPY \\cambosnapp01\FileTransfers\InboundToHomesite\NICB\Entities \\cambosnapp01\Claims\Analytics\NICB\CurrentAlerts/d:%curr_date%
    This batch file runs fine if i run it manually, but i want to run this in an ssis package, i am using an execute process task and in the executable i gave the location of this batch file, and if i run the package it fails.However if i just exclude the last
    date thing from the batch file and run the below one it runs fine.
    set curr_date=%DATE:~4,2%/%DATE:~7,2%/%DATE:~10,4% & XCOPY \\cambosnapp01\FileTransfers\InboundToHomesite\NICB\Entities \\cambosnapp01\Claims\Analytics\NICB\CurrentAlerts/d
    But this batch file would copy all the files which i dont need. I only want to copy the new files and thats the reason i use the date in the end but for some reason it fails.
    Can someone please help me with any suggestions on this?
    Please let me know if you have any questions or if i am still unclear.
    Thanks

    What is the error you are getting?
    Why don't you want to use the FileSystem task that is parameter driven?
    Running the bat file manually vs as a package has a difference.
    Do you run it while the package is in development (via SSDT)?
    You only gave the bat file, but how did you set your task in SSIS not.
    Arthur
    MyBlog
    Twitter

  • How to call the css file and its images from our application......

    hai,
    Im uploading a .css file and some images in Apex shared components ,now how to call the css file and images from my Application.... plz tell me detailed.....
    Edited by: anoo on Nov 3, 2008 12:51 AM

    Hi Anoo,
    Sorry, didn't see that you'd started a new thread, so have answered this in 'undefined' is null (or) not an object "
    Andy

  • Pass Passord Variable to a Batch File using Execute Process Task

    I have an FTP batch file that I want to execute using Execute Process Task. The content of the ftp (ftpscript.cmd) is as below:
    open ftpsite
    UserName
    Password
    ASCII
    get file  c:\temp\test.txt
    bye
    Using SSIS Execute process task, I was able to download data. I configured the Execute Process task as follows:
    Executable: ftp.exe
    Arguments: -s:"c:\temp\ftpscript.cmd"
    The above works fine. But the problem is that I don't want to store the password value in the batch file for security/policy reasons. Please, is there a way I can pass the password value to the ftp executable or the batch file at run time?
    I know how to get and store variables in SSIS but I don't know how to pass this kind of variable to the batch file just before execution.
    Any suggestions will be appreciated. Thanks.

    you can dynamically generate the source (CMD) for the FTP and delete after the execution. The password can be stored in a secure database for example, not 100 % secure, but the best you can do.
    Another option I did was an encrypted VBScript (also quite easy to open in plain text to some people).
    Finally it can be a binary e.g. an EXE with the FTP called as process in it.
    Arthur My Blog

  • How to run the batch files

    Hi Experts,
    I am trying to implement automatic cache purging every day at specified time and i created txt file with SApurge All cache() and created bat file with nqcmd -q Analyticsweb -u username -p password -s (txt file location).
    Now i want to run this bat file daily at specified time with out executing manually may i know how to run the batch file at specified time .
    Thanks,

    There is task type as command in workflow manager if you want you can go for that during the load
    nqcmd -d "AnalyticsWeb" -u Administrator -p Administrator -s "D:\PowerCenter8.1.1\server\infa_shared\SrcFiles\1_BIPurgeCache.txt"
    Check these urls
    http://docs.oracle.com/cd/E12103_01/books/AnySched/AnySched_Scripts3.html
    http://deliverbi.blogspot.com/2011/12/purge-all-cache-from-dashboard.html

  • HOw to create a Batch file for java application and whats the use of this ?

    HI,
    How to create a Batch file for java application ?
    And whats the use of creating batch file ?
    Thanks in advance

    First of all, you're OT.
    Second, you can find this everywhere in the net.
    If you got a manifest declaring main class (an classpath if needed), just create a file named whatever.bat, within same directory of jar file, containing:
    javaw -jar ./WhateverTheNameOfYourJarIs.jar %*By the way, assuming a Windows OS, you can just double click the jar file (no batch is needed).
    Otherwise use:
    javaw -cp listOfJarsAndDirectoriesSeparedBySemiColon country/company/application/package/className %*Where 'country/company/application/package/' just stands for a package path using '/' as separator instead of '.'
    Don't specify the .class extension.
    Javaw only works on Windows (you asked for batch, I assumed .BAT, no .sh), in Linux please use java.exe (path may be needed, Windows doesn't need it 'cause java's executables are copied to system32 folder in order to be always available, see PATH environment variable if you don't know what I'm talking about) and use ':' as classpath (cp) separator.
    The '%***' tail is there in order to pass all parameters, it only works on Windows, refer to your shell docs for other OSs (something like $* may work).
    This way you have a command you can call to launch your code (instead of opening NetBeans just to see your app working). You could schedule tasks on it or just call it in any command prompt (hope you know what it is 'cause there have been people in this very same forum with no clue about it, if not just hold the 'Windows button' and press 'R', then type 'cmd' and run it).
    Finally add dukes and give 'hem away.
    Bye.

  • How we can create the batch file to download the data in from URL in ssis

    hi,
    any one help on one the below requirement.
    i have to create one batch file to download the report(reports is in csv format) from URL...
    requirement should be like this...
    1. we have some reports is there in the URL..
    2.when ever we execute the url, the report should be download and save it to the local folder.
    3. this requirement i have to write in the batch file
    should any one let me know how we can create the batch file for the above requirement.

    Hi Priya.N,
    If you use SQL Server Reporting Services for reporting, you can use Visakh’s suggestion to create a script file which calls Reporting Services Web Service to render a report in CSV format and save a batch file to the destination folder, and then create a
    batch file to run the rs.exe utility which can executes the .rss script file. For more information, please see:
    Report Server Web Service
    ReportExecutionService.Render Method
    rs Utility (rs.exe) (SSRS)
    If you use other reporting tools, it depends on the reporting functionality and this requirement may be not achieved.
    Regards,
    Mike Yin
    TechNet Community Support

  • )How can we schedule the info package daily run at 6 AM, with out useing in

    Hi
       Can any one explain 1) what is information broadcasting &how can we use this.
    2)What are the settings we have to do when we use the charts in WAD's
    3)How can we schedule the info package daily run at 6 AM, with out useing in process chains
    Thanks
    Bharath

    Hi,
      Information broadcaster :
          you can precalculate and distribute(thru mail) the query, workbook and webtemplate through online link or html file to the receipents (users).
    have a look at the below link.
         http://help.sap.com/saphelp_nw04/helpdata/en/3a/0e044017355c0ce10000000a1550b0/frameset.htm
    Infopackage scheduling:
         you can schedule the infopackage daily at your desired time .In the schedule tab ,select the start later in background and in the scheduling option give the date and time and give the period values as daily.
    Regards,
    Siva.

Maybe you are looking for

  • No longer boots. Startup freezes at Apple logo.  What's wrong?

    Apple's Hardware Test says its O.K. Wont recognize install disk, so I can't reinstall system software. What do I do now?  This is an 8 core Mac Pro running Leopard.

  • Please wait while windows configures hp product assistant

    To HP and Company 9 Jan 2014 I kept getting the following message in red on my Windows 7 Dell Computer so I did everything the help sites told me to do and nothing helped.  I got rid of all HP files and the problem went away.  I ordered the CD softwa

  • Is it just me or do apps install a lot faster with 2.1?

    Seems faster to me. Maybe its because I restored with the new software? Message was edited by: Kamakzie1976

  • Why is the Play head not snapping?

    In the latest update of FCPX I can't get the play head in the timeline to snap where it want it. Not sure what It's actually called, but what I mean is the orange line that follows where the cursor moves and scrubs the video/audio. I use to be able t

  • Bank Reconciliation- String Manipulation

    Hi Gurus, My client using match format to reconcile. The Line 86 "Note to Payee " is having some additional information other than the reference no. i.e. the 12 character is required for posting, then there is "Space" and then there are some other ch