In my quest to find the best method(s) for detecting if a system reboot is required, I came across the RebootNeeded script at www.wsus.nl.
This function determines if a reboot is needed due installation of patches.
Example
Code
'************* Example ************* If RebootNeeded() Then Wscript.Echo "A reboot is needed to complete the installation."Else Wscript.Echo "No reboot required!"End If
'****************************************************************************' Function RebootNeeded()'' Checks if a reboot is needed.'****************************************************************************Function RebootNeeded()
On Error Resume Next Dim objSystemInfo Dim flgRebootNeeded flgRebootNeeded = False Set objSystemInfo = WScript.CreateObject("Microsoft.Update.SystemInfo") If Err.Number <> 0 Then Wscript.Echo "Error creating [Microsoft.Update.SystemInfo] object 0x" & Right("0000000" & Hex(Err.Number), 8) & ": " & Err.Description Err.Clear End If flgRebootNeeded = objSystemInfo.rebootrequired Set objSystemInfo = Nothing
RebootNeeded = flgRebootNeeded
End Function
It is probably not evident from the code in the sample above, but the script must be run from the local system to determine if it requires a reboot for a patch to become fully installed.
There is another script (PatchesInstalling) over at the www.wsus.nl site which will determine if a patch installation is in progress.
Posted Monday, May 22, 2006 1:09 AM by dthomson | with no comments
I saw this blog post over at the Blogcast Repository the other day by Wayne Grixti. The post mentions a new SMS 2003 Client tool which was recently updated. Of course I had to check it out since I'm always open to better ways of doing things and also like to check out what other folks are doing in the community.
What I found were a bunch of tools which are being developed by Roger Zander and posted to www.SourceForge.net.
They are:
Even though I haven't had a change to give any of the tools a whirl, they do seem very intriguing. I suggest you go check them out and see if they warrant being included into your toolbox of applications.
Posted Sunday, May 21, 2006 11:21 PM by dthomson | with no comments
I was jumping around the Internet recently and came across Karl Prosser's blog. He has a pretty cool tool that he is developing for PowerShell. It is called the PowerShell Analyzer and is a graphical interface for editing and running PowerShell scripts.
Anyone interested in getting onboard with PowerShell scripting will want ot add this to their list of must have tools.
Here are a couple links:
Posted Sunday, May 21, 2006 11:11 PM by dthomson | with no comments
Posted Saturday, May 20, 2006 6:44 PM by dthomson | 1 comment(s)
Posted Saturday, May 20, 2006 6:43 PM by dthomson | with no comments
I was visiting www.allapi.com last night and came across this little tip on how to speed up code which performs actions against a database.
Instead of coding as follows:
Do While Not objRecordset.EOF 'Perform some action Loop
Do While Not objRecordset.EOF
'Perform some action
Loop
It is suggested that there can be as much as a 33% performance increase if the code is written as follows:
objRecordset.MoveLast intRecordCount = objRecordset.RecordCount objRecordset.MoveFirst For intCounter = 1 To intRecordCount 'Perform some action objRecordset.MoveNext Next **** OR **** intRecordCount = objRecordset.Count For intCounter = 1 To intRecordCount 'Perform some action objRecordset.MoveNext Next
objRecordset.MoveLast
intRecordCount = objRecordset.RecordCount
objRecordset.MoveFirst
For intCounter = 1 To intRecordCount
'Perform some action objRecordset.MoveNext
objRecordset.MoveNext
Next
**** OR ****
****
OR
intRecordCount = objRecordset.Count
The reason given for the potential performance gain is that every time the code goes through the loop in the first example, it has to determine if it is at the end of file. This is no longer done if using the second example. I haven't compared the performance of these methods, but the premise sounds logical.
The AllAPI site is geared toward Visual Basic 6.
Please visit the MSDN section Microsoft ActiveX Data Objects for information on using ADO in your code.
Posted Sunday, May 14, 2006 4:43 PM by dthomson | with no comments