Check OS, Check Hotfix, Install if not present Hi all,<br>This may seem like a simple question, but Scripting is not my forte.<br><br>I'm trying to figure out a way to check that the client OS is XPsp3 and then look for the existence of the $NTUninstallKB953760$ folder, and if it is not present, to install \\server\share\WindowsXP-kb953760-x86-ENU.exe.<br><br>Any assistance or advice would be greatly appreciated.<br><br>Thanks, Mark© 2009 Microsoft Corporation. All rights reserved.Fri, 24 Oct 2008 16:17:44 Z734b2e6a-1092-4ed3-8a45-42c7f4ed3015http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/734b2e6a-1092-4ed3-8a45-42c7f4ed3015#734b2e6a-1092-4ed3-8a45-42c7f4ed3015http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/734b2e6a-1092-4ed3-8a45-42c7f4ed3015#734b2e6a-1092-4ed3-8a45-42c7f4ed3015Mark A. Wilsonhttp://social.technet.microsoft.com/Profile/en-US/?user=Mark%20A.%20WilsonCheck OS, Check Hotfix, Install if not present Hi all,<br>This may seem like a simple question, but Scripting is not my forte.<br><br>I'm trying to figure out a way to check that the client OS is XPsp3 and then look for the existence of the $NTUninstallKB953760$ folder, and if it is not present, to install \\server\share\WindowsXP-kb953760-x86-ENU.exe.<br><br>Any assistance or advice would be greatly appreciated.<br><br>Thanks, MarkTue, 21 Oct 2008 14:31:33 Z2008-10-21T14:31:33Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/734b2e6a-1092-4ed3-8a45-42c7f4ed3015#595934e9-760e-4977-8fea-44cf55288de7http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/734b2e6a-1092-4ed3-8a45-42c7f4ed3015#595934e9-760e-4977-8fea-44cf55288de7nckmrtnhttp://social.technet.microsoft.com/Profile/en-US/?user=nckmrtnCheck OS, Check Hotfix, Install if not presentHey Mark,<br><br>Give this a try:<br><br><div style="overflow:auto;background-color:white;line-height:100% ! important;font-family:Courier New;font-size:11px"><table style="border-width:0px;margin:2px 0px;width:99%;border-collapse:collapse;background-color:rgb(255, 255, 255)" cellpadding=0 cellspacing=0><col style="font-family:Courier New;font-size:11px;padding-left:10px;white-space:nowrap"><tbody><tr><td><font style="font-size:11px"></font><font style="color:blue">Set</font><font style="font-size:11px"> objShell = CreateObject(</font><font style="color:blue">&quot;WScript.Shell&quot;</font><font style="font-size:11px">) </font></td></tr><tr><td style="background-color:rgb(247, 247, 247)"><font style="color:blue">Set</font><font style="font-size:11px"> objFSO = CreateObject(</font><font style="color:blue">&quot;Scripting.FileSystemObject&quot;</font><font style="font-size:11px">) </font></td></tr><tr><td> </td></tr><tr><td style="background-color:rgb(247, 247, 247)">strComputer = <font style="color:blue">&quot;.&quot;</font><font style="font-size:11px"> </font></td></tr><tr><td><font style="color:blue">Set</font><font style="font-size:11px"> objWMIService = GetObject(</font><font style="color:blue">&quot;winmgmts:\\&quot;</font><font style="font-size:11px"> &amp; strComputer &amp; </font><font style="color:blue">&quot;\root\cimv2&quot;</font><font style="font-size:11px">) </font></td></tr><tr><td style="background-color:rgb(247, 247, 247)"><font style="color:blue">Set</font><font style="font-size:11px"> colItems = objWMIService.ExecQuery</font><font style="color:blue">(&quot;SELECT * FROM Win32_OperatingSystem WHERE Name LIKE '%Microsoft Windows XP%'&quot;)</font></td></tr><tr><td><font style="color:blue">For</font><font style="font-size:11px"> </font><font style="color:blue">Each</font><font style="font-size:11px"> objItem </font><font style="color:blue">In</font><font style="font-size:11px"> colItems </font></td></tr><tr><td style="background-color:rgb(247, 247, 247)">   <font style="color:blue">If</font><font style="font-size:11px"> objItem.CSDVersion = </font><font style="color:blue">&quot;Service Pack 3&quot;</font><font style="font-size:11px"> </font><font style="color:blue">Then</font><font style="font-size:11px"> </font></td></tr><tr><td>      <font style="color:blue">If</font><font style="font-size:11px"> objFSO.FolderExists(</font><font style="color:blue">&quot;C:\WINDOWS\$NTUninstallKB953760$&quot;</font><font style="font-size:11px">)=</font><font style="color:blue">False</font><font style="font-size:11px"> </font><font style="color:blue">Then</font><font style="font-size:11px"> </font></td></tr><tr><td style="background-color:rgb(247, 247, 247)">         objShell.Run <font style="color:blue">&quot;\\server\share\WindowsXP-kb953760-x86-ENU.exe /qn&quot;</font><font style="font-size:11px">, ,TRUE </font></td></tr><tr><td>      <font style="color:blue">End</font><font style="font-size:11px"> </font><font style="color:blue">If</font><font style="font-size:11px"> </font></td></tr><tr><td style="background-color:rgb(247, 247, 247)">   <font style="color:blue">End</font><font style="font-size:11px"> </font><font style="color:blue">If</font><font style="font-size:11px"> </font></td></tr><tr><td><font style="color:blue">Next</font><font style="font-size:11px"> </font></td></tr></tbody></table></div><br>-N<br> Tue, 21 Oct 2008 18:04:22 Z2008-10-21T18:12:42Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/734b2e6a-1092-4ed3-8a45-42c7f4ed3015#2f93bd11-9dfd-4c02-aafc-350a6a32ba76http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/734b2e6a-1092-4ed3-8a45-42c7f4ed3015#2f93bd11-9dfd-4c02-aafc-350a6a32ba76aborenhttp://social.technet.microsoft.com/Profile/en-US/?user=aborenCheck OS, Check Hotfix, Install if not present<div class=quote><font class=quoteHeader>nckmrtn said:</font> <p>Hey Mark,<br><br>Give this a try:<br><br> <div style="font-size:11px;overflow:auto;line-height:100%! important;font-family:Courier New;background-color:white"> <table style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;margin:2px 0px;width:99%;border-collapse:collapse;background-color:rgb(255,255,255);border-right-width:0px" cellspacing=0 cellpadding=0> <colgroup> <col style="padding-left:10px;font-size:11px;font-family:Courier New;white-space:nowrap"> <tbody> <tr> <td><font style="font-size:11px"></font><font style="color:blue">Set</font><font style="font-size:11px"> objShell = CreateObject(</font><font style="color:blue">&quot;WScript.Shell&quot;</font><font style="font-size:11px">) </font></td></tr> <tr> <td style="background-color:rgb(247,247,247)"><font style="color:blue">Set</font><font style="font-size:11px"> objFSO = CreateObject(</font><font style="color:blue">&quot;Scripting.FileSystemObject&quot;</font><font style="font-size:11px">) </font></td></tr> <tr> <td> </td></tr> <tr> <td style="background-color:rgb(247,247,247)">strComputer = <font style="color:blue">&quot;.&quot;</font><font style="font-size:11px"> </font></td></tr> <tr> <td><font style="color:blue">Set</font><font style="font-size:11px"> objWMIService = GetObject(</font><font style="color:blue">&quot;winmgmts:\\&quot;</font><font style="font-size:11px"> &amp; strComputer &amp; </font><font style="color:blue">&quot;\root\cimv2&quot;</font><font style="font-size:11px">) </font></td></tr> <tr> <td style="background-color:rgb(247,247,247)"><font style="color:blue">Set</font><font style="font-size:11px"> colItems = objWMIService.ExecQuery</font><font style="color:blue">(&quot;SELECT * FROM Win32_OperatingSystem WHERE Name LIKE '%Microsoft Windows XP%'&quot;)</font></td></tr> <tr> <td><font style="color:blue">For</font><font style="font-size:11px"> </font><font style="color:blue">Each</font><font style="font-size:11px"> objItem </font><font style="color:blue">In</font><font style="font-size:11px"> colItems </font></td></tr> <tr> <td style="background-color:rgb(247,247,247)">   <font style="color:blue">If</font><font style="font-size:11px"> objItem.CSDVersion = </font><font style="color:blue">&quot;Service Pack 3&quot;</font><font style="font-size:11px"> </font><font style="color:blue">Then' YES XP has SP3, then we check for patch</font></td></tr> <tr> <td>      <font style="color:blue">If</font><font style="font-size:11px"> objFSO.FolderExists(</font><font style="color:blue">&quot;C:\WINDOWS\$NTUninstallKB953760$&quot;</font><font style="font-size:11px">)=</font><font style="color:blue">False</font><font style="font-size:11px"> </font><font style="color:blue">Then'Nope patch is not here, lets install on next line</font></td></tr> <tr> <td style="background-color:rgb(247,247,247)">         objShell.Run <font style="color:blue">&quot;\\server\share\WindowsXP-kb953760-x86-ENU.exe /qn&quot;</font><font style="font-size:11px">, ,TRUE'Install patch from share</font></td></tr> <tr> <td>      <font style="color:blue">End</font><font style="font-size:11px"> </font><font style="color:blue">If</font><font style="font-size:11px"> </font></td></tr> <tr> <td style="background-color:rgb(247,247,247)">   <font style="color:blue">End</font><font style="font-size:11px"> </font><font style="color:blue">If</font><font style="font-size:11px"> </font></td></tr> <tr> <td><font style="color:blue">Next</font><font style="font-size:11px"> </font></td></tr></tbody></table></div><br>-N<br> <p></p></div><br><br>Put some small &quot;helpers&quot; in the script wich by itself is doing the job.<br>Checks for SP3 &amp; the actual hotfix.<br>Wed, 22 Oct 2008 05:39:21 Z2008-10-22T05:39:21Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/734b2e6a-1092-4ed3-8a45-42c7f4ed3015#9513ec86-9c68-4db7-b3b1-06ac219b94c2http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/734b2e6a-1092-4ed3-8a45-42c7f4ed3015#9513ec86-9c68-4db7-b3b1-06ac219b94c2Salvador Manaois IIIhttp://social.technet.microsoft.com/Profile/en-US/?user=Salvador%20Manaois%20IIICheck OS, Check Hotfix, Install if not present Hi Mark,<br><br>I modified your script a bit to check for whether the patch is installed instead of checking for the uninstall folder.<br><br> <div style="border-right:#7f9db9 1px solid;border-top:#7f9db9 1px solid;font-size:11px;overflow:auto;border-left:#7f9db9 1px solid;line-height:100%! important;border-bottom:#7f9db9 1px solid;font-family:Courier New;background-color:white"> <table style="border-top-width:0px;border-left-width:0px;margin:2px 0px;width:99%;border-bottom:#eee 0px solid;border-collapse:collapse;background-color:#fff;border-right-width:0px" cellspacing=0 cellpadding=0> <colgroup> <col style="border-right:gray 1px solid;padding-right:5px;padding-left:10px;font-size:11px;vertical-align:top;width:5px;color:gray;font-family:Courier New;background-color:#eee;text-align:right"> <col style="padding-left:10px;font-size:11px;border-bottom:#f7f7f7 1px solid;font-family:Courier New;white-space:nowrap"> <tbody> <tr> <td><nobr>1</nobr></td> <td><font style="font-size:11px"></font><font style="color:blue">Set</font><font style="font-size:11px"> objShell = CreateObject(</font><font style="color:blue">&quot;WScript.Shell&quot;</font><font style="font-size:11px">)  </font></td></tr> <tr> <td><nobr>2</nobr></td> <td style="background-color:#f7f7f7"></font><font style="color:blue">Set</font><font style="font-size:11px"> objFSO = CreateObject(</font><font style="color:blue">&quot;Scripting.FileSystemObject&quot;</font><font style="font-size:11px">)  </font></td></tr> <tr> <td><nobr>3</nobr></td> <td> </td></tr> <tr> <td><nobr>4</nobr></td> <td style="background-color:#f7f7f7">strComputer = </font><font style="color:blue">&quot;.&quot;</font><font style="font-size:11px"> </font></td></tr> <tr> <td><nobr>5</nobr></td> <td></font><font style="color:blue">Set</font><font style="font-size:11px"> objWMIService = GetObject(</font><font style="color:blue">&quot;winmgmts:\\&quot;</font><font style="font-size:11px"> &amp; strComputer &amp; </font><font style="color:blue">&quot;\root\cimv2&quot;</font><font style="font-size:11px">)  </font></td></tr> <tr> <td><nobr>6</nobr></td> <td style="background-color:#f7f7f7"></font><font style="color:blue">Set</font><font style="font-size:11px"> colItems = objWMIService.ExecQuery(</font><font style="color:blue">&quot;SELECT * FROM Win32_OperatingSystem WHERE Name LIKE '%Microsoft Windows XP%'&quot;</font><font style="font-size:11px">)  </font></td></tr> <tr> <td><nobr>7</nobr></td> <td></font><font style="color:blue">For</font><font style="font-size:11px"> </font><font style="color:blue">Each</font><font style="font-size:11px"> objItem </font><font style="color:blue">In</font><font style="font-size:11px"> colItems  </font></td></tr> <tr> <td><nobr>8</nobr></td> <td style="background-color:#f7f7f7">   </font><font style="color:blue">If</font><font style="font-size:11px"> objItem.CSDVersion = </font><font style="color:blue">&quot;Service Pack 3&quot;</font><font style="font-size:11px"> </font><font style="color:blue">Then</font><font style="font-size:11px"> </font></td></tr> <tr> <td><nobr>9</nobr></td> <td>      </font><font style="color:blue">If</font><font style="font-size:11px"> CheckPatch(</font><font style="color:blue">&quot;KB953760&quot;</font><font style="font-size:11px">)=</font><font style="color:blue">True</font><font style="font-size:11px"> then  </font></td></tr> <tr> <td><nobr>10</nobr></td> <td style="background-color:#f7f7f7">         Wscript.Echo </font><font style="color:blue">&quot;Patch found.&quot;</font><font style="font-size:11px"> </font></td></tr> <tr> <td><nobr>11</nobr></td> <td>      </font><font style="color:blue">Else</font><font style="font-size:11px"> </font></td></tr> <tr> <td><nobr>12</nobr></td> <td style="background-color:#f7f7f7">          Wscript.Echo </font><font style="color:blue">&quot;Patch not found. Installing patch...&quot;</font><font style="font-size:11px"> </font></td></tr> <tr> <td><nobr>13</nobr></td> <td>          objShell.Run </font><font style="color:blue">&quot;\\server\share\WindowsXP-kb953760-x86-ENU.exe /qn&quot;</font><font style="font-size:11px">, ,TRUE  </font></td></tr> <tr> <td><nobr>14</nobr></td> <td style="background-color:#f7f7f7">      </font><font style="color:blue">End</font><font style="font-size:11px"> if  </font></td></tr> <tr> <td><nobr>15</nobr></td> <td>   </font><font style="color:blue">End</font><font style="font-size:11px"> </font><font style="color:blue">If</font><font style="font-size:11px"> </font></td></tr> <tr> <td><nobr>16</nobr></td> <td style="background-color:#f7f7f7"></font><font style="color:blue">Next</font><font style="font-size:11px"> </font></td></tr> <tr> <td><nobr>17</nobr></td> <td> </td></tr> <tr> <td><nobr>18</nobr></td> <td style="background-color:#f7f7f7"></font><font style="color:blue">Function</font><font style="font-size:11px"> CheckPatch(patch)  </font></td></tr> <tr> <td><nobr>19</nobr></td> <td>  </font><font style="color:blue">Set</font><font style="font-size:11px"> objSession = CreateObject(</font><font style="color:blue">&quot;Microsoft.Update.Session&quot;</font><font style="font-size:11px">)  </font></td></tr> <tr> <td><nobr>20</nobr></td> <td style="background-color:#f7f7f7">  </font><font style="color:blue">Set</font><font style="font-size:11px"> objSearcher = objSession.CreateUpdateSearcher  </font></td></tr> <tr> <td><nobr>21</nobr></td> <td>  </font><font style="color:blue">Set</font><font style="font-size:11px"> objResults = objSearcher.Search(</font><font style="color:blue">&quot;Type='Software'&quot;</font><font style="font-size:11px">)  </font></td></tr> <tr> <td><nobr>22</nobr></td> <td style="background-color:#f7f7f7">  </font><font style="color:blue">Set</font><font style="font-size:11px"> colUpdates = objResults.Updates  </font></td></tr> <tr> <td><nobr>23</nobr></td> <td>  Found = </font><font style="color:blue">False</font><font style="font-size:11px"> </font></td></tr> <tr> <td><nobr>24</nobr></td> <td style="background-color:#f7f7f7">  Result = 0  </td></tr> <tr> <td><nobr>25</nobr></td> <td>  </font><font style="color:blue">For</font><font style="font-size:11px"> i = 0 to colUpdates.Count - 1  </font></td></tr> <tr> <td><nobr>26</nobr></td> <td style="background-color:#f7f7f7">      Result = Instr(colUpdates.Item(i).Title, patch)  </td></tr> <tr> <td><nobr>27</nobr></td> <td>       </font><font style="color:blue">If</font><font style="font-size:11px"> Result &gt; 0 then  </font></td></tr> <tr> <td><nobr>28</nobr></td> <td style="background-color:#f7f7f7">         Found = </font><font style="color:blue">True</font><font style="font-size:11px"> </font></td></tr> <tr> <td><nobr>29</nobr></td> <td>         </font><font style="color:blue">Exit</font><font style="font-size:11px"> </font><font style="color:blue">For</font><font style="font-size:11px"> </font></td></tr> <tr> <td><nobr>30</nobr></td> <td style="background-color:#f7f7f7">       </font><font style="color:blue">End</font><font style="font-size:11px"> if  </font></td></tr> <tr> <td><nobr>31</nobr></td> <td>  </font><font style="color:blue">Next</font><font style="font-size:11px"> </font></td></tr> <tr> <td><nobr>32</nobr></td> <td style="background-color:#f7f7f7">  CheckPatch = Found  </td></tr> <tr> <td><nobr>33</nobr></td> <td></font><font style="color:blue">End</font><font style="font-size:11px"> </font><font style="color:blue">Function</font><font style="font-size:11px"> </font></td></tr></tbody></table></div><br>Regards,<br><br>Salvador Manaois III <br>MCSE MCSA CEH MCITP | <em>Enterprise/Server Admin</em> <br><strong>Bytes &amp; Badz </strong>: <a href="http://badzmanaois.blogspot.com/">http://badzmanaois.blogspot.com</a>Wed, 22 Oct 2008 06:24:11 Z2008-10-22T06:24:11Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/734b2e6a-1092-4ed3-8a45-42c7f4ed3015#17e7d280-b08f-488e-bdc8-6975a5275a7chttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/734b2e6a-1092-4ed3-8a45-42c7f4ed3015#17e7d280-b08f-488e-bdc8-6975a5275a7cMark A. Wilsonhttp://social.technet.microsoft.com/Profile/en-US/?user=Mark%20A.%20WilsonCheck OS, Check Hotfix, Install if not present Thanks so much for your assistance guys!Wed, 22 Oct 2008 15:55:12 Z2008-10-22T15:55:12Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/734b2e6a-1092-4ed3-8a45-42c7f4ed3015#10e680ae-d7e3-42be-b7bf-a185695fa2ebhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/734b2e6a-1092-4ed3-8a45-42c7f4ed3015#10e680ae-d7e3-42be-b7bf-a185695fa2ebEdward Hydehttp://social.technet.microsoft.com/Profile/en-US/?user=Edward%20HydeCheck OS, Check Hotfix, Install if not present Any way to run this against remote computers where the person logged on is only in the users group?Fri, 24 Oct 2008 14:38:13 Z2008-10-24T14:38:13Zhttp://social.technet.microsoft.com/Forums/en-US/ITCG/thread/734b2e6a-1092-4ed3-8a45-42c7f4ed3015#b1814285-9e96-436c-9b4b-11cbbf30f121http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/734b2e6a-1092-4ed3-8a45-42c7f4ed3015#b1814285-9e96-436c-9b4b-11cbbf30f121Salvador Manaois IIIhttp://social.technet.microsoft.com/Profile/en-US/?user=Salvador%20Manaois%20IIICheck OS, Check Hotfix, Install if not present Not possible as the script is installing an OS patch; non-admins will not be able to accomplish this task. Use WSUS if you want to install patches on your clients without explicitly granting users admin rights on their machines.<br><br><a href="http://technet.microsoft.com/en-us/wsus/default.aspx">http://technet.microsoft.com/en-us/wsus/default.aspx</a><br><br>Regards,<br><br><strong>Salvador Manaois III </strong><br>MCSE MCSA CEH MCITP | <em>Enterprise/Server Admin</em> <br><strong>Bytes &amp; Badz</strong> : <a href="http://badzmanaois.blogspot.com/">http://badzmanaois.blogspot.com</a><br><br>Fri, 24 Oct 2008 16:17:44 Z2008-10-24T16:17:44Z