Implement monitoring and troubleshooting procedures to ensure your startup scripts continue working reliably across your environment.
Create a monitoring script to check startup script execution across multiple computers:
# Monitor startup script execution across domain computers
$computers = Get-ADComputer -Filter "OperatingSystem -like '*Windows 11*'" -Properties Name
foreach ($computer in $computers) {
$computerName = $computer.Name
try {
$lastEvent = Get-WinEvent -ComputerName $computerName -LogName Application -MaxEvents 1 -FilterXPath "*[System[EventID=1001]]"
if ($lastEvent) {
Write-Host "$computerName - Last execution: $($lastEvent.TimeCreated)" -ForegroundColor Green
} else {
Write-Host "$computerName - No startup script execution found" -ForegroundColor Red
}
} catch {
Write-Host "$computerName - Unable to connect or check logs" -ForegroundColor Yellow
}
}
Common troubleshooting steps for script execution failures:
Check Group Policy application:
gpresult /scope computer /v
Verify script file permissions:
icacls "\\yourdomain.com\NETLOGON\startup-test.ps1"
Test script execution manually:
powershell.exe -ExecutionPolicy RemoteSigned -File "\\yourdomain.com\NETLOGON\startup-test.ps1"
Check for execution policy blocks:
Get-ExecutionPolicy -List
Common issues and solutions:
- Event ID 1055/1130: Network not ready - increase startup wait time to 120 seconds
- Access denied errors: Verify Domain Computers group has Read & Execute permissions on script file
- Script not found: Check SYSVOL replication status and UNC path syntax
- Execution policy errors: Verify the PowerShell execution policy GPO is applied correctly
Warning: Startup scripts run in SYSTEM context, not user context. Avoid operations that require user profile access or interactive elements in startup scripts.
Verification: Your monitoring script should show successful execution timestamps for all target computers. Any failures should be investigated using the troubleshooting steps above.