Archive

Posts Tagged ‘download’

PowerShell Script to Download SysInternals Suite Files

February 28, 2012 Leave a comment

Below is a very simple PowerShell script to copy any new or newer versions of the SysInternals tools:

Set-Locationc:\temp\Sysinternals
$SysInternals=Get-ChildItem \\live.sysinternals.com\tools\*-Exclude *.txt, *.scr
foreach ($Filein$SysInternals) {
    if (Test-Path$File.Name) {
        if ($File.LastWriteTime-ne (get-Item$File.Name).LastWriteTime) {
            Write-Host$File.Nameis out of date. Downloading new version…   
            Copy-Item$file-Force
}
#end If LastWriteTime
            else {
               Write-Host$File.Nameis up to date.
}
#end If LastWriteTime
        } #end Test-Path
    else {
        Write-Host$File.Nameis new. Downloading…
        Copy-Item$file-Force
}
#end else Test-Path
} #end foreach $file

Advertisements