"C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\sqlps.exe"
WHILE(1 -eq 1) 
{ 
  try 
  {
    # Split the input on the delimeter 
    $Queries = Get-Content -Delimiter "------" -Path "C:\AVW_workload\AdventureWorksBOLWorkload.sql" 
    $EachQuery = Get-Random -InputObject $Queries; 
        Write-Host $EachQuery
    invoke-sqlcmd  -ServerInstance localhost\SQL2016CP2 -Database AdventureWorks2014 -Query $EachQuery
    # Sleep for 50 miliseconds between loops 
    Start-Sleep -Milliseconds 50 
  }
  catch
  {
        write-host $EachQuery
        write-host "Caught an exception:" -ForegroundColor Red
        write-host "Exception Type: $($_.Exception.GetType().FullName)" -ForegroundColor Red
        write-host "Exception Message: $($_.Exception.Message)" -ForegroundColor Red
        write-host $server.server_name -ForegroundColor Red
        $ErrorActionPreference = "Continue"
  }
  finally
  {
	write-host "completed one query: "
  }
} 



