Skip to content

Instantly share code, notes, and snippets.

@danjpadgett
Last active July 6, 2017 01:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danjpadgett/f77371870a34ef992b6d to your computer and use it in GitHub Desktop.
Save danjpadgett/f77371870a34ef992b6d to your computer and use it in GitHub Desktop.
#Load SCCM TS Environment, Hide TS Progress to see error window.
$TS = New-Object -ComObject "Microsoft.SMS.TSEnvironment"
$T1 = New-Object -ComObject "Microsoft.SMS.TsProgressUI"
$T1.CloseProgressDialog()
#Stop CM Trace Prompting for Default Viewer.
reg add HKCU\SOFTWARE\Microsoft\Trace32 /V "Register File Types" /d 0 /f
#Load Form Code
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
#$SMSTSPackageName = $TS.Value("_SMSTSPackageName")
#$OSDComputerName = $TS.Value("OSDComputerName")
#$SMSTSLogPath = $TS.Value("_SMSTSLogPath")+"\smsts.log"
#Generate Form Code
[System.Windows.Forms.MessageBox]::Show("TS '$SMSTSPackageName' has failed on '$OSDComputerName'! `nPlease click OK to review logs and report the failure to your SCCM Admin before trying again." , "TS Failure")
if ($OKButton -eq "OK" )
{
cmtrace.exe "$SMSTSLogPath"
$TS.Value("TSFailed") = "true"
}
else
{
cmtrace.exe "$SMSTSLogPath"
$TS.Value("TSFailed") = "true"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment