feature(wakeup): exit if no matching computers found
This commit is contained in:
		
							parent
							
								
									e5bc1f76df
								
							
						
					
					
						commit
						2a21a23462
					
				@ -75,6 +75,13 @@ $targetComputers = [System.Collections.Generic.List[PSObject]]::new()
 | 
				
			|||||||
$db.WOLDatabase.Computers.Computer | Where-Object { $_.name -match "$targetComputer" } | ForEach-Object { $targetComputers.Add($_) }
 | 
					$db.WOLDatabase.Computers.Computer | Where-Object { $_.name -match "$targetComputer" } | ForEach-Object { $targetComputers.Add($_) }
 | 
				
			||||||
$removeFromTargetComputers = [System.Collections.Generic.List[String]]::new()
 | 
					$removeFromTargetComputers = [System.Collections.Generic.List[String]]::new()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# exit if nothing to do (i.e. empty targetComputers list)
 | 
				
			||||||
 | 
					if ($targetComputers.Count -eq 0)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    Write-Host -ForegroundColor Yellow "No computers found matching '$targetComputer'. Nothing to do.`r`n"
 | 
				
			||||||
 | 
					    exit 0
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# send WOL magic packets
 | 
					# send WOL magic packets
 | 
				
			||||||
$targetComputers | ForEach-Object {
 | 
					$targetComputers | ForEach-Object {
 | 
				
			||||||
    $wolError = @()
 | 
					    $wolError = @()
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user