# Connect to SQL Server
$ServerName = "DOES-DUTAS-SQL"
$SqlInstance = "localhost"  # or server instance name

# Execute each script
$ScriptFiles = Get-ChildItem -Path $ExtractPath -Filter *.sql
foreach ($file in $ScriptFiles) {
    Write-Host "Restoring job from: $($file.FullName)"
    sqlcmd -S $SqlInstance -i $file.FullName
}

Write-Host "All SQL Agent jobs restored successfully."
