Upgrading Software with Vbscript

1513 words 7 pages



Table of Contents

1) Introduction3
Requirement for system administration3
2) Description of program4
Contents of program4 How it works4
3) Source Code with detailed comments5
Source Code contains a minimum 5 out of 6 topics learned during this session.5
4) Source Code continued6 Notes on the output 13 Screenshots of the output 13
5) Conclusion14 Possible future uses14
6) References15

Our company is currently planning to automate many different system administration tasks. I have researched a system administration task, in this case upgrading software using VBScript. I have included a proposal that describes
…show more content…

dates list file " & strFile & "created successfully"
End If

set objFile = nothing

' OpenTextFile Method needs a Const value
' ForAppending = 8 ForReading = 1, ForWriting = 2
Const ForAppending = 8 'Constant values used
Set objTextFile = objFSO.OpenTextFile(strFile, ForAppending, True)

'update session and updatesearcher objects help in connection and searching for updates
Set updateSession = CreateObject("Microsoft.Update.Session")
Set updateSearcher = updateSession.CreateupdateSearcher()

'checks for windows update updateSearcher.ServerSelection = ssWindowsUpdate
Set searchResult = updateSearcher.Search("IsInstalled=0 and Type='Software'")

WScript.Echo "List of applicable items on the machine:"

'this loop displays the list of available updates
For I = 0 To searchResult.Updates.Count-1

'update opject stores the search result item from microsoft website Set update = searchResult.Updates.Item(I)

'display the update on console WScript.Echo I + 1 & "> " & update.Title

'store the value of update.Title in strText for writing to file strText = I + 1 & "> " & update.Title

' Writes strText every time you run this VBScript objTextFile.WriteLine(strText)

'This condition checks if updates are already installed and applicable or not
If searchResult.Updates.Count = 0 Then WScript.Echo "There are no applicable updates." WScript.Quit
End If