Skip to main content

Updated Windows maintenance script for AntiVir 9

I posted my Windows maintenance script a few months ago. Last week I updated it to support AntiVir 9. If you have any questions, post them in the comments!

If you're running it on Vista, you'll have to call it from maintvista.vbs:

Set objShell = CreateObject("Shell.Application")
Set FSO = CreateObject("Scripting.FileSystemObject")
strPath = "\\istanbul\public\apps\scripts\maint.vbs"
If FSO.FileExists(strPath) Then
objShell.ShellExecute "wscript.exe", Chr(34) & strPath & Chr(34), "", "runas", 1
Wscript.Echo strPath & " not found!"
End If

And here's the main script, maint.vbs:

'starts timing script execution
dtmStart = Now

Set WshShell = CreateObject("Wscript.Shell")

'updates AntiVir definitions
'WshShell.Run """%programfiles%\Avira\AntiVir PersonalEdition Classic\preupd.exe""", 1, true
'can't make script wait for updating to finish before proceeding

'polls for Microsoft Updates
WshShell.Run "wuauclt.exe /detectnow", 1, true

'runs Disk Cleanup based on choices in sageset
WshShell.Run "cleanmgr.exe /sagerun:1", 1, true

'runs Disk Defragmenter analysis
Set WshExec = WshShell.Exec("defrag.exe c: /a")
'memorizes and reads analysis
strOutput = WshExec.StdOut.ReadAll
strSearch = "You do not need to defragment this volume."
'an analysis other than "You do not need to defragment this volume" causes a defrag
strDefragStatus = "no"
If InStr(1, strOutput, strSearch) = 0 Then
WshShell.Run "defrag.exe c:", 1, true
strDefragStatus = "yes"
End If

'backs up My Documents if username matches specified one, else skips
'If strComputername = "LEFT" Then
'uses robocopy to back up documents to istanbul
'WshShell.Run "i:\apps\scripts\robocopy.exe ""%userprofile%\My Documents"" ""i:\%computername%\My Documents"" /fft /s /v /purge", 1, true
'uses robocopy to back up desktop to istanbul
'WshShell.Run "i:\apps\scripts\robocopy.exe ""%userprofile%\Desktop"" ""i:\%computername%\Desktop"" /fft /s /v /purge", 1, true
'End If

'scans C: with Avira AntiVir
Set objFSO = CreateObject("Scripting.FileSystemObject")

'Set AntiVir path for Windows XP
strPath = "C:\Program Files\Avira"
If objFSO.FolderExists(strPath) Then
WshShell.Run """C:\Program Files\Avira\AntiVir Desktop\avscan.exe"" /GUIMODE=1 /PATH=""c:""", 1, true
End If

'Set AntiVir path for Windows Vista 64
strPath = "C:\Program Files (x86)\Avira"
If objFSO.FolderExists(strPath) Then
WshShell.Run """C:\Program Files (x86)\Avira\AntiVir Desktop\avscan.exe"" /GUIMODE=1 /PATH=""c:""", 1, true
End If

'stops timing script execution, memorizes time in minutes
dtmEnd = Now
dtmExecutionTime = DateDiff("n", dtmStart, dtmEnd)

'records success to file and tells user script is complete
Set objFSO = CreateObject("Scripting.FileSystemObject")
Const ForAppending = 8
Set objTextFile = objFSO.OpenTextFile("\\istanbul\public\apps\scripts\maint.log", ForAppending, True)
Set WshNetwork = WScript.CreateObject("WScript.Network")
strComputername = WshNetwork.ComputerName
objTextFile.WriteLine(strComputername & vbTab & vbTab & Now & vbTab & strDefragStatus & vbTab & dtmExecutionTime)

Wscript.Echo "Maintenance completed at " & Time & vbCrLf & "Elapsed time: " & dtmExecutionTime & " minutes" & vbCrLf & "Defrag: " & strDefragStatus


Popular posts from this blog

The difference between burritos, chimichangas, and enchiladas

I love Mexican food, but I'm embarrassed to admit that I always get confused between burritos, wet burritos, chimichangas, and enchiladas. Here are the descriptions, with the differences in bold and pictures following each description.

A flour tortilla wrapped around a filling (meat, beans, vegetables, etc)

wet burrito
A burrito that's covered in red chili sauce and cheese. Because of the sauce covering, it looks like an enchilada, but it's made with a flour tortilla, whereas the enchilada is made with a corn tortilla.

A burrito that's deep-fried. Sometimes covered with cheese or another topping.

A corn tortilla wrapped around a filling, covered with chili pepper sauce

Wikipedia: BurritoWikipedia: ChimichangaWikipedia: Enchilada

Edit scanned documents with Word 2007

Office 2007 includes support for converting scanned documents to editable text using OCR (optical character recognition). To get your text from a paper document to Word 2007:
In the Control Panel, open Add or Remove Programs.Find Microsoft Office, click it, and click Change.In the Office Installation Options window, expand Office Tools, click Microsoft Office Document Imaging, and select Run from My Computer from the dropdown.Click Continue or Next until you reach the end.You can now scan documents and convert the scanned images to editable text:
From the Start Menu, find Microsoft Office, then select Microsoft Office Tools, then click Microsoft Office Document Scanning.Choose your preset and options, then click Scan.The scanned image should open in Microsoft Office Document Imaging. To perform OCR and open the editable text in Word, click Tools, Send Text to Word.You can now edit and save the scanned document as a Word document.

My LASIK laser eye surgery experience

Yesterday was a turning point in my life; I had laser eye surgery (LASIK)! Here's a brief summary of my experience.

When I was 16, I barely passed the eye exam at the DMV, so they told me I had to see my eye doctor. Being a self-conscious geek, I opted for contacts over the stereotypical glasses. Although they were fine for most of the day, my contacts always dried out around 8 or 9 PM. My friends will tell you they got sick of my complaints that "my eyes feel like corks!" and "these contacts feel like sandpaper!"

Over the years, I've tried more than 10 different types of contacts, including extended wear, overnight wear, and high-moisture contacts. For a while, I even had contacts with bright blue artificial irises to cover my natural grayish ones. I got a lot of compliments, but they didn't help with the dryness.

I decided to put an end to the suffering this year. LASIK isn't cheap; reputable surgeons charge about $2000 per eye. It hurt to max out my…