Job pinger against multiple DNS

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 6 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
apowershelluser
Posts: 194
Last visit: Fri Mar 22, 2024 4:38 am
Answers: 2

Re: Job pinger against multiple DNS

Post by apowershelluser »

  1. Param (
  2.         [string[]]$Computers,
  3.         [string[]]$suffixes
  4.     )
  5.    
  6.     foreach ($computer in $Computers)
  7.     {
  8.         foreach ($suffix IN $suffixes)
  9.         {
  10.             if (Test-Connection "$computer.$suffix" -Count 1 -Quiet)
  11.             {
  12.                 "$computer.$suffix found"
  13.                 break
  14.             }
  15.             else
  16.             {
  17.                 "$computer.$suffix not found"
  18.             }
  19.         }
  20.     }
Okay, this is working perfectly ( thank you a million )

I had to change it because our domain is setup that I have to ping PC1.wlan.net to find it on wireless

so my result is just

$results = Receive-Job -Job $Job | Select-Object -last 1
User avatar
apowershelluser
Posts: 194
Last visit: Fri Mar 22, 2024 4:38 am
Answers: 2

Re: Job pinger against multiple DNS

Post by apowershelluser »

Side note, in your formatting, can you start multiple jobs @ the same time?

function StartJob {
Add-JobTracker -Name JobName -JobScript $jobscript -CompletedScript $completedScript -UpdateScript $updateScript -ArgumentList $textbox1.Text, $suffixes
Add-JobTracker -Name JobName2 -JobScript $jobscript -CompletedScript $completedScript -UpdateScript $updateScript -ArgumentList $args
Add-JobTracker -Name JobName3 -JobScript $jobscript -CompletedScript $completedScript -UpdateScript $updateScript -ArgumentList $args
}

$buttonStartJob_Click={
$buttonStartJob.Enabled = $false
StartJob
}
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Job pinger against multiple DNS

Post by jvierra »

If you want to.
You can get the details of each job in the events using the $job parameter passed.
User avatar
apowershelluser
Posts: 194
Last visit: Fri Mar 22, 2024 4:38 am
Answers: 2

Re: Job pinger against multiple DNS

Post by apowershelluser »

Thanks, just trying to figure out a way to detect all jobs have completed and can move the progressbar to 100%
This topic is 6 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked