Successful Script deployment but Atera shows failed - No output

Basically the title - I made a PS script and ran it from Atera on a machine which I had next to me physically. The script worked and it did what it was supposed to, but the Atera console showed no output and said the deployment failed. Not sure why, any help would be appreciated!

Comments

  • AlexYoungNSM
    AlexYoungNSM Member Posts: 21 ✭✭

    I think this happens if it either times out, or if you don't have an output on the script. Can you supply the script at all? just so i can help?

  • alexmendez
    alexmendez Member Posts: 9

    @AlexYoungNSM Here is the script - The script panel window did say timed out after a while, so that might be it.

    Run script as Admin

    Start-Process PowerShell -verb runas -ArgumentList '-noexit','-File','RemoveBloatFiles.ps1'

    Empty Recycling bin

    Write-Host "Emptying Recyle Bin" -ForegroundColor Yellow
    $Path = 'C' + ':$Recycle.Bin'
    Get-ChildItem $Path -Force -Recurse -ErrorAction SilentlyContinue | Remove-Item -Recurse -Exclude *.ini -ErrorAction SilentlyContinue
    Write-Host "All the necessary data removed from recycle bin successfully" -ForegroundColor Green

    Delete Temp files in various locations

    Write-Host "Erasing temporary files from various locations" -ForegroundColor Yellow
    $Path1 = 'C' + ':\Windows\Temp'
    Get-ChildItem $Path1 -Force -Recurse -ErrorAction SilentlyContinue | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
    $Path2 = 'C' + ':\Windows\Prefetch'
    Get-ChildItem $Path2 -Force -Recurse -ErrorAction SilentlyContinue | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
    $Path3 = 'C' + ':\Users\User\AppData\Local\Temp'
    Get-ChildItem $Path3 -Force -Recurse -ErrorAction SilentlyContinue | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
    Write-Host "Removed all the temp files successfully" -ForegroundColor Green

    Clean disk using Disk Cleanmgr

    Write-Host "Using disk cleaup tool" -ForegroundColor Yellow
    Cleanmgr /sagerun:1 | out-Null
    Write-Host "Disk cleanup successfully done" -ForegroundColor Green
    Start-Sleep -seconds 5

    Run an SFC scannow to remove corrupt files

    Write-Host "Running SFC Scan to fix corrupt files" -ForegroundColor Yellow
    Start-Process -FilePath "sfc.exe" -Verb RunAs -ArgumentList "/scannow" -Wait
    Write-Host "SFC Scan Completed Successfully" -ForegroundColor Green
    Start-Sleep -Seconds 5

    Restart Computer

    Restart-Computer