Jump to content

Microsoft Update


Recommended Posts

mousemove()

mouseclick()

run()

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Link to comment
Share on other sites

dark lol with that command you cant make a script that works on computers with another resolution then is then ix the x and the y different(A) it needs to work in different computers

didn't you ment 'bout the user, did you ?

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Link to comment
Share on other sites

Someone else posted this the other day, so I take no credit.

#include <date.au3>

 $updateSession = ObjCreate("Microsoft.update.Session")
 $updateSearcher = $updateSession.CreateupdateSearcher()

ConsoleWrite ("Searching for updates..." & @CRLF)

 $searchResult = $updateSearcher.Search("IsInstalled=0 and Type='Software'")

ConsoleWrite ("List of applicable items on the machine:")
For $I = 0 To $searchResult.Updates.Count-1
     $update = $searchResult.Updates.Item($I)
    ConsoleWrite ($I + 1 & "> " & $update.Title & @CR)
Next

If $searchResult.Updates.Count = 0 Then
    ConsoleWrite ("There are no applicable updates.")
    Exit
EndIf

ConsoleWrite (@CRLF & "Creating collection of updates to download:")
 $updatesToDownload = ObjCreate("Microsoft.update.UpdateColl")

For $I = 0 to $searchResult.Updates.Count-1
     $update = $searchResult.Updates.Item($I)
    ConsoleWrite ($I + 1 & "> adding: " & $update.Title & @CR)
    $updatesToDownload.Add($update)
Next

ConsoleWrite (@CRLF & "Downloading updates...")
 $downloader = $updateSession.CreateUpdateDownloader() 
$downloader.Updates = $updatesToDownload
$downloader.Download()

ConsoleWrite ( @CRLF & "List of downloaded updates:")
For $I = 0 To $searchResult.Updates.Count-1
     $update = $searchResult.Updates.Item($I)
    If $update.IsDownloaded Then
       ConsoleWrite ($I + 1 & "> " & $update.Title & @CR)
    EndIf
Next

 $updatesToInstall = ObjCreate("Microsoft.update.UpdateColl")

ConsoleWrite ( @CRLF & "Creating collection of downloaded updates to install:" )
For $I = 0 To $searchResult.Updates.Count-1
     $update = $searchResult.Updates.Item($I)
    If $update.IsDownloaded = 1 Then
       ConsoleWrite ($I + 1 & "> adding:  " & $update.Title & @CR)
       $updatesToInstall.Add($update)
    EndIf
Next

ConsoleWrite (@CRLF & "Installing updates...")
     $installer = $updateSession.CreateUpdateInstaller()
    $installer.Updates = $updatesToInstall
     $installationResult = $installer.Install()
    
    ;Output results of install
    ConsoleWrite ("Installation Result: " & $installationResult.ResultCode )
    ConsoleWrite ("Listing of updates installed " & "and individual installation results:" )
    For $I = 0 to $updatesToInstall.Count - 1
        ConsoleWrite ($I + 1 & "> " & $updatesToInstall.Item($I).Title & ": " & $installationResult.GetUpdateResult($I).ResultCode & @CR)
    Next
Link to comment
Share on other sites

Someone else posted this the other day, so I take no credit.

#include <date.au3>

 $updateSession = ObjCreate("Microsoft.update.Session")
 $updateSearcher = $updateSession.CreateupdateSearcher()

ConsoleWrite ("Searching for updates..." & @CRLF)

 $searchResult = $updateSearcher.Search("IsInstalled=0 and Type='Software'")

ConsoleWrite ("List of applicable items on the machine:")
For $I = 0 To $searchResult.Updates.Count-1
     $update = $searchResult.Updates.Item($I)
    ConsoleWrite ($I + 1 & "> " & $update.Title & @CR)
Next

If $searchResult.Updates.Count = 0 Then
    ConsoleWrite ("There are no applicable updates.")
    Exit
EndIf

ConsoleWrite (@CRLF & "Creating collection of updates to download:")
 $updatesToDownload = ObjCreate("Microsoft.update.UpdateColl")

For $I = 0 to $searchResult.Updates.Count-1
     $update = $searchResult.Updates.Item($I)
    ConsoleWrite ($I + 1 & "> adding: " & $update.Title & @CR)
    $updatesToDownload.Add($update)
Next

ConsoleWrite (@CRLF & "Downloading updates...")
 $downloader = $updateSession.CreateUpdateDownloader() 
$downloader.Updates = $updatesToDownload
$downloader.Download()

ConsoleWrite ( @CRLF & "List of downloaded updates:")
For $I = 0 To $searchResult.Updates.Count-1
     $update = $searchResult.Updates.Item($I)
    If $update.IsDownloaded Then
       ConsoleWrite ($I + 1 & "> " & $update.Title & @CR)
    EndIf
Next

 $updatesToInstall = ObjCreate("Microsoft.update.UpdateColl")

ConsoleWrite ( @CRLF & "Creating collection of downloaded updates to install:" )
For $I = 0 To $searchResult.Updates.Count-1
     $update = $searchResult.Updates.Item($I)
    If $update.IsDownloaded = 1 Then
       ConsoleWrite ($I + 1 & "> adding:  " & $update.Title & @CR)
       $updatesToInstall.Add($update)
    EndIf
Next

ConsoleWrite (@CRLF & "Installing updates...")
     $installer = $updateSession.CreateUpdateInstaller()
    $installer.Updates = $updatesToInstall
     $installationResult = $installer.Install()
    
    ;Output results of install
    ConsoleWrite ("Installation Result: " & $installationResult.ResultCode )
    ConsoleWrite ("Listing of updates installed " & "and individual installation results:" )
    For $I = 0 to $updatesToInstall.Count - 1
        ConsoleWrite ($I + 1 & "> " & $updatesToInstall.Item($I).Title & ": " & $installationResult.GetUpdateResult($I).ResultCode & @CR)
    Next

hmm wehn i execute the code i see something below in autoit the code he is searching for updates thats nice and olso downloaden but then i get an error and secend i think this tool need a GUI because else you cant see whats happening??

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...