Back in my early days I used Corel Draw for image editing and I’m suprised it still exist. Now it’s an expensive piece of software and therefore the free Paint.NET is an amazing supplement to Microsoft Paint. Below is the evergreen installation script.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# https://github.com/BronsonMagnan/SoftwareUpdate/blob/master/PaintDotNet.ps1 Function Get-PaintDotNetURl { [cmdletbinding()] [outputType([string])] $sourceUrl = "https://www.dotpdn.com/downloads/pdn.html" $raw = (wget -UseBasicParsing -Uri $sourceUrl) $multiline = $raw.content.split("`n").trim() $justtags = $multiline.replace("<","#$%^<").split("#$%^") $pattern = "paint\.net\S*(\d+\.)+\d\S*\.(zip|exe)" $relativehtml = ($justtags | Select-String -Pattern $pattern | Select-Object -First 1).tostring().trim() $relativeURL = $relativehtml.replace('<a href="','').replace('">','') $dotdotreplacement = "https://www.dotpdn.com" $finalurl = $relativeURL.replace("..",$dotdotreplacement) Write-Output $finalurl } function Get-PaintDotNetVersion { [cmdletbinding()] [outputType([Version])] $downloadurl = Get-PaintDotNetURl $filename = ($downloadurl.split('/') | select-string -Pattern "(\d+\.)+\d+" | select-object -first 1).tostring().trim() $filename -match "(\d+\.)+\d+" | Out-Null $fileversion = [Version]::new($matches[0]) Write-Output $fileversion } # PowerShell Wrapper for MDT, Standalone and Chocolatey Installation - (C)2015 xenappblog.com # Example 1: Start-Process "XenDesktopServerSetup.exe" -ArgumentList $unattendedArgs -Wait -Passthru # Example 2 Powershell: Start-Process powershell.exe -ExecutionPolicy bypass -file $Destination # Example 3 EXE (Always use ' '): # $UnattendedArgs='/qn' # (Start-Process "$PackageName.$InstallerType" $UnattendedArgs -Wait -Passthru).ExitCode # Example 4 MSI (Always use " "): # $UnattendedArgs = "/i $PackageName.$InstallerType ALLUSERS=1 /qn /liewa $LogApp" # (Start-Process msiexec.exe -ArgumentList $UnattendedArgs -Wait -Passthru).ExitCode Clear-Host Write-Verbose "Setting Arguments" -Verbose $StartDTM = (Get-Date) $Vendor = "Misc" $Product = "Paint Net" $PackageName = "PaintDotNet_x64" $Version = "$(Get-PaintDotNetVersion)" $InstallerType = "exe" $Source = "$PackageName" + "." + "$InstallerType" $LogPS = "${env:SystemRoot}" + "\Temp\$Vendor $Product $Version PS Wrapper.log" $LogApp = "${env:SystemRoot}" + "\Temp\$PackageName.log" $Destination = "${env:ChocoRepository}" + "\$Vendor\$Product\$Version\$packageName.$installerType" $UnattendedArgs='/auto' $URL = "$(Get-PaintDotNetURl)" Start-Transcript $LogPS if ( -Not (Test-Path -Path $Version ) ) { New-Item -ItemType directory -Path $Version CD $Version [Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls" Invoke-WebRequest -Uri $url -OutFile "$PackageName.zip" Expand-Archive -Path "$PackageName.zip" -DestinationPath . Remove-Item "$PackageName.zip" -Force Get-ChildItem *.exe | Rename-Item -NewName $Source } Else { Write-Verbose "File exists. Skipping Download." -Verbose CD $Version } Write-Verbose "Starting Installation of $Vendor $Product $Version" -Verbose (Start-Process "$PackageName.$InstallerType" $UnattendedArgs -Wait -Passthru).ExitCode Write-Verbose "Customization" -Verbose Write-Verbose "Stop logging" -Verbose $EndDTM = (Get-Date) Write-Verbose "Elapsed Time: $(($EndDTM-$StartDTM).TotalSeconds) Seconds" -Verbose Write-Verbose "Elapsed Time: $(($EndDTM-$StartDTM).TotalMinutes) Minutes" -Verbose Stop-Transcript |