Skip to main content
Continuing Online Operations
Loyola is continuing online operations while we prepare for reopening safely in the fall. Coronavirus resources

Blackboard Interface from LORA (Student Information System): Script

Controlling PowerShell Script

A master script written in Windows PowerShell controlls the processes of retrieving the WebFOCUS reports, editing and filtering the data in those reports, and posting the edited data to Blackboard. This control script is what is scheduled in the Windows automatic task scheduler.


$HomeDir = ''
$WFDir = ''
$BBDir = ''
$PostStudents = ''
$Pipe = '|'
#
# Get necessary parameters from parameters file
#
$ParamsFileName = 'SISIntegrationParameters.txt'
If (-not (Test-Path $ParamsFileName)) {
Write-Host -foregroundcolor Red 'Paramaters File Not Found. Process Terminated.'
Exit
}
$ParamsFile = Get-Content $ParamsFileName
ForEach ($Line in $ParamsFile) {
$Title = $Line.Split($Pipe)[0]
$Value = $Line.Split($Pipe)[1]
$Title = $Title.trim()
$Value = $Value.trim()
if ($Title -eq 'HomeDir') {$HomeDir = $Value}
if ($Title -eq 'WFDir') {$WFDir = $Value}
if ($Title -eq 'BBDir') {$BBDir = $Value}
if ($Title -eq 'PostStudents') {$PostStudents = $Value}
}
#
# Check Home Directory
#
If (!$HomeDir) {
Write-Host -foregroundcolor Red 'No Home Directory Specified. Process Terminated.'
Exit
}
If (-not (Test-Path $HomeDir)) {
Write-Host -foregroundcolor Red 'Specified Home Directory does not exist. Process Terminated.'
Exit
}
#
# Clear Old files from directories
#
Set-Location $WFDir
Remove-Item "*.txt"
Set-Location $BBDir
Remove-Item "*.txt"
#
# Run Interface Programs
#
set-location $HomeDir
$Invocation = $HomeDir + 'WebFocusDownloads.ps1'
&$Invocation
$Invocation = $HomeDir + 'PrepareSnapshotFiles.ps1'
&$Invocation
#
# HTTP Post Files to Blackboard using CURL
#
set-location $HomeDir
$Command = '.\curl.exe'
$Config = '--config SendCoursesConfig.txt'
$Params = $Config.Split(' ')
& $Command $Params
$Config = '--config SendInstructorsConfig.txt'
$Params = $Config.Split(' ')
& $Command $Params
$Config = '--config SendInstructorEnrollmentsConfig.txt'
$Params = $Config.Split(' ')
& $Command $Params
IF ($PostStudents -eq 'Yes') {
$Config = '--config SendStudentsConfig.txt'
$Params = $Config.Split(' ')
& $Command $Params
$Config = '--config SendStudentEnrollmentsConfig.txt'
$Params = $Config.Split(' ')
& $Command $Params
}