Kaseya Community

Script that only runs on weekdays

  • Hi All,


    Does anyone have a vb script that checks the current day and outputs to text file if weekday or weekend.

    i.e.
    weekday = yes
    weekend = no


    Any help would be great

    ConfusedConfused

    Legacy Forum Name: Script that only runs on weekdays,
    Legacy Posted By Username: dstrong
  • No need for VB, you can determine the day from the command line. Since the only days of the week that start with the letter "S" are weekend days, just check for that, such as:



    if %Date:~0,1%==S (echo Weekend=Yes >c:\temp\dow.txt) Else (echo Weekend=No >c:\temp\dow.txt)


    From within a Kaseya Script, it would look like:


    Script Name: Check Weekend Yes or No
    Script Description: This script will issue a command line command to determine if today is a weekend day or not and output to a text file.

    IF True
    THEN
    Execute Shell Command
    Parameter 1 : if %Date:~0,1%==S (echo Weekend-Yes >>c:\temp\DoW.txt) Else (echo Weekend-No >>c:\temp\DoW.txt)
    Parameter 2 : 0
    OS Type : 0
    Get File
    Parameter 1 : c:\temp\DoW.txt
    Parameter 2 : DoW.txt
    Parameter 3 : 0
    OS Type : 0
    Delete File
    Parameter 1 : c:\temp\DoW.txt
    OS Type : 0
    ELSE



    Obviously, you could use variables within the Kaseya script for the output path and file name.

    Good luck,

    Greg

    Legacy Forum Name: General Discussion,
    Legacy Posted By Username: pcmnetmanage
  • Hi Greg,


    Thanks for your help and this sounds great my command knowledge is not that good. I have got this reporting back but when I run this today i.e Sunday it reports in the test doc that it is Weekend = No when it is.

    Can you help with this please ?

    ConfusedConfused

    Legacy Forum Name: General Discussion,
    Legacy Posted By Username: dstrong
  • Hi Greg,

    Command Date only gives me the result of : 05/04/09 and not day ie Sunday


    But do not know why if this helps


    Cool

    Legacy Forum Name: General Discussion,
    Legacy Posted By Username: dstrong