Write-Host "DISM and SFC" -ForegroundColor Cyan
Start-Transcript C:\DISM_SFC.txt
Start-Process -FilePath "dism.exe" -ArgumentList '/online /cleanup-image /analyzecomponentstore' -Wait -NoNewWindow
Start-Process -FilePath "dism.exe" -ArgumentList '/online /cleanup-image /startcomponentcleanup' -Wait -NoNewWindow
Start-Process -FilePath "dism.exe" -ArgumentList '/online /cleanup-image /checkhealth' -Wait -NoNewWindow
Start-Process -FilePath "dism.exe" -ArgumentList '/online /cleanup-image /scanhealth' -Wait -NoNewWindow
Start-Process -FilePath "dism.exe" -ArgumentList '/online /cleanup-image /restorehealth' -Wait -NoNewWindow
Start-Process -FilePath "sfc.exe" -ArgumentList '/scannow' -Wait -NoNewWindow
Stop-Transcript
Write-Host "DISM and SFC completed"`n -ForegroundColor Magenta
I'm trying to add Start-Transcript/Stop-Transcript to my tune-up script and I can't get it to work properly. It performs the commands, creates the text file, but doesn't add the results in the text file.
I think the issue is related to the -NoNewWindow but I'm kind of lost.