ninja-one/new-build-ppkg.ps1
|
begin { } process { try { # check to see if the NewBuild.ppkg file exists in the public desktop folder $filePath = "$env:PUBLIC\Desktop\install\NewBuild.ppkg" if (!(Test-Path $filePath)) { throw "NewBuild.ppkg file not found in the public desktop folder." } Install-ProvisioningPackage -PackagePath $filePath -QuietInstall -ForceInstall -ErrorAction Stop Write-Output '[INFO] NewBuild.ppkg file installed successfully.' exit 0 } catch { # output the error and the line it came from Write-Host "[ERROR]: $_" Write-Host "Line: $($_.InvocationInfo.ScriptLineNumber)" exit 1 } } end { } |