MISC.‎ > ‎

Download Sysinternals Tools (Powershell)

This is a Powershell function that connects to Sysinternals Live Shared Folder (\\live.sysinternals.com\tools) and downloads all the new tools available in the site.

This function is from ScriptFantic Site

I wrote a script that completes this one, and creates also the help files for each tool.

Get-SysinternalsHelp


Download The Script

 


function Get-SysInternals {

   param ( $sysIntDir="C:\Downloads\SysInternals Progs\" )

   

   if( !$sysIntDir.endsWith("\")) { $sysIntDir+="\" }

   $log = join-path $sysIntDir "changes.log"

   add-content -force $log -value "`n`n[$(get-date)]SysInternals sync has started"


      dir \\live.sysinternals.com\tools -recurse | foreach { 

         $fileName = $_.name

         $localFile = join-path $sysIntDir $_.name                  

         $exist = test-path $localFile

         

         $msgNew = "new utility found: $fileName , downloading..."

         $msgUpdate = "file : $fileName  is newer, updating..."

         $msgNoChange = "nothing changed for: $fileName"

         

         if($exist){


            if($_.lastWriteTime -gt (get-item $localFile).lastWriteTime){

               copy-item $_.fullname $sysIntDir -force

               write-host $msgUpdate -fore yellow

               add-content -force $log -value $msgUpdate

            } else {

               add-content $log -force -value $msgNoChange

               write-host $msgNoChange

            }


          } else {


               if($_.extension -eq ".exe") {

                  write-host $msgNew -fore green

                  add-content -force $log -value $msgNew

               } 


               copy-item $_.fullname $sysIntDir -force 

         }

   }

}

Comments