File tree Expand file tree Collapse file tree 2 files changed +32
-3
lines changed
Expand file tree Collapse file tree 2 files changed +32
-3
lines changed Original file line number Diff line number Diff line change 1+ # =================================== #
2+ # Simple MSI Extractor install script #
3+ # kernaltrap #
4+ # Version 1.3 #
5+ # =================================== #
6+
7+ $ImportMSIExtractor = " `n Import-Module $HOME \Documents\PowerShell\Modules\MSI-Extractor.ps1"
8+ $MSIExtractorPath = " $PSScriptRoot /MSI-Extractor.ps1"
9+
10+ if (! (Test-Path - Path $ProfilePath )) {
11+ mkdir $HOME \Documents\PowerShell\Modules | Out-Null
12+ }
13+
14+ if (! (Test-Path - Path $PROFILE.CurrentUserAllHosts )) {
15+ New-Item - Type File - Path $PROFILE.CurrentUserAllHosts - Force
16+ }
17+
18+ if (! (Test-Path - Path $MSIExtractorPath )) {
19+ Throw " MSI-Extractor script is not present in this directory!"
20+ } else {
21+ Copy-Item $PSScriptRoot \MSI- Extractor.ps1 - Destination $HOME \Documents\PowerShell\Modules
22+ }
23+
24+ if (! (Test-Path - Path $ProfilePath )) {
25+ Throw " Cannot find Powershell profile script!"
26+ } else {
27+ Write-Output $ImportMSIExtractor > $PROFILE.CurrentUserAllHosts
28+ Write-Host " All tests passed, MSI-Extractor is installed."
29+ }
Original file line number Diff line number Diff line change @@ -36,13 +36,13 @@ $FolderBrowser.ShowDialog()
3636
3737msiexec.exe / a $FileBrowser.FileName TARGETDIR= " $ ( $FolderBrowser.SelectedPath ) " / qb
3838
39- Get-Process | ? {$_.path -eq $path } | Out-Null # Setup for Get-Process, this has a lot of output so it is directed to Out-Null (same as >$null)
39+ Get-Process | Where-Object {$_.path -eq $path } | Out-Null # Setup for Get-Process, this has a lot of output so it is directed to Out-Null (same as >$null)
4040
4141# If statement to check if msiexec is running, if not, end the program and display the Shell popup
4242
43- if (Get-Process | ? {$_.path -eq " C:\Windows\System32\msiexec.exe" }){
43+ if (Get-Process | Where-Object {$_.path -eq " C:\Windows\System32\msiexec.exe" }){
4444 Write-Output (" Extracting..." )
45- }else {
45+ } else {
4646 Write-Output (" Done! Go to the path you provided to see the contents." )
4747 $Shell.Popup (" MSI extracted." , 0 , " Thank you for using MSI Extractor" , 0 )
4848}
You can’t perform that action at this time.
0 commit comments