How Community Content is Supposed to Work

There is something interesting going on WRT "community content" at Microsoft. See the example over in Official Scripting Guys forum:

A customer asked for scripting help to check the OS version on his XP client machine and install patches.

The next day an MVP posted a script to help him:

1 Set objShell = CreateObject("WScript.Shell")  

2 Set objFSO = CreateObject("Scripting.FileSystemObject")  

3

4 strComputer = "."

5 Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")  

6 Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem WHERE Name LIKE '%Microsoft Windows XP%'")  

7 For Each objItem In colItems  

8 If objItem.CSDVersion = "Service Pack 3" Then

9 If CheckPatch("KB953760")=True then  

10          Wscript.Echo "Patch found."

11 Else

12           Wscript.Echo "Patch not found. Installing patch..."

13           objShell.Run "\\server\share\WindowsXP-kb953760-x86-ENU.exe /qn", ,TRUE  

14 End if  

15 End If

16 Next

17

18 Function CheckPatch(patch)  

19 Set objSession = CreateObject("Microsoft.Update.Session")  

20 Set objSearcher = objSession.CreateUpdateSearcher  

21 Set objResults = objSearcher.Search("Type='Software'")  

22 Set colUpdates = objResults.Updates  

23   Found = False

24   Result = 0  

25 For i = 0 to colUpdates.Count - 1  

26       Result = Instr(colUpdates.Item(i).Title, patch)  

27 If Result > 0 then  

28          Found = True

29 Exit For

30 End if  

31 Next

32   CheckPatch = Found  

33 End Function

Kudos to Salvador Manaois III, aboren and nckmrtn for helping out the original poster.

What can we do to make more this this happen? Leave comments.