param ( [string]$school = "none" ) $scriptVersion = "1.10" $drcPath = $false function ExitProg { $console = $host.UI.RawUI $console.ForegroundColor = "White" $console.BackgroundColor = "Black" [console]::CursorVisible=$true Clear-Host Exit } #==[Administrator Check]======================================================== # Get the ID and security principal of the current user account $myWindowsID=[System.Security.Principal.WindowsIdentity]::GetCurrent() $myWindowsPrincipal=new-object System.Security.Principal.WindowsPrincipal($myWindowsID) # Get the security principal for the Administrator role $adminRole=[System.Security.Principal.WindowsBuiltInRole]::Administrator # Check to see if we are currently not running "as Administrator" if (-Not $myWindowsPrincipal.IsInRole($adminRole)) { Write-Host "You must run this as an administrator!" $Host.UI.RawUI.FlushInputBuffer() $host.UI.RawUI.ReadKey() | Out-Null ExitProg } #==[ Work-around for missing Get-FileHash in Powershell 2]====================== Function Get-FileHash([String] $FileName,$HashName = "MD5") { $FileStream = New-Object System.IO.FileStream($FileName,[System.IO.FileMode]::Open) $StringBuilder = New-Object System.Text.StringBuilder [System.Security.Cryptography.HashAlgorithm]::Create($HashName).ComputeHash($FileStream)|%{[Void]$StringBuilder.Append($_.ToString("x2"))} $FileStream.Close() $StringBuilder.ToString() } #==[Draw Progress Bar]========================================================== Function DrawProgress($x, $y, $width, $progress, $color1, $color2) { $progDist = [Math]::Floor([decimal]($progress/100*$width)) $leftDist = $width - $progDist [console]::setcursorposition($x,$y) if ($progDist -gt 0) { Write-Host -BackgroundColor $color1 -NoNewLine ("{0,$progDist}" -f "") } if ($leftDist -gt 0) { Write-Host -BackgroundColor $color2 -NoNewLine ("{0,$leftDist}" -f "") } } #==[ Download File With Progress ]============================================== function downloadFile($url, $targetFile, $sha) { $foreground = "White" $highlight = "Yellow" $background = "DarkBlue" $shadow = "Black" $progress = "DarkRed" $consoleWidth = $Host.UI.RawUI.WindowSize.Width $width = $consoleWidth - 4 $downloaded = 0 $progressBarWidth = $width - 2 [console]::setcursorposition(1,16) #$downloadProgressTxt = " Downloading File: {0,6:n2}MiB of {1,6:n2}MiB" -f (8204923/1048576), (90890823904/1048576) $downloadProgressTxt = " Connecting to server..." Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine ("{0,-$width}" -f "") Write-Host " " [console]::setcursorposition(1,17) Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine ("{0,-$width}" -f $downloadProgressTxt) Write-Host -BackgroundColor $shadow " " [console]::setcursorposition(1,18) Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine " " DrawProgress 2 18 $progressBarWidth $downloaded "DarkRed" "Black" Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine " " Write-Host -BackgroundColor $shadow " " [console]::setcursorposition(1,19) Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine ("{0,-$width}" -f "") Write-Host -BackgroundColor $shadow " " [console]::setcursorposition(3,20) Write-Host -BackgroundColor $shadow ("{0,-$width}" -f "") try { $uri = New-Object "System.Uri" "$url" $request = [System.Net.HttpWebRequest]::Create($uri) $request.set_Timeout(15000) #15 second timeout $response = $request.GetResponse() $totalLength = $response.get_ContentLength() $responseStream = $response.GetResponseStream() $targetStream = New-Object -TypeName System.IO.FileStream -ArgumentList $targetFile, Create $buffer = new-object byte[] 100KB $count = $responseStream.Read($buffer,0,$buffer.length) $downloadedBytes = $count while ($count -gt 0) { [console]::setcursorposition(1,17) $downloadProgressTxt = " Downloading File: {0:n2}MiB of {1:n2}MiB" -f ($downloadedBytes/1048576), ($totalLength/1048576) Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine ("{0,-$width}" -f $downloadProgressTxt) $downloaded = [System.Math]::Round(($downloadedBytes/$totalLength)*100) DrawProgress 2 18 $progressBarWidth $downloaded "DarkRed" "Black" $targetStream.Write($buffer, 0, $count) $count = $responseStream.Read($buffer,0,$buffer.length) $downloadedBytes = $downloadedBytes + $count } $targetStream.Flush() $targetStream.Close() $targetStream.Dispose() $responseStream.Dispose() [console]::setcursorposition(1,17) $downloadProgressTxt = " Verifying File Checksum" Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine ("{0,-$width}" -f $downloadProgressTxt) $drcHash = Get-FileHash "C:\Program Files\RPSB\drc_insight_setup.msi" "SHA256" $width = $width + 2 [console]::setcursorposition(1,16) Write-Host -BackgroundColor DarkGray ("{0,-$width}" -f "") [console]::setcursorposition(1,17) Write-Host -BackgroundColor DarkGray ("{0,-$width}" -f "") [console]::setcursorposition(1,18) Write-Host -BackgroundColor DarkGray ("{0,-$width}" -f "") [console]::setcursorposition(1,19) Write-Host -BackgroundColor DarkGray ("{0,-$width}" -f "") [console]::setcursorposition(1,20) Write-Host -BackgroundColor DarkGray ("{0,-$width}" -f "") if ($drcHash -eq $sha) { return $true } else { return $false } } catch { $foreground = "White" $highlight = "Yellow" $background = "DarkRed" $shadow = "Black" $left = ($consoleWidth / 2) - 29 [console]::setcursorposition($left,9) Write-Host -BackgroundColor $background -ForegroundColor $highlight -NoNewLine " == ERROR == " Write-Host " " [console]::setcursorposition($left,10) Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine " " Write-Host -BackgroundColor $shadow " " [console]::setcursorposition($left,11) Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine " An error occurred while downloading the install file from " Write-Host -BackgroundColor $shadow " " [console]::setcursorposition($left,12) Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine " the server. Please try again later, or contact Daniel " Write-Host -BackgroundColor $shadow " " [console]::setcursorposition($left,13) Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine " Hogan at the Richland Parish School Board. " Write-Host -BackgroundColor $shadow " " [console]::setcursorposition($left+2,14) Write-Host -BackgroundColor $shadow -ForegroundColor $foreground " " $Host.UI.RawUI.FlushInputBuffer() $host.UI.RawUI.ReadKey() | Out-Null ExitProg return $false } } function StatusBox{ param ( [string]$school = "none", [string]$code = "missing", [string]$curVer = "", [string]$newVer = "", [string]$status = "" ) $foreground = "White" $highlight = "Yellow" $background = "DarkCyan" $shadow = "Black" $consoleWidth = $Host.UI.RawUI.WindowSize.Width $left = ($consoleWidth / 2) - 27 [console]::setcursorposition($left,6) Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine " " Write-Host " " [console]::setcursorposition($left,7) Write-Host -BackgroundColor $background -ForegroundColor $highlight -NoNewLine (" School:") Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine (" {0,-35} " -f $school) Write-Host -BackgroundColor $shadow " " [console]::setcursorposition($left,8) Write-Host -BackgroundColor $background -ForegroundColor $highlight -NoNewLine (" Site Code:") Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine (" {0,-35} " -f $code) Write-Host -BackgroundColor $shadow " " [console]::setcursorposition($left,9) Write-Host -BackgroundColor $background -ForegroundColor $highlight -NoNewLine (" Current Version:") Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine (" {0,-35} " -f $curVer) Write-Host -BackgroundColor $shadow " " [console]::setcursorposition($left,10) Write-Host -BackgroundColor $background -ForegroundColor $highlight -NoNewLine (" Newest Version:") Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine (" {0,-35} " -f $newVer) Write-Host -BackgroundColor $shadow " " [console]::setcursorposition($left,11) Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine " " Write-Host -BackgroundColor $shadow " " [console]::setcursorposition($left,12) Write-Host -BackgroundColor $background -ForegroundColor $highlight -NoNewLine (" Updater Status:") Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine (" {0,-35} " -f $status) Write-Host -BackgroundColor $shadow " " [console]::setcursorposition($left,13) Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine " " Write-Host -BackgroundColor $shadow " " [console]::setcursorposition($left+2,14) Write-Host -BackgroundColor $shadow " " } #==[ Initialize Screen ]======================================================== $console = $host.UI.RawUI $console.ForegroundColor = "White" $console.BackgroundColor = "DarkGray" [console]::CursorVisible=$false $consoleWidth = $Host.UI.RawUI.WindowSize.Width $consoleHeight = $Host.UI.RawUI.WindowSize.Height #==[ Show Header ]============================================================== $foreground = "Black" $background = "Gray" $shadow = "Black" Clear-Host Write-Host "" Write-Host -NoNewLine " " Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine " " Write-Host " " Write-Host -NoNewLine " " Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine " Richland Parish Schools - DRC INSIGHT Updater " Write-Host -BackgroundColor $shadow " " Write-Host -NoNewLine " " Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine " " Write-Host -BackgroundColor $shadow " " Write-Host -NoNewLine " " Write-Host -BackgroundColor $shadow " " Write-Host "" #==[ Show Version Information ]================================================= [console]::setcursorposition($consoleWidth-$scriptVersion.length-2,1) Write-Host -ForegroundColor Yellow -NoNewLine "v" Write-Host -ForegroundColor Yellow $scriptVersion [console]::setcursorposition(0,6) $schoolList = New-Object System.Data.DataTable $row1 = New-Object system.Data.DataColumn Abbr,([string]) $row2 = New-Object system.Data.DataColumn Name,([string]) $row3 = New-Object system.Data.DataColumn DRCcode,([string]) $schoolList.Columns.Add($row1) $schoolList.Columns.Add($row2) $schoolList.Columns.Add($row3) $row = $schoolList.NewRow() $row.Abbr = "RPSB-CO" $row.Name = "Richland Parish Schools" $row.DRCcode = "200645377" $schoolList.Rows.Add($row) $row = $schoolList.NewRow() $row.Abbr = "DHS" $row.Name = "Delhi High School" $row.DRCcode = "453076349" $schoolList.Rows.Add($row) $row = $schoolList.NewRow() $row.Abbr = "DMS" $row.Name = "Delhi Middle School" $row.DRCcode = "1814689103" $schoolList.Rows.Add($row) $row = $schoolList.NewRow() $row.Abbr = "DES" $row.Name = "Delhi Elementary School" $row.DRCcode = "2084470428" $schoolList.Rows.Add($row) $row = $schoolList.NewRow() $row.Abbr = "HRES" $row.Name = "Holly Ridge Elementary School" $row.DRCcode = "1445282683" $schoolList.Rows.Add($row) $row = $schoolList.NewRow() $row.Abbr = "MES" $row.Name = "Mangham Elementary School" $row.DRCcode = "776866700" $schoolList.Rows.Add($row) $row = $schoolList.NewRow() $row.Abbr = "MHS" $row.Name = "Mangham High School" $row.DRCcode = "2023807055" $schoolList.Rows.Add($row) $row = $schoolList.NewRow() $row.Abbr = "MJH" $row.Name = "Mangham Junior High School" $row.DRCcode = "1318531936" $schoolList.Rows.Add($row) $row = $schoolList.NewRow() $row.Abbr = "RHS" $row.Name = "Rayville High School" $row.DRCcode = "826176017" $schoolList.Rows.Add($row) $row = $schoolList.NewRow() $row.Abbr = "RJH" $row.Name = "Rayville Junior High School" $row.DRCcode = "2014060216" $schoolList.Rows.Add($row) $row = $schoolList.NewRow() $row.Abbr = "RES" $row.Name = "Rayville Elementary School" $row.DRCcode = "1667873951" $schoolList.Rows.Add($row) $row = $schoolList.NewRow() $row.Abbr = "RCCA" $row.Name = "Richland Career Center at Archibald" $row.DRCcode = "786452667" $schoolList.Rows.Add($row) $row = $schoolList.NewRow() $row.Abbr = "SES" $row.Name = "Start Elementary School" $row.DRCcode = "1667412695" $schoolList.Rows.Add($row) $row = $schoolList.NewRow() $row.Abbr = "RPSB" $row.Name = "Richland Parish School Board" $row.DRCcode = "1141285133" $schoolList.Rows.Add($row) #==[ Make Sure RPSB Directory Exists ]========================================== if (-not (Test-Path -Path "c:\Program Files\RPSB")) { New-Item -ItemType Directory -Path "c:\Program Files\RPSB" | Out-Null } #==[ Find School Data ]========================================================= if ([bool](($schoolList | Select-Object Abbr) -match $school.ToUpper())) { $schoolName = ($schoolList | Where-Object { $_.Abbr -eq $school.ToUpper() }).Name $schoolCode = ($schoolList | Where-Object { $_.Abbr -eq $school.ToUpper() }).DRCcode } else { $foreground = "White" $highlight = "Yellow" $background = "DarkRed" $shadow = "Black" $left = ($consoleWidth / 2) - 29 [console]::setcursorposition($left,9) Write-Host -BackgroundColor $background -ForegroundColor $highlight -NoNewLine " == ERROR == " Write-Host " " [console]::setcursorposition($left,10) Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine " " Write-Host -BackgroundColor $shadow " " [console]::setcursorposition($left,11) Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine " A valid school identifier was not sent to this updater. " Write-Host -BackgroundColor $shadow " " [console]::setcursorposition($left,12) Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine " Please contact Daniel Hogan at the Richland Parish School " Write-Host -BackgroundColor $shadow " " [console]::setcursorposition($left,13) Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine " Board to report this problem. " Write-Host -BackgroundColor $shadow " " [console]::setcursorposition($left+2,14) Write-Host -BackgroundColor $shadow -ForegroundColor $foreground " " $Host.UI.RawUI.FlushInputBuffer() $host.UI.RawUI.ReadKey() | Out-Null ExitProg } #==[ Initialize status screen ]================================================= $installedVersion = "" $newestVersion = "" $curStatus = "Getting Installed Version" StatusBox $schoolName $schoolCode $installedVersion $newestVersion $curStatus #==[ Get Installed Version Number ]============================================= if (Test-Path -Path "HKLM:\Software\Data Recognition Corporation\DRC INSIGHT Online Learning System") { $installedVersion = (Get-ItemProperty -Path "HKLM:\Software\Data Recognition Corporation\DRC INSIGHT Online Learning System" -Name Version).Version } elseif (Test-Path -Path "HKLM:\Software\WOW6432Node\Data Recognition Corporation\DRC INSIGHT Online Learning System") { $installedVersion = (Get-ItemProperty -Path "HKLM:\Software\WOW6432Node\Data Recognition Corporation\DRC INSIGHT Online Learning System" -Name Version).Version } else { $installedVersion = "Not Installed" } $curStatus = "Retrieving Data" StatusBox $schoolName $schoolCode $installedVersion $newestVersion $curStatus #==[ Download Data File ]======================================================= try { $WebClient = New-Object System.Net.WebClient $WebClient.DownloadFile("http://richland.k12.la.us/files/install/insight/drc_data.txt", "C:\Program Files\RPSB\drc_data.txt") $temp = Get-Content("c:\Program Files\RPSB\drc_data.txt") $drcdata = ConvertFrom-CSV -InputObject $temp $newestVersion = ($drcdata | Where-Object { $_.variable -match "drcver" }).data $newestScrVer = ($drcdata | Where-Object { $_.variable -match "updatever" }).data $msiChecksum = ($drcdata | Where-Object { $_.variable -match "drchash" }).data } catch { $foreground = "White" $highlight = "Yellow" $background = "DarkRed" $shadow = "Black" $left = ($consoleWidth / 2) - 29 [console]::setcursorposition($left,9) Write-Host -BackgroundColor $background -ForegroundColor $highlight -NoNewLine " == ERROR == " Write-Host " " [console]::setcursorposition($left,10) Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine " " Write-Host -BackgroundColor $shadow " " [console]::setcursorposition($left,11) Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine " An error occurred while downloading the data file from " Write-Host -BackgroundColor $shadow " " [console]::setcursorposition($left,12) Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine " the server. Please try again later, or contact Daniel " Write-Host -BackgroundColor $shadow " " [console]::setcursorposition($left,13) Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine " Hogan at the Richland Parish School Board. " Write-Host -BackgroundColor $shadow " " [console]::setcursorposition($left+2,14) Write-Host -BackgroundColor $shadow -ForegroundColor $foreground " " $Host.UI.RawUI.FlushInputBuffer() $host.UI.RawUI.ReadKey() | Out-Null ExitProg } #==[ This Script Updated? ]===================================================== if ($scriptVersion -ne $newestScrVer) { $curStatus = "Updating the updater..." StatusBox $schoolName $schoolCode $installedVersion $newestVersion $curStatus $WebClient.DownloadFile("http://richland.k12.la.us/files/install/insight/drcinupd.ps1", "C:\Program Files\RPSB\drcinupd.ps1") Start-Process -FilePath "powershell" -ArgumentList "`"C:\Program`` Files\RPSB\drcinupd.ps1`"",$school -NoNewWindow Exit } #==[ Update needed? ]=========================================================== if ($newestVersion -eq $installedVersion) { $curStatus = "No Update Needed, Exiting" StatusBox $schoolName $schoolCode $installedVersion $newestVersion $curStatus Start-Sleep -Seconds 5 ExitProg } else { $curStatus = "Downloading newest DRC Client" StatusBox $schoolName $schoolCode $installedVersion $newestVersion $curStatus } #==[ Download DRC File ]======================================================== $WebClient = New-Object System.Net.WebClient $success = downloadFile "http://richland.k12.la.us/files/install/insight/drc_insight_setup.msi" "C:\Program Files\RPSB\drc_insight_setup.msi" $msiChecksum if ($success -eq $true) { $curStatus = "Installing DRC INSIGHT Client" StatusBox $schoolName $schoolCode $installedVersion $newestVersion $curStatus msiexec.exe /i "c:\Program Files\RPSB\drc_insight_setup.msi" /qb /qr ou_ids="$schoolCode" | Out-Null #==[ Get Installed Version Number ]============================================= if (Test-Path -Path "HKLM:\Software\Data Recognition Corporation\DRC INSIGHT Online Learning System") { $installedVersion = (Get-ItemProperty -Path "HKLM:\Software\Data Recognition Corporation\DRC INSIGHT Online Learning System" -Name Version).Version } elseif (Test-Path -Path "HKLM:\Software\WOW6432Node\Data Recognition Corporation\DRC INSIGHT Online Learning System") { $installedVersion = (Get-ItemProperty -Path "HKLM:\Software\WOW6432Node\Data Recognition Corporation\DRC INSIGHT Online Learning System" -Name Version).Version } else { $installedVersion = "Not Installed" } if ($newestVersion -eq $installedVersion) { $curStatus = "Update Complete!" StatusBox $schoolName $schoolCode $installedVersion $newestVersion $curStatus if (test-path "$($env:Public)\Desktop\DRC INSIGHT Online Assessments.lnk") { if (test-path "$($env:Public)\Desktop\DRC INSIGHT.lnk") { Remove-Item "$($env:Public)\Desktop\DRC INSIGHT.lnk"; } if (test-path "$($env:USERPROFILE)\Desktop\DRC INSIGHT.lnk") { Remove-Item "$($env:Public)\Desktop\DRC INSIGHT.lnk"; } if (test-path "$($env:USERPROFILE)\Desktop\DRC INSIGHT Online Assessments.lnk") { Remove-Item "$($env:Public)\Desktop\DRC INSIGHT Online Assessments.lnk"; } Rename-Item -Path "$($env:PUBLIC)\Desktop\DRC INSIGHT Online Assessments.lnk" "DRC INSIGHT.lnk" } elseif (test-path "$($env:USERPROFILE)\Desktop\DRC INSIGHT Online Assessments.lnk") { if (test-path "$($env:Public)\Desktop\DRC INSIGHT.lnk") { Remove-Item "$($env:Public)\Desktop\DRC INSIGHT.lnk"; } if (test-path "$($env:USERPROFILE)\Desktop\DRC INSIGHT.lnk") { Remove-Item "$($env:Public)\Desktop\DRC INSIGHT.lnk"; } Move-Item -path "$($env:USERPROFILE)\Desktop\DRC INSIGHT Online Assessments.lnk" -destination "$($env:Public)\Desktop\" Rename-Item -Path "$($env:PUBLIC)\Desktop\DRC INSIGHT Online Assessments.lnk" "DRC INSIGHT.lnk" } #==[ Get Installed Version Number ]============================================= if (Test-Path -Path "HKLM:\Software\Data Recognition Corporation\DRC INSIGHT Online Learning System") { $drcPath = (Get-ItemProperty -Path "HKLM:\Software\Data Recognition Corporation\DRC INSIGHT Online Learning System" -Name Path).Path } elseif (Test-Path -Path "HKLM:\Software\WOW6432Node\Data Recognition Corporation\DRC INSIGHT Online Learning System") { $drcPath = (Get-ItemProperty -Path "HKLM:\Software\WOW6432Node\Data Recognition Corporation\DRC INSIGHT Online Learning System" -Name Path).Path } else { $drcPath = $false } } else { $foreground = "White" $highlight = "Yellow" $background = "DarkRed" $shadow = "Black" $left = ($consoleWidth / 2) - 29 $curStatus = "Update Failed!" StatusBox $schoolName $schoolCode $installedVersion $newestVersion $curStatus [console]::setcursorposition($left,9) Write-Host -BackgroundColor $background -ForegroundColor $highlight -NoNewLine " == ERROR == " Write-Host " " [console]::setcursorposition($left,10) Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine " " Write-Host -BackgroundColor $shadow " " [console]::setcursorposition($left,11) Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine " There was a problem installing the updated DRC INSIGHT " Write-Host -BackgroundColor $shadow " " [console]::setcursorposition($left,12) Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine " Client. Please report this problem to Daniel Hogan at the " Write-Host -BackgroundColor $shadow " " [console]::setcursorposition($left,13) Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine " Richland Parish School Board. " Write-Host -BackgroundColor $shadow " " [console]::setcursorposition($left+2,14) Write-Host -BackgroundColor $shadow -ForegroundColor $foreground " " $Host.UI.RawUI.FlushInputBuffer() $host.UI.RawUI.ReadKey() | Out-Null ExitProg } Start-Sleep -seconds 5 } else { $foreground = "White" $highlight = "Yellow" $background = "DarkRed" $shadow = "Black" $left = ($consoleWidth / 2) - 29 [console]::setcursorposition($left,9) Write-Host -BackgroundColor $background -ForegroundColor $highlight -NoNewLine " == ERROR == " Write-Host " " [console]::setcursorposition($left,10) Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine " " Write-Host -BackgroundColor $shadow " " [console]::setcursorposition($left,11) Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine " The file checksum value did not match what was expected. " Write-Host -BackgroundColor $shadow " " [console]::setcursorposition($left,12) Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine " It's recommended to try again, or contact Daniel Hogan at " Write-Host -BackgroundColor $shadow " " [console]::setcursorposition($left,13) Write-Host -BackgroundColor $background -ForegroundColor $foreground -NoNewLine " the Richland Parish School Board if the problem persists. " Write-Host -BackgroundColor $shadow " " [console]::setcursorposition($left+2,14) Write-Host -BackgroundColor $shadow -ForegroundColor $foreground " " $Host.UI.RawUI.FlushInputBuffer() $host.UI.RawUI.ReadKey() | Out-Null } if (Test-Path -Path "C:\Program Files\RPSB\drc_insight_setup.msi") { Remove-Item -Path "C:\Program Files\RPSB\drc_insight_setup.msi" } if ((Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR") -eq $false) { New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows" -Name "GameDVR" | Out-Null } $gameDVRStatus = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR" | Select-Object -ExpandProperty 'AllowgameDVR') if ($gameDVRStatus -ne 0) { New-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR" -Name "AllowgameDVR" -Value 0 -PropertyType "DWord" | Out-Null Add-Type -AssemblyName System.Windows.Forms | Out-Null $foo = ([System.Windows.Forms.MessageBox]::Show('You must restart this computer before running DRC Insight!','Reboot Required','OK','Exclamation')) new-itemproperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\RunOnce -Name drcreadiness -propertytype String -value """$($drcPath)DRCInsight.exe"" --drc-readiness" Restart-Computer } else { if ($drcPath -ne $false) { & "$($drcPath)DRCInsight.exe" --drc-readiness } } ExitProg