Jason Faulkner posted a very cool Batch script to freshen your library of Sysinternals tools over at SysAdminGeek.com. It queries the live.sysinternals.com\tools repository and downloads matching tools in your library. If you haven't already checked it out, you should (click here).
Here's a version I've done in VBScript. You can tweak it for your needs and even schedule it to run periodically to keep your tools up to date.
Const livetools = "\\live.sysinternals.com\tools"
Const localtools = "c:\sysinternals"
Set objFSO = CreateObject("Scripting.FileSystemObject")
On Error Resume Next
wscript.echo "info: connecting to live.sysinternal.com..."
Set objLiveFolder = objFSO.GetFolder(livetools)
If err.Number <> 0 Then
wscript.echo "fail: unable to connect"
wscript.quit(1)
End If
If objFSO.FolderExists(localTools) = False Then
wscript.echo "fail: local folder not found"
wscript.quit(2)
End If
For each objFile in objLiveFolder.Files
fileName = objFile.Name
If objFSO.FileExists(localtools & "\" & fileName) Then
wscript.echo "info: updating file " & fileName & "..."
sourceFile = liveTools & "\" & fileName
targetFile = localTools & "\" & fileName
objFSO.CopyFile sourceFile, targetFile, True
End If
Next
Set objFolder = Nothing
Set objFSO = Nothing
If I had more time I'd do this in KiXtart and Powershell, but I'll leave that to someone else. Enjoy!
No comments:
Post a Comment