Check date: If Wednesday run batch script
Hi guys,
We use avast adnm 4.8 and it has no shutdown scanning option.
I have made a batch script to run Avast on shutting down.
_________________________________________________________________
@echo off
shutwdown -a
pushd "C:\Program Files\Alwil Software\Avast4"
cls
echo --------------------------------------------------------------
echo Bezig met scannen, de computer wordt automatisch uitgezet...
echo --------------------------------------------------------------
aswcmd C: /m /*
popd "C:\Program Files\Alwil Software\Avast4"
shutdown -s
_________________________________________________________________
But I only want to scan the computers on wednesday. So if its not Wednesday computers must shutdown without scan.
I need a script to check de current date and run if it's wednesday. I want to use this script as shutdown script. If it is possible with a batch script its also fine.
Thanks in advance,
e2e2
Re: Check date: If Wednesday run batch script
Use one of the techniques here - http://superuser.com/questions/90758...-in-batch-file
Or convert your batch script to VBScript, then it's simply:
Code:
If DatePart("W",Date) = 4 Then
'Wednesday
End If
Re: Check date: If Wednesday run batch script
Quote:
Originally Posted by
His Nibbs
Hi,
Tnx for your reply. I am new to VBscript.
I look for a vbscript that check the date, if it is Wednesday start the batch script if not go shut down.
Re: Check date: If Wednesday run batch script
Try this as a Windows shutdown script (set in Group Policy), named scan.vbs for example.
Code:
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
If DatePart("W",Date) = 4 Then
'Today is Wednesday, so run the virus scan
WshShell.Run """C:\Program Files\Alwil Software\Avast4\aswcmd"" C: /m /*", , True
End If
That's all you need, because if this script is run on system shutdown it will exit (after the End If) and the computer will shut down.
Re: Check date: If Wednesday run batch script
Quote:
Originally Posted by
His Nibbs
Try this as a Windows shutdown script (set in Group Policy), named scan.vbs for example.
Code:
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
If DatePart("W",Date) = 4 Then
'Today is Wednesday, so run the virus scan
WshShell.Run """C:\Program Files\Alwil Software\Avast4\aswcmd"" C: /m /*", , True
End If
That's all you need, because if this script is run on system shutdown it will exit (after the End If) and the computer will shut down.
This is working perfect. Thank you very much !
I want also that every computer that runs av create .txt file to network directory "\\server\avastlog". only on wednesday. How can i do that?
Re: Check date: If Wednesday run batch script
Sorry, I've no idea. Maybe look at what command line options your Avast provides.
Re: Check date: If Wednesday run batch script
Quote:
Originally Posted by
His Nibbs
Sorry, I've no idea. Maybe look at what command line options your Avast provides.
I will. Thanks
Re: Check date: If Wednesday run batch script
If a computer run's the script on Wednesday, i want that it creates a %computername*.txt file in a netwok map. In batch script i can to it with %computername%.txt, what code can i use it for VBS script?
vb Code:
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
If DatePart("W",Date) = 4 Then
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile("\\server\Avast Scan Log\%computername%.txt")
'Today is Wednesday, so run the virus scan
WshShell.Run """C:\Program Files\Alwil Software\Avast4\aswcmd"" M: /m /*", , True
End If