Skip to content

Commit

Permalink
Fix adwcleaner not working (yikes!) (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeDragoX committed Apr 6, 2023
1 parent c57ed8e commit 92d5c27
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/lib/Open-File.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function Open-PowerShellFilesCollection {
$LastAccessUtc = "v$((Get-Item "$FileName").LastWriteTimeUtc | Get-Date -Format "yyyy-MM-dd")"
$Private:Counter = Write-TitleCounter "$FileName ($LastAccessUtc)" -Counter $Counter -MaxLength $Scripts.Length
If ($OpenFromGUI) {
Import-Module -DisableNameChecking .\"$FileName" -Force
Import-Module .\"$FileName" -Force
} Else {
PowerShell -NoProfile -ExecutionPolicy Bypass -File .\"$FileName"
}
Expand Down
15 changes: 8 additions & 7 deletions src/lib/Request-FileDownload.psm1
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
Import-Module BitsTransfer
Import-Module -DisableNameChecking "$PSScriptRoot\Get-TempScriptFolder.psm1"
Import-Module -DisableNameChecking "$PSScriptRoot\Title-Templates.psm1"

function Request-FileDownload {
[CmdletBinding()]
[OutputType([String])]
[OutputType([String[]])]
param (
[Alias('URI')]
[Parameter(Position = 0, Mandatory)]
Expand All @@ -16,29 +17,29 @@ function Request-FileDownload {
[String] $OutputFile,
[Alias('RelativeFolder')]
[Parameter(Position = 3)]
[String] $ExtendFolder = ""
[String] $ExtendFolder
)

Write-Verbose "[?] I'm at: $PWD"
Write-Verbose "[?] Downloading at: $OutputFolder + $ExtendFolder"
Write-Verbose "START '$OutputFolder' $($OutputFolder.GetType())"

If ($ExtendFolder) {
$OutputFolder = Join-Path -Path $OutputFolder -ChildPath $ExtendFolder
}

If (!(Test-Path $OutputFolder)) {
Write-Status -Types "@" -Status "$OutputFolder doesn't exist, creating folder..."
New-Item -Path $OutputFolder -ItemType Directory
New-Item -Path $OutputFolder -ItemType Directory -Force
}

[String] $FileLocation = $(Join-Path -Path $OutputFolder -ChildPath "$OutputFile")
$FileLocation = Join-Path -Path $OutputFolder -ChildPath $OutputFile

Import-Module BitsTransfer
Write-Host
Write-Status -Types "@" -Status "Downloading from: '$FileURI' as '$OutputFile'"
Write-Status -Types "@" -Status "On: '$FileLocation'"
Start-BitsTransfer -Dynamic -RetryTimeout 60 -TransferType Download -Source $FileURI -Destination $FileLocation
Start-BitsTransfer -Source "$FileURI" -Destination "$FileLocation" -Dynamic -DisplayName $OutputFile -TransferType Download | Wait-Job

Write-Verbose "END '$FileLocation' $($FileLocation.GetType())"
return "$FileLocation"
}

Expand Down
4 changes: 2 additions & 2 deletions src/scripts/Use-DebloatSoftware.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ function Use-DebloatSoftware() {

If (!$Revert) {
$AdwCleanerDl = "https://downloads.malwarebytes.com/file/adwcleaner"
[String] $AdwCleanerOutput = Request-FileDownload -FileURI $AdwCleanerDl -OutputFile "adwcleaner.exe"
$AdwCleanerOutput = (Request-FileDownload -FileURI $AdwCleanerDl -OutputFile "adwcleaner.exe")[-1]
Write-Status -Types "+" -Status "Running MalwareBytes AdwCleaner scanner..."
Start-Process -FilePath "$AdwCleanerOutput" -ArgumentList "/eula", "/clean", "/noreboot" -Wait
Start-Process -FilePath "$AdwCleanerOutput" -ArgumentList '/eula', '/clean', '/noreboot' -Wait
Remove-ItemVerified $AdwCleanerOutput -Force
}

Expand Down

0 comments on commit 92d5c27

Please sign in to comment.