Page 1 of 1 1
Topic Options
#206585 - 2013-01-22 09:35 PM Is this kix-convertable?
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
Hi guys! \:\)

It was so long ago I scripted, I've forgotten my favorite hate-subject, getting COM-syntax to work ;\)

Is this KiX:able? If so, any kind soul that can help me out?

 Code:
Dim hideupdates(7)
hideupdates(0) = "Microsoft Security Essentials - KB2267621"
hideupdates(1) = "Microsoft Security Essentials - KB2691894"
hideupdates(2) = "Bing Desktop"
hideupdates(3) = "Windows Internet Explorer 9 for Windows 7"
hideupdates(4) = "Windows Internet Explorer 9 for Windows 7 for x64-based Systems"
hideupdates(5) = "KB971033"
hideupdates(6) = "Update for Windows 7 for x64-based Systems (KB971033)"
hideupdates(7) = "KB2483139"

set updateSession = createObject("Microsoft.Update.Session")
set updateSearcher = updateSession.CreateupdateSearcher()

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

For i = 0 To searchResult.Updates.Count-1
	set update = searchResult.Updates.Item(i)
	For j = LBound(hideupdates) To UBound(hideupdates) 
		'MsgBox hideupdates(j)
		if instr(1, update.Title, hideupdates(j), vbTextCompare) = 0 then
	  		'Wscript.echo "No match found for " & hideupdates(j)
		else
			Wscript.echo "Hiding " & hideupdates(j)
			update.IsHidden = True
		end if
	Next
Next
_________________________
The tart is out there

Top
#206586 - 2013-01-23 12:32 AM Re: Is this kix-convertable? [Re: masken]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Look at the WUS Library on my web site - there are a handful of WUS-related UDFs in the library that you might be able to use as-is or with minimal modification.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#206588 - 2013-01-23 11:36 AM Re: Is this kix-convertable? [Re: Glenn Barnas]
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
Awesome Glenn, thanks alot \:\)
_________________________
The tart is out there

Top
#206589 - 2013-01-23 12:26 PM Re: Is this kix-convertable? [Re: masken]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
Just cos I like converting code:
 Code:
Dim $hideupdates[7]
$hideupdates[0] = "Microsoft Security Essentials - KB2267621"
$hideupdates[1] = "Microsoft Security Essentials - KB2691894"
$hideupdates[2] = "Bing Desktop"
$hideupdates[3] = "Windows Internet Explorer 9 for Windows 7"
$hideupdates[4] = "Windows Internet Explorer 9 for Windows 7 for x64-based Systems"
$hideupdates[5] = "KB971033"
$hideupdates[6] = "Update for Windows 7 for x64-based Systems (KB971033)"
$hideupdates[7] = "KB2483139"

Dim $updateSession, $updateSearcher, $searchResult, $i, $j, $update
$updateSession = CreateObject("Microsoft.Update.Session")
$updateSearcher = $updateSession.CreateupdateSearcher()
$searchResult = $updateSearcher.Search("IsInstalled=0 and Type='Software'")

For $i=0 To $searchResult.Updates.Count-1
  $update = $searchResult.Updates.Item($i)
  For $j=0 To UBound($hideupdates) 
    ;$=MessageBox($hideupdates[$j],"Info")
    If NOT Instr($update.Title, $hideupdates[$j])
      ;? "No match found for " + $hideupdates[$j]
    Else
      ? "Hiding " + $hideupdates[$j]
      $update.IsHidden = 1
    EndIf
  Next
Next

Top
#206590 - 2013-01-23 01:06 PM Re: Is this kix-convertable? [Re: masken]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Back on the main site, there's a full package with sample code, plus - I just posted some questions in the Lounge regarding a Windows Service for managing updates.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#206594 - 2013-01-24 10:18 AM Re: Is this kix-convertable? [Re: Glenn Barnas]
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
Thanks again \:\)
_________________________
The tart is out there

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 456 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.061 seconds in which 0.033 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org