Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Set Test = GetObject("winmgmts:{impersonationLevel=impersonate}!\\").ExecQuery _
- ("select * from Win32_PingStatus where address = 'www.msftconnecttest.com'")
- For Each Result in Test
- If Result.Statuscode = 0 Then
- Call Check_for_updates
- Wscript.quit
- Else
- result = MsgBox (_
- "Internet connection seems unavailable." & vbNewLine &_
- "Do you still want to check for updates?", vbYesNo + vbQuestion,_
- "No Internet connection")
- Select Case result
- Case vbYes
- Call Check_for_updates
- Case vbNo
- WScript.Quit
- End Select
- End If
- Next
- '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Sub Check_for_updates
- Set Job = CreateObject("Microsoft.Update.Session")
- Set Task = Job.CreateupdateSearcher()
- Set Result = Task.Search("IsInstalled=0 and Type='Software' and IsHidden=0")
- If Result.Updates.Count = 0 Then
- WScript.Quit
- Else
- Total = Result.Updates.Count
- End If
- '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Special_1 = "KB2267602" 'Definition updates for Windows Defender
- '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- For Number = 0 To Result.Updates.Count-1
- Set Title = Result.Updates.Item (Number)
- '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- If instr (Title, Special_1) <> 0 Then
- Createobject("wscript.shell").Run("""C:\Program Files\Windows Defender\MpCmdRun.exe"" ""-SignatureUpdate"""), 0
- Total = Total - 1
- End If
- Next
- '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- If Total = 0 Then
- WScript.Quit
- End If
- '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- result = MsgBox (_
- "(" & Total & ") updates have been found." & vbNewLine &_
- "Do you want to run Windows Update MiniTool?", vbYesNo + vbQuestion,_
- "Updates are available")
- Select Case result
- Case vbYes
- CreateObject("wscript.shell").run("""C:\the path to Windows Update MiniTool\wumt_x64.exe""")
- Case vbNo
- WScript.Quit
- End Select
- '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- End Sub
- '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Advertisement
Add Comment
Please, Sign In to add comment