I'm trying to run a simple powershell script in a package. It works exactly as it should outside of the package but it will not run.
No errors in any logs and as far as I can tell sccm is running the correct command and everything It just sits at installing in software center.
This is the script:
$restartneeded = "False"
Remove-Item C:\programdata\Sophos\AutoUpdate\Logs\ALUpdate*.log -ErrorAction SilentlyContinue
Start-Process -FilePath setup.exe -ArgumentList '-crt R -s '
DO
{
$restartneeded = Select-String -path C:\programdata\Sophos\AutoUpdate\Logs\ALUpdate*.log -Pattern "<ErrorMessage><ID>AutoUpdate.RebootNeeded</ID>" -quiet
} Until ($restartneeded -eq "True")
Restart-Computer -ComputerName localhost -Force
I tried just using the script as the program in sccm and I got errors.
So I tried running it like "powershell.exe -File .\script.ps1" and that's where it's just sitting doing nothing until the package times out.
Anybody know what could be causing this?