2
0
tcse-deploy/Printers/01-Printer-Scripts/01-PrinterInstall-AllPrinters.ps1
2024-12-10 08:15:02 -06:00

19 lines
665 B
PowerShell

# Specify the directory containing the scripts
$scriptDirectory = "C:\Scripts\Printers\02-Printer-Install"
# Get all PowerShell scripts in the directory
$scriptsToRun = Get-ChildItem -Path $scriptDirectory -Filter "*.ps1"
# Iterate through the script paths and execute each one
foreach ($script in $scriptsToRun) {
try {
# Execute the script
& $script.FullName
# Add a delay or other actions between scripts if needed
Write-Host "Script '$script' executed successfully."
Start-Sleep -Seconds 5 # Adjust the delay as needed
} catch {
Write-Warning "Error executing '$script' $($_.Exception.Message)"
}
}