diff --git a/Get Scripts/Get - New Versions of Software.ps1 b/Get Scripts/Get - New Versions of Software.ps1 new file mode 100644 index 0000000..ce6d234 --- /dev/null +++ b/Get Scripts/Get - New Versions of Software.ps1 @@ -0,0 +1,954 @@ +#Change to working directory of the folders holding the downloads +cd "C:\Temp\Scripting Cache\3rd Party Patches" + +#This script will check updates for: +#Chrome 64-bit +#Firefox 64-bit and 32-bit +#Edge 64-bit +#Java JRE 64-bit and 32-bit +#Adobe Reader 64-bit and 32-bit +#Adobe Acrobat 64-bit and 32-bit +#7-zip +#Notepad++ +#Keepass +#Putty 64-bit and 32-bit +#WinSCP +#WinZip +#Wireshark +#Zoom +#Cisco Webex +#GoToMeeting +#Amazon Corretto JDK +#Teams + + + #main function to donwload the program +function downloadProgram ($readVersion, $version, $download, $name) { + Write-Host "LOCAL VERSION: $readVersion" + Write-Host "WEB__ VERSION: $version" + Write-Host "LINK: $download" + Write-Host "FILENAME: $name" + Write-Host " " + If(!(test-path -PathType container $folderName)) +{ + New-Item -ItemType Directory -Path $folderName +} + If ($readVersion -lt $version) { + Write-Host "Newer Version Found Online!" + Write-Host "Downloading" + $start_time = Get-Date + Invoke-WebRequest "$download" -outfile "$name" + Write-Output "Completed in: $((Get-Date).Subtract($start_time).Seconds) seconds" + Get-FileHash "$name" -Algorithm md5 | Out-File "$folderName\$folderName hash.txt" + } else { + Write-Host "No Newer Version Found." + } +} + +#################################################################################### + + function Chrome { + #VARIABLES + $initialURL = "https://versionhistory.googleapis.com/v1/chrome/platforms/win64/channels/stable/versions" + $folderName = "Chrome" + $filenamePrefix = "Chrome-x64" + $filenameExtension = "exe" + $defaultVersion = "0.0.0.0" + ############### + + #finds latest version from online + $programVERSION = Invoke-RestMethod "$initialURL" | Select-Object -ExpandProperty versions | Select-Object -ExpandProperty version | Select-Object -First 1 + $programDOWNLOAD = "https://dl.google.com/chrome/install/latest/chrome_installer.exe" + #################################################### + + #verifying/comparing version already downloaded to what is online + $programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension" + $programREAD = Get-ChildItem ".\$folderName\" -name | Sort-Object -Descending | Select-Object -First 1 + if ($programREAD.length -eq 0) { + $programREADVERSION = "$defaultVersion" + } else { + $programREADVERSION = $programREAD -replace("$filenamePrefix-","") -replace(".$filenameExtension","") + } + #calling to download function above to download program + downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME + ################### + } + + +function Firefox { + #VARIABLES + $initialURL = "https://product-details.mozilla.org/1.0/firefox_versions.json" + $folderName = "firefox" + $filenamePrefix = "Firefox-x64" + $filenameExtension = "exe" + $defaultVersion = "0.0.0.0" + ############### + + #finds latest version from online + $firefoxVersions = (Invoke-WebRequest -UseBasicParsing "$initialURL").Content | ConvertFrom-Json + $programVersionLookup =$firefoxVersions.LATEST_FIREFOX_VERSION + + #more variables + $programVERSION = "$programVersionLookup" + $programDOWNLOAD = "https://download.mozilla.org/?product=firefox-latest-ssl&os=win64&lang=en-US" + #################################################### + + #verifying/comparing version already downloaded to what is online + $programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension" + $programREAD = Get-ChildItem ".\$folderName\" -name | Sort-Object -Descending | Select-Object -First 1 + if ($programREAD.length -eq 0) { + $programREADVERSION = "$defaultVersion" + } else { + $programREADVERSION = $programREAD -replace("$filenamePrefix-","") -replace(".$filenameExtension","") + } + #calling to download function above to download program + downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME + ################### +} + + +function Edge { + #VARIABLES + $initialURL = "https://edgeupdates.microsoft.com/api/products?view=enterprise" + $folderName = "edge" + $filenamePrefix = "Edge-x64" + $filenameExtension = "msi" + $defaultVersion = "0.0.0.0" + ############### + + #finds latest version from online + $Program = Invoke-WebRequest -UseBasicParsing "$initialURL" | ConvertFrom-Json + + #more variables + $programVERSION = $Program | Where-Object {$_.Product -eq "Stable"} | Select-Object -ExpandProperty Releases | Where-Object {$_.Platform -eq "Windows" -and $_.Architecture -eq "x64"} | Sort-Object -Property ProductVersion -Descending | Select-Object -First 1 | Select-Object -ExpandProperty ProductVersion + $programDOWNLOAD = $Program | Where-Object {$_.Product -eq "Stable"} | Select-Object -ExpandProperty Releases | Where-Object {$_.Platform -eq "Windows" -and $_.Architecture -eq "x64"} | Sort-Object -Property ProductVersion -Descending | Select-Object -First 1 | Select-Object -ExpandProperty Artifacts | Select-Object -ExpandProperty Location + #################################################### + + #verifying/comparing version already downloaded to what is online + $programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension" + $programREAD = Get-ChildItem ".\$folderName\" -name | Sort-Object -Descending | Select-Object -First 1 + if ($programREAD.length -eq 0) { + $programREADVERSION = "$defaultVersion" + } else { + $programREADVERSION = $programREAD -replace("$filenamePrefix-","") -replace(".$filenameExtension","") + } + #calling to download function above to download program + downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME + ################### +} + + +function Java64 { + #VARIABLES + $initialURL = "https://www.oracle.com/java/technologies/downloads/#jdk19-windows" + $folderName = "java jre 64bit" + $filenamePrefix = "jre-x64" + $filenameExtension = "exe" + $defaultVersion = "0.0.0" + ############### + + #finds latest version from online + $program = (Invoke-WebRequest -UseBasicParsing "$initialURL").Links."data-file" -like ("*.exe") | Sort-Object -Descending | Select-Object -First 1 + $programVersionLookup = $program.substring(88) + $javaversion = $programVersionLookup.Substring(0,$programVersionLookup.Length-16) + + #more variables + $programVERSION = "$javaversion" + $programDOWNLOAD = "https://javadl.oracle.com/webapps/download/AutoDL?BundleId=247947_0ae14417abb444ebb02b9815e2103550" + #################################################### + + #verifying/comparing version already downloaded to what is online + $programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension" + $programREAD = Get-ChildItem ".\$folderName\" -name | Sort-Object -Descending | Select-Object -First 1 + if ($programREAD.length -eq 0) { + $programREADVERSION = "$defaultVersion" + } else { + $programREADVERSION = $programREAD -replace("$filenamePrefix-","") -replace(".$filenameExtension","") + } + #calling to download function above to download program + downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME + ################### +} + + +function Java32 { + #VARIABLES + $initialURL = "https://www.oracle.com/java/technologies/downloads/#jdk19-windows" + $folderName = "java jre 32bit" + $filenamePrefix = "jre-x32" + $filenameExtension = "exe" + $defaultVersion = "0.0.0" + ############### + + #finds latest version from online + $program = (Invoke-WebRequest -UseBasicParsing "$initialURL").Links."data-file" -like ("*.exe") | Sort-Object -Descending | Select-Object -Skip 2 | Select-Object -First 1 + $programVersionLookup = $program.substring(88) + $javaversion = $programVersionLookup.Substring(0,$programVersionLookup.Length-17) + + #more variables + $programVERSION = "$javaversion" + $programDOWNLOAD = "https://javadl.oracle.com/webapps/download/AutoDL?BundleId=247945_0ae14417abb444ebb02b9815e2103550" + #################################################### + + #verifying/comparing version already downloaded to what is online + $programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension" + $programREAD = Get-ChildItem ".\$folderName\" -name | Sort-Object -Descending | Select-Object -First 1 + if ($programREAD.length -eq 0) { + $programREADVERSION = "$defaultVersion" + } else { + $programREADVERSION = $programREAD -replace("$filenamePrefix-","") -replace(".$filenameExtension","") + } + #calling to download function above to download program + downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME + ################### +} + + +function AdobeReader64 { + #VARIABLES + #$initialURL = "https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html#" + $folderName = "adobe reader update 64bit" + $filenamePrefix = "Adobe-Reader-x64" + $filenameExtension = "msp" + $defaultVersion = "0.0.0.0" + ############### + + + #finds latest version from online + # Define a script block that contains the Invoke-WebRequest command + $scriptBlock = { + (Invoke-WebRequest -UseBasicParsing "https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html#").Links.outerHTML -like "*continuous/*" | Select-Object -First 2 | Select-Object -Last 1} + + #Start a new PowerShell background job and pass the script block to it + $job = Start-Job -ScriptBlock $scriptBlock + + #Wait for the job to complete + Wait-Job $job + + #Get the output from the job and display it + $output = Receive-Job $job + $Test = $output.Substring(125) + $Test2 = $Test.Substring(0,$test.Length-38) + $Version = $Test2 -replace "[^\d*\.?\d*$/]" , '' + + + #Gets second half of URL of newest version + $psi = New-Object System.Diagnostics.ProcessStartInfo + $psi.FileName = 'powershell.exe' + $psi.Arguments = "(Invoke-WebRequest -UseBasicParsing 'https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html#').Links.href -like 'continuous/*' | Select-Object -First 1" + $psi.RedirectStandardOutput = $true + $psi.UseShellExecute = $false + + $process = [System.Diagnostics.Process]::Start($psi) + $output = $process.StandardOutput.ReadToEnd() + $process.WaitForExit() + + #combines the first and second half URLs for latest version's URL + $CombinedURL = "https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/$output" + + #gets link + $psi = New-Object System.Diagnostics.ProcessStartInfo + $psi.FileName = 'powershell.exe' + $psi.Arguments = "(Invoke-WebRequest -UseBasicParsing '$CombinedURL').Links.href -like '*AcroRdrDCx64*' | Select-Object -First 1" + $psi.RedirectStandardOutput = $true + $psi.UseShellExecute = $false + + $process = [System.Diagnostics.Process]::Start($psi) + $programDOWNLOAD = $process.StandardOutput.ReadToEnd() + $process.WaitForExit() + + $programVERSION = $Version + #################################################### + + #verifying/comparing version already downloaded to what is online + $programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension" + $programREAD = Get-ChildItem ".\$folderName\" -name | Sort-Object -Descending | Select-Object -First 1 + if ($programREAD.length -eq 0) { + $programREADVERSION = "$defaultVersion" + } else { + $programREADVERSION = $programREAD -replace("$filenamePrefix-","") -replace(".$filenameExtension","") + } + #calling to download function above to download program + downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME + ################### +} + + +function AdobeReader32 { + #VARIABLES + #$initialURL = "https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html#" + $folderName = "adobe reader update 32bit" + $filenamePrefix = "Adobe-Reader-x32" + $filenameExtension = "msp" + $defaultVersion = "0.0.0.0" + ############### + + + #findslatest version from online + # Define a script block that contains the Invoke-WebRequest command + $scriptBlock = { + (Invoke-WebRequest -UseBasicParsing "https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html#").Links.outerHTML -like "*continuous/*" | Select-Object -First 2 | Select-Object -Last 1} + + #Start a new PowerShell background job and pass the script block to it + $job = Start-Job -ScriptBlock $scriptBlock + + #Wait for the job to complete + Wait-Job $job + + #Get the output from the job and display it + $output = Receive-Job $job + $Test = $output.Substring(125) + $Test2 = $Test.Substring(0,$test.Length-38) + $Version = $Test2 -replace "[^\d*\.?\d*$/]" , '' + + + #Gets second half of URL of newest version + $psi = New-Object System.Diagnostics.ProcessStartInfo + $psi.FileName = 'powershell.exe' + $psi.Arguments = "(Invoke-WebRequest -UseBasicParsing 'https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html#').Links.href -like 'continuous/*' | Select-Object -First 1" + $psi.RedirectStandardOutput = $true + $psi.UseShellExecute = $false + + $process = [System.Diagnostics.Process]::Start($psi) + $output = $process.StandardOutput.ReadToEnd() + $process.WaitForExit() + + #combines the first and second half URLs for latest version's URL + $CombinedURL = "https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/$output" + + #gets link + $psi = New-Object System.Diagnostics.ProcessStartInfo + $psi.FileName = 'powershell.exe' + $psi.Arguments = "(Invoke-WebRequest -UseBasicParsing '$CombinedURL').Links.href -like '*AcroRdrDCUpd*' | Select-Object -First 1" + $psi.RedirectStandardOutput = $true + $psi.UseShellExecute = $false + + $process = [System.Diagnostics.Process]::Start($psi) + $programDOWNLOAD = $process.StandardOutput.ReadToEnd() + $process.WaitForExit() + + $programVERSION = $Version + #################################################### + + #verifying/comparing version already downloaded to what is online + $programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension" + $programREAD = Get-ChildItem ".\$folderName\" -name | Sort-Object -Descending | Select-Object -First 1 + if ($programREAD.length -eq 0) { + $programREADVERSION = "$defaultVersion" + } else { + $programREADVERSION = $programREAD -replace("$filenamePrefix-","") -replace(".$filenameExtension","") + } + #calling to download function above to download program + downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME + ################### +} + + +function AdobeAcrobat64 { + #VARIABLES + #$initialURL = "https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html#" + $folderName = "adobe acrobat update 64bit" + $filenamePrefix = "Adobe-Acrobat-x64" + $filenameExtension = "msp" + $defaultVersion = "0.0.0.0" + ############### + + + #finds latest version from online + # Define a script block that contains the Invoke-WebRequest command + $scriptBlock = { + (Invoke-WebRequest -UseBasicParsing "https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html#").Links.outerHTML -like "*continuous/*" | Select-Object -First 2 | Select-Object -Last 1} + + #Start a new PowerShell background job and pass the script block to it + $job = Start-Job -ScriptBlock $scriptBlock + + #Wait for the job to complete + Wait-Job $job + + #Get the output from the job and display it + $output = Receive-Job $job + $Test = $output.Substring(125) + $Test2 = $Test.Substring(0,$test.Length-38) + $Version = $Test2 -replace "[^\d*\.?\d*$/]" , '' + + + #Gets second half of URL of newest version + $psi = New-Object System.Diagnostics.ProcessStartInfo + $psi.FileName = 'powershell.exe' + $psi.Arguments = "(Invoke-WebRequest -UseBasicParsing 'https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html#').Links.href -like 'continuous/*' | Select-Object -First 1" + $psi.RedirectStandardOutput = $true + $psi.UseShellExecute = $false + + $process = [System.Diagnostics.Process]::Start($psi) + $output = $process.StandardOutput.ReadToEnd() + $process.WaitForExit() + + #combines the first and second half URLs for latest version's URL + $CombinedURL = "https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/$output" + + #gets link + $psi = New-Object System.Diagnostics.ProcessStartInfo + $psi.FileName = 'powershell.exe' + $psi.Arguments = "(Invoke-WebRequest -UseBasicParsing '$CombinedURL').Links.href -like '*AcrobatDCx64*' | Select-Object -First 1" + $psi.RedirectStandardOutput = $true + $psi.UseShellExecute = $false + + $process = [System.Diagnostics.Process]::Start($psi) + $programDOWNLOAD = $process.StandardOutput.ReadToEnd() + $process.WaitForExit() + + $programVERSION = $Version + #################################################### + + #verifying/comparing version already downloaded to what is online + $programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension" + $programREAD = Get-ChildItem ".\$folderName\" -name | Sort-Object -Descending | Select-Object -First 1 + if ($programREAD.length -eq 0) { + $programREADVERSION = "$defaultVersion" + } else { + $programREADVERSION = $programREAD -replace("$filenamePrefix-","") -replace(".$filenameExtension","") + } + #calling to download function above to download program + downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME + ################### +} + + +function AdobeAcrobat32 { + #VARIABLES + #$initialURL = "https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html#" + $folderName = "adobe acrobat update 32bit" + $filenamePrefix = "Adobe-Acrobat-x32" + $filenameExtension = "msp" + $defaultVersion = "0.0.0.0" + ############### + + + #finds latest version from online + # Define a script block that contains the Invoke-WebRequest command + $scriptBlock = { + (Invoke-WebRequest -UseBasicParsing "https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html#").Links.outerHTML -like "*continuous/*" | Select-Object -First 2 | Select-Object -Last 1} + + #Start a new PowerShell background job and pass the script block to it + $job = Start-Job -ScriptBlock $scriptBlock + + #Wait for the job to complete + Wait-Job $job + + #Get the output from the job and display it + $output = Receive-Job $job + $Test = $output.Substring(125) + $Test2 = $Test.Substring(0,$test.Length-38) + $Version = $Test2 -replace "[^\d*\.?\d*$/]" , '' + + #Gets second half of URL of newest version + $psi = New-Object System.Diagnostics.ProcessStartInfo + $psi.FileName = 'powershell.exe' + $psi.Arguments = "(Invoke-WebRequest -UseBasicParsing 'https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html#').Links.href -like 'continuous/*' | Select-Object -First 1" + $psi.RedirectStandardOutput = $true + $psi.UseShellExecute = $false + + $process = [System.Diagnostics.Process]::Start($psi) + $output = $process.StandardOutput.ReadToEnd() + $process.WaitForExit() + + #combines the first and second half URLs for latest version's URL + $CombinedURL = "https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/$output" + + #gets link + $psi = New-Object System.Diagnostics.ProcessStartInfo + $psi.FileName = 'powershell.exe' + $psi.Arguments = "(Invoke-WebRequest -UseBasicParsing '$CombinedURL').Links.href -like '*AcrobatDCUpd*' | Select-Object -First 1" + $psi.RedirectStandardOutput = $true + $psi.UseShellExecute = $false + + $process = [System.Diagnostics.Process]::Start($psi) + $programDOWNLOAD = $process.StandardOutput.ReadToEnd() + $process.WaitForExit() + + $programVERSION = $Version + #################################################### + + #verifying/comparing version already downloaded to what is online + $programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension" + $programREAD = Get-ChildItem ".\$folderName\" -name | Sort-Object -Descending | Select-Object -First 1 + if ($programREAD.length -eq 0) { + $programREADVERSION = "$defaultVersion" + } else { + $programREADVERSION = $programREAD -replace("$filenamePrefix-","") -replace(".$filenameExtension","") + } + #calling to download function above to download program + downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME + ################### +} + + +function 7zip { + #VARIABLES + $initialURL = "https://www.7-zip.org/" + $folderName = "7-zip" + $filenamePrefix = "7zip-x64" + $filenameExtension = "exe" + $defaultVersion = "0.0.0" + ############### + + #finds latest version from online + $program = (Invoke-webRequest "$initialURL").Links.href | where-object {$_.EndsWith("exe")} | Select-Object -First 1 + $programVersionLookup = $program.substring(4,$program.Length-12) + + #more variables + $programVERSION = "$programVersionLookup" + $programDOWNLOAD = $initialURL + $program + #################################################### + + #verifying/comparing version already downloaded to what is online + $programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension" + $programREAD = Get-ChildItem ".\$folderName\" -name | Sort-Object -Descending | Select-Object -First 1 + if ($programREAD.length -eq 0) { + $programREADVERSION = "$defaultVersion" + } else { + $programREADVERSION = $programREAD -replace("$filenamePrefix-","") -replace(".$filenameExtension","") + } + #calling to download function above to download program + downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME + ################### +} + + +function Notepad++ { + #VARIABLES + $initialURL = "https://notepad-plus-plus.org/downloads/" + $folderName = "notepad++" + $filenamePrefix = "npp-x64" + $filenameExtension = "exe" + $defaultVersion = "0.0.0" + ############### + + #finds latest version from online + $program = (Invoke-webRequest "$initialURL").Links.href | Where-Object {$_.ToLower().StartsWith("https")} | Select-Object -First 1 + $programVersionLookup = (Invoke-WebRequest "$program").Links.href | Where-Object{ $_.EndsWith("exe") } | Select-Object -First 1 + + #more variables + $Test = $programVersionLookup.Substring(73) + $programVERSION = $Test.Substring(0,$test.Length-26) + $programDOWNLOAD = $programVersionLookup + #################################################### + + #verifying/comparing version already downloaded to what is online + $programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension" + $programREAD = Get-ChildItem ".\$folderName\" -name | Sort-Object -Descending | Select-Object -First 1 + if ($programREAD.length -eq 0) { + $programREADVERSION = "$defaultVersion" + } else { + $programREADVERSION = $programREAD -replace("$filenamePrefix-","") -replace(".$filenameExtension","") + } + #calling to download function above to download program + downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME + ################### +} + + +function Keepass { + #VARIABLES + $initialURL = " https://keepass.info/download.html" + $folderName = "keepass" + $filenamePrefix = "Keepass-x64" + $filenameExtension = "exe" + $defaultVersion = "0.0.0" + ############### + + #finds latest version from online + $program = (Invoke-webRequest -UseBasicParsing "$initialURL").Links.href | where-object {$_.EndsWith("download")} | Select-Object -First 1 + + #more variables + $str = $program + $start = 61 + $len = 4 + $programVERSION = $str.Substring($start, [Math]::Min(($str.Length - $start), $len)) + #################################################### + + #verifying/comparing version already downloaded to what is online + $programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension" + $programREAD = Get-ChildItem ".\$folderName\" -name | Sort-Object -Descending | Select-Object -First 1 + if ($programREAD.length -eq 0) { + $programREADVERSION = "$defaultVersion" + } else { + $programREADVERSION = $programREAD -replace("$filenamePrefix-","") -replace(".$filenameExtension","") + } + #calling to download function above to download program + downloadKeepass $programREADVERSION $programVERSION $programFILENAME +} + + function downloadKeepass ($readVersion, $version, $name) { + Write-Host "LOCAL VERSION: $readVersion" + Write-Host "WEB__ VERSION: $version" + Write-Host "FILENAME: $name" + Write-Host " " + If(!(test-path -PathType container $folderName)) +{ + New-Item -ItemType Directory -Path $folderName +} + If ($readVersion -lt $version) { + Write-Host "Newer Version Found Online!" + Write-Host "Downloading" + $start_time = Get-Date + Invoke-WebRequest -UseBasicParsing -UserAgent "Wget" "https://sourceforge.net/projects/keepass/files/latest/download" -outfile "$name" + Write-Output "Completed in: $((Get-Date).Subtract($start_time).Seconds) seconds" + } else { + Write-Host "No Newer Version Found." + } +} + + +function Putty { + #VARIABLES + $initialURL = "https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html" + $folderName = "putty" + $filenamePrefix = "putty-x64" + $filenameExtension = "msi" + $defaultVersion = "0.0.0" + ############### + + #finds latest version from online + $program = (Invoke-webRequest "$initialURL").Links.href | Where-Object {$_.ToLower().StartsWith("https")} | Where-Object { $_.EndsWith("msi")} | Select-Object -First 1 + $Test = $program.Substring(58) + $Test2 = $Test.Substring(0,$test.Length-5) + $programVERSION = $Test2 -replace "[^\d*\.?\d*$/]" , '' + $programDOWNLOAD = $program + #################################################### + + #verifying/comparing version already downloaded to what is online + $programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension" + $programREAD = Get-ChildItem ".\$folderName\" -name | Sort-Object -Descending | Select-Object -First 1 + if ($programREAD.length -eq 0) { + $programREADVERSION = "$defaultVersion" + } else { + $programREADVERSION = $programREAD -replace("$filenamePrefix-","") -replace(".$filenameExtension","") + } + #calling to download function above to download program + downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME + ################### +} + + +function WinSCP { + #VARIABLES + $initialURL = "https://winscp.net/eng/download.php" + $folderName = "winscp" + $filenamePrefix = "winscp-x64" + $filenameExtension = "exe" + $defaultVersion = "0.0.0" + ############### + + #finds latest version from online + $program = (Invoke-webRequest -UseBasicParsing "$initialURL").Links.href | Where-Object { $_.EndsWith("exe")} | Select-Object -First 1 + $Test = $program.Substring(10) + $Test2 = $Test.Substring(0,$test.Length-4) + $programVERSION = $Test2 -replace "[^\d*\.?\d*$/]" , '' + $programDOWNLOAD = (Invoke-WebRequest -UseBasicParsing "https://winscp.net$program").Links.href -like "*Setup.exe*" | Select-Object -First 1 + #################################################### + + #verifying/comparing version already downloaded to what is online + $programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension" + $programREAD = Get-ChildItem ".\$folderName\" -name | Sort-Object -Descending | Select-Object -First 1 + if ($programREAD.length -eq 0) { + $programREADVERSION = "$defaultVersion" + } else { + $programREADVERSION = $programREAD -replace("$filenamePrefix-","") -replace(".$filenameExtension","") + } + #calling to download function above to download program + downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME + ################### +} + + +function WinZip { + #VARIABLES + $initialURL = "https://www.winzip.com/en/download/winzip/" + $folderName = "winzip" + $filenamePrefix = "winzip-x64" + $filenameExtension = "exe" + $defaultVersion = "0.0.0" + ############### + + #finds latest version from online + $program = (Invoke-webRequest -UseBasicParsing "$initialURL").Links.href -like "*exe*" | Select-Object -First 1 + $Test = $program.Substring(25) + $Test2 = $Test.Substring(0,$test.Length-4) + $programVERSION = $Test2 -replace "[^\d*\.?/\d*]" , '' -replace "/" , '' + $programDOWNLOAD = "$program" + #################################################### + + #verifying/comparing version already downloaded to what is online + $programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension" + $programREAD = Get-ChildItem ".\$folderName\" -name | Sort-Object -Descending | Select-Object -First 1 + if ($programREAD.length -eq 0) { + $programREADVERSION = "$defaultVersion" + } else { + $programREADVERSION = $programREAD -replace("$filenamePrefix-","") -replace(".$filenameExtension","") + } + #calling to download function above to download program + downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME + ################### +} + + +function Wireshark { + #VARIABLES + $initialURL = "https://www.wireshark.org/download.html" + $folderName = "wireshark" + $filenamePrefix = "wireshark-x64" + $filenameExtension = "exe" + $defaultVersion = "0.0.0" + ############### + + #finds latest version from online + $program = (Invoke-webRequest -UseBasicParsing "$initialURL").Links.href -like "*exe*" | Select-Object -First 1 + $Test = $program.Substring(51) + $Test2 = $Test.Substring(0,$test.Length-4) + $programVERSION = $Test2 -replace "[^\d*\.?/\d*]" , '' -replace "/" , '' + $programDOWNLOAD = "$program" + #################################################### + + #verifying/comparing version already downloaded to what is online + $programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension" + $programREAD = Get-ChildItem ".\$folderName\" -name | Sort-Object -Descending | Select-Object -First 1 + if ($programREAD.length -eq 0) { + $programREADVERSION = "$defaultVersion" + } else { + $programREADVERSION = $programREAD -replace("$filenamePrefix-","") -replace(".$filenameExtension","") + } + #calling to download function above to download program + downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME + ################### +} + + +function Zoom { + #VARIABLES + $initialURL = "https://zoom.us/rest/download?os=win" + $folderName = "zoom" + $filenamePrefix = "zoom-x64" + $filenameExtension = "msi" + $defaultVersion = "0.0.0" + ############### + + #finds latest version from online + $programVERSION = (Invoke-RestMethod "$initialURL").result.downloadVO.zoomX64.version + $programDOWNLOAD = "https://zoom.us/client/latest/ZoomInstallerFull.msi?archType=x64" + #################################################### + + #verifying/comparing version already downloaded to what is online + $programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension" + $programREAD = Get-ChildItem ".\$folderName\" -name | Sort-Object -Descending | Select-Object -First 1 + if ($programREAD.length -eq 0) { + $programREADVERSION = "$defaultVersion" + } + else {$programREADVERSION = $programREAD -replace("$filenamePrefix-","") -replace(".$filenameExtension","")} + + #calling to download function above to download program + downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME + ################### +} + + +function ZoomPlugin { + #VARIABLES + $initialURL = "https://zoom.us/rest/download?os=win" + $folderName = "zoom plugin" + $filenamePrefix = "zoom-plugin" + $filenameExtension = "msi" + $defaultVersion = "0.0.0" + ############### + + #finds latest version from online + $programVERSION = (Invoke-RestMethod "$initialURL").result.downloadVO.outlookPlugin.version + $programDOWNLOAD = "https://zoom.us/client/latest/ZoomOutlookPluginSetup.msi" + #################################################### + + #verifying/comparing version already downloaded to what is online + $programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension" + $programREAD = Get-ChildItem ".\$folderName\" -name | Sort-Object -Descending | Select-Object -First 1 + if ($programREAD.length -eq 0) { + $programREADVERSION = "$defaultVersion" + } + else {$programREADVERSION = $programREAD -replace("$filenamePrefix-","") -replace(".$filenameExtension","")} + + #calling to download function above to download program + downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME + ################### +} + + +function AmazonCorretto { + #VARIABLES + $initialURL = "https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/downloads-list.html" + $folderName = "amazon corretto jdk" + $filenamePrefix = "Corretto-JDK-x32" + $filenameExtension = "msi" + $defaultVersion = "0.0.0.0" + ############### + + #finds latest version from online + $Program = (Invoke-WebRequest -UseBasicParsing "$initialURL").Links.href -like "*msi*" -like "*jdk*" -like "*x86*" | Select-Object -First 1 + $request = [System.Net.WebRequest]::Create($Program) + $request.AllowAutoRedirect=$false + $response=$request.GetResponse() + $Version = If ($response.StatusCode -eq "Found") {$response.GetResponseHeader("Location")} + + #more variables + $Test = $Version.Substring(32) + $Test2 = $Test.Substring(0,$test.Length-4) + $programVERSION = $Test2 -replace "[^\d*\.?/\d*]" , '' -replace "/" , '' + $programDOWNLOAD = $Program + #################################################### + + #verifying/comparing version already downloaded to what is online + $programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension" + $programREAD = Get-ChildItem ".\$folderName\" -name | Sort-Object -Descending | Select-Object -First 1 + if ($programREAD.length -eq 0) { + $programREADVERSION = "$defaultVersion" + } else { + $programREADVERSION = $programREAD -replace("$filenamePrefix-","") -replace(".$filenameExtension","") + } + #calling to download function above to download program + downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME + ################### +} + + +function Webex { + #VARIABLES + $initialURL = "https://help.webex.com/en-us/article/mqkve8/Webex-App-%7C-Release-notes" + $folderName = "webex" + $filenamePrefix = "webex-x64" + $filenameExtension = "msi" + $defaultVersion = "0.0.0" + ############### + + #finds latest version from online + $program = (Invoke-WebRequest -UseBasicParsing $initialURL).Links | Where-Object {$_.outerHTML -like '" and "<" characters to extract the text content + $text = $html.Split([char[]]@(">", "<"), [StringSplitOptions]::RemoveEmptyEntries) + + # Find the start and end index of the table + $startIndex = $text.IndexOf("Windows version history") + $endIndex = $text.IndexOf("Sovereign cloud versions") + + # Extract the table rows + $rows = $text[$startIndex..$endIndex] + + # Filter out only the rows containing version numbers + $versions = $rows | Where-Object { $_ -match "\d+\.\d+\.\d+" } | ForEach-Object { $_ -replace " ", "" } + + #more variables + $programVERSION = $versions | Select-Object -First 1 + $programDOWNLOAD = "https://teams.microsoft.com/downloads/desktopurl?env=production&plat=windows&arch=x64&managedInstaller=true&download=true" + #################################################### + + #verifying/comparing version already downloaded to what is online + $programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension" + $programREAD = Get-ChildItem ".\$folderName\" -name | Sort-Object -Descending | Select-Object -First 1 + if ($programREAD.length -eq 0) { + $programREADVERSION = "$defaultVersion" + } else { + $programREADVERSION = $programREAD -replace("$filenamePrefix-","") -replace(".$filenameExtension","") + } + #calling to download function above to download program + downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME + ################### +} + +Chrome +Firefox +Edge +Java64 +Java32 +AdobeReader64 +AdobeReader32 +AdobeAcrobat64 +AdobeAcrobat32 +7zip +Notepad++ +Keepass +Putty +WinSCP +WinZip +Wireshark +Zoom +ZoomPlugin +AmazonCorretto +Webex +GoToMeeting +Teams + +Write-Host "SCRIPT COMPLETE" +Write-Host "Exiting" \ No newline at end of file