@@ -600,24 +600,24 @@ if ($createPowerPlan -like "y*") {
600600 $eGPUPowerPlanGuid = $Matches [1 ]
601601
602602 # Rename the power plan
603- powercfg - changename $eGPUPowerPlanGuid " eGPU High Performance" " Optimized for maximum eGPU performance" | Out-Null
603+ powercfg - changename $eGPUPowerPlanGuid " eGPU High Performance" " Optimized for maximum eGPU performance" 2>&1 | Out-Null
604604
605- # Configure for maximum performance
605+ # Configure for maximum performance (some settings may not be available on all systems)
606606 # CPU: 100% minimum and maximum
607- powercfg - setacvalueindex $eGPUPowerPlanGuid SUB_PROCESSOR PROCTHROTTLEMIN 100 | Out-Null
608- powercfg - setacvalueindex $eGPUPowerPlanGuid SUB_PROCESSOR PROCTHROTTLEMAX 100 | Out-Null
607+ powercfg - setacvalueindex $eGPUPowerPlanGuid SUB_PROCESSOR PROCTHROTTLEMIN 100 2>&1 | Out-Null
608+ powercfg - setacvalueindex $eGPUPowerPlanGuid SUB_PROCESSOR PROCTHROTTLEMAX 100 2>&1 | Out-Null
609609
610610 # PCIe Link State Power Management: Off (maximum performance)
611- powercfg - setacvalueindex $eGPUPowerPlanGuid SUB_PCIEXPRESS ASPM 0 | Out-Null
611+ powercfg - setacvalueindex $eGPUPowerPlanGuid SUB_PCIEXPRESS ASPM 0 2>&1 | Out-Null
612612
613613 # USB selective suspend: Disabled
614- powercfg - setacvalueindex $eGPUPowerPlanGuid SUB_USB USBSELECTIVESUSPEND 0 | Out-Null
614+ powercfg - setacvalueindex $eGPUPowerPlanGuid SUB_USB USBSELECTIVESUSPEND 0 2>&1 | Out-Null
615615
616616 # Hard disk: Never turn off
617- powercfg - setacvalueindex $eGPUPowerPlanGuid SUB_DISK DISKIDLE 0 | Out-Null
617+ powercfg - setacvalueindex $eGPUPowerPlanGuid SUB_DISK DISKIDLE 0 2>&1 | Out-Null
618618
619619 # Display: Never turn off (will be managed by script)
620- powercfg - setacvalueindex $eGPUPowerPlanGuid SUB_VIDEO VIDEOIDLE 0 | Out-Null
620+ powercfg - setacvalueindex $eGPUPowerPlanGuid SUB_VIDEO VIDEOIDLE 0 2>&1 | Out-Null
621621
622622 # Only activate if eGPU is currently connected and working
623623 $isEGPUConnected = $selectedGPU.Status -eq " OK"
@@ -786,14 +786,28 @@ if ($startChoice -eq "1") {
786786
787787 # Start the task in background
788788 Start-ScheduledTask - TaskName $taskName - ErrorAction SilentlyContinue
789- Start-Sleep - Seconds 2
790789
791- # Tail the log file
792- try {
793- Get-Content - Path " $installPath \egpu-manager.log" - Wait - Tail 50
794- } catch {
795- Write-Host " `n ⚠ Could not tail log file. Monitor is running in background." - ForegroundColor Yellow
796- Write-Host " View logs with: Get-Content `" $installPath \egpu-manager.log`" -Tail 50" - ForegroundColor Gray
790+ # Wait for log file to be created (up to 5 seconds)
791+ Write-Host " Waiting for monitor to start..." - ForegroundColor Gray
792+ $waitCount = 0
793+ while (-not (Test-Path " $installPath \egpu-manager.log" ) -and $waitCount -lt 10 ) {
794+ Start-Sleep - Milliseconds 500
795+ $waitCount ++
796+ }
797+
798+ if (Test-Path " $installPath \egpu-manager.log" ) {
799+ Write-Host " Monitor started, showing live log:`n " - ForegroundColor Green
800+ # Tail the log file
801+ try {
802+ Get-Content - Path " $installPath \egpu-manager.log" - Wait - Tail 50
803+ } catch {
804+ Write-Host " `n ⚠ Could not tail log file: $_ " - ForegroundColor Yellow
805+ Write-Host " View logs with: Get-Content `" $installPath \egpu-manager.log`" -Tail 50" - ForegroundColor Gray
806+ }
807+ } else {
808+ Write-Host " `n ⚠ Monitor task started but log file not created yet" - ForegroundColor Yellow
809+ Write-Host " The monitor may take a moment to initialize." - ForegroundColor Gray
810+ Write-Host " View logs with: Get-Content `" $installPath \egpu-manager.log`" -Wait" - ForegroundColor Gray
797811 }
798812} else {
799813 Write-Host " `n ✓ Monitor will start automatically on next reboot" - ForegroundColor Green
0 commit comments