|
-
Mar 5th, 2012, 08:42 AM
#1
Thread Starter
New Member
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
-
Mar 5th, 2012, 05:12 PM
#2
Addicted Member
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
-
Mar 6th, 2012, 03:42 AM
#3
Thread Starter
New Member
Re: Check date: If Wednesday run batch script
 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.
-
Mar 7th, 2012, 07:31 AM
#4
Addicted Member
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.
-
Mar 7th, 2012, 09:46 AM
#5
Thread Starter
New Member
Re: Check date: If Wednesday run batch script
 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?
-
Mar 7th, 2012, 11:11 AM
#6
Addicted Member
Re: Check date: If Wednesday run batch script
Sorry, I've no idea. Maybe look at what command line options your Avast provides.
-
Mar 7th, 2012, 11:14 AM
#7
Thread Starter
New Member
Re: Check date: If Wednesday run batch script
 Originally Posted by His Nibbs
Sorry, I've no idea. Maybe look at what command line options your Avast provides.
I will. Thanks
Last edited by e2e2; Mar 8th, 2012 at 11:07 AM.
-
Mar 9th, 2012, 05:28 AM
#8
Thread Starter
New Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|