/build/static/layout/Breadcrumb_cap_w.png

Notepad++ 7.1

<#
Notepad++\setup.ps1

Uninstalls previous versions of Notepad++, and installs latest version.
Errata: 7.1: - Uninstall not silent, using Purge function instead of Uninstall function - Plugin manager not available with x64 yet, sticking with x86
.\Notepad++\setup.ps1 .\Notepad++\setup\npp.7.1.Installer.x64.exe .\Notepad++\setup\npp.7.1.Installer.x86.exe
Sailer, Adam 2016.10.18 #>

## Global Variables $invoke = split-path -path $myinvocation.mycommand.path -parent $os = gwmi Win32_OperatingSystem $proc = gwmi Win32_Processor $whatIf = $false

Function KillApps {     write-host "`n`n@@ Called KillApps" -fore Magenta
$array = get-process | ? { $_.Path -imatch 'notepad\+\+' } $array; $array | stop-process -force
dir $env:TEMP | remove-item -recurse -force -ea SilentlyContinue
}

Function Uninstall {     Param([string]$inp) write-host "`n`n@@ Called Uninstall" -fore Magenta if (!$inp) { Return } $paths = @( 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall', 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall' ) | ? { test-path $_ } dir $paths | gp | ? { $_.DisplayName -imatch $inp } | % { $item = $_ $item.UninstallString | ? { $_ } | % { $parent = (get-item $_).Directory $app = $_; $options = '/S' if ($_ -imatch 'msiexec') { $array = $_.Split(' {}') $app = $array[0]; $options = "/qn /x {$($array[2])} /norestart" } write-host "Uninstall : $($item.DisplayName) $($item.DisplayVersion)"             write-host $options -fore DarkGray if (!$whatIf) { $process = start-process -FilePath $app -ArgumentList $options -Wait -Passthru $process.ExitCode | ? { $_ -ne 0 } | % { write $_; exit $_ } } } } }
Function Purge { write-host "`n`n@@ Called Purge" -fore Magenta $paths = @( "$env:ProgramFiles\Notepad++" ,"${env:ProgramFiles(x86)}\Notepad++" ,"$env:AppData\Notepad++" ,"$env:ProgramData\Microsoft\Windows\Start Menu\Programs\Notepad++" ,"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Notepad++" ,"HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Notepad++" ) | ? { test-path $_ } $paths | remove-item -recurse -force -verbose -whatIf:$whatIf -ea SilentlyContinue }

Function Setup { write-host "`n`n@@ Called Setup" -fore Magenta
$ident = 'x86' ## $ident = if ($proc.AddressWidth -eq 64) { 'x64' } else { 'x86' }
dir $invoke\setup -recurse -include *.exe | ? { $_ -imatch $ident } | % {         $options = '/S' write-host "Setup : $($_.Name)"         write-host $options -fore DarkGray if (!$whatIf) { $env:SEE_MASK_NOZONECHECKS = 1 $process = start-process -FilePath $_ -ArgumentList $options -Wait -Passthru remove-item env:\SEE_MASK_NOZONECHECKS $process.ExitCode $process.ExitCode | ? { $_ -ne 0 } | % { write $_; exit $_ } }     } }
Function Perms { write-host "`n`n@@ Called Perms" -fore Magenta
$paths = @( "$env:ProgramFiles\Notepad++", "${env:ProgramFiles(x86)}\Notepad++" ) | ? { test-path $_ }
dir $paths | ? { $_ -imatch 'plugins' } | % { cacls $_.FullName /T /E /C /G Users:C } }
# #
Clear KillApps ## Uninstall '^Notepad\+\+' Purge Setup Perms

Comments

This post is locked
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ