Question

Just uploaded an updated copy of one of my old python scripts called "pingchecker" and thought I would share it. I wrote it several years ago to make it easier for me to clean up my Active Directory container. We had a lot of old machine names in our container that no longer pointed to active machines, but with several hundred machines actively under our control in that same container, I didn't want to just start arbitrarily deleting hostnames. On top of that, I wasn't there when the whole shebang was initially set up, so I didn't have a copy of all the active hostnames we were supposed to have, and I did a poor job of maintaining records of computer names when I would reimage computers. To find out which computers were active and which were not without manually walking around and looking at them all, I wrote this script. I then went into our Active Directory container and unchecked all of the columns except "hostname", and exported that to a text file with one hostname per line, then just copied and pasted those hostnames into the terminal when it asked for targets.  Actually the copy I used at work never asked for hostnames, it would just look for a text file by a particular name that I would create by exporting hostnames from Active Directory, but I modified this one to ask for them so it's more useful for everyday users. This made it very easy to copy and paste several hundred hostnames, then just hit enter and walk away, and have the results exported to a nice text file for me to look at when I got back. I ran the script 2 or 3 times over the course of a couple of weeks to allow for people who might have taken a machine on a trip or other anomalies, and that allowed me to find a pattern of machine names that were consistently offline so I could delete them and remove the clutter from our Active Directory OU.

This updated version has been converted from Python 2 to Python 3, and with this particular one you must have Python 3 installed to use it, Python 2 doesn't seem to like some of the error handling. I've also added colored text output while the script runs, so if you want to review the results while it's still running, or just watch it run, you'll get a colored highlight around the ping results of each target to help you pick out the important information while it's running.  I'm thinking about building in an option to export the results to a .csv file since they're just plain text files, that way you can open it with your favorite spreadsheet editor and sort long lists of hosts by their "Up" or "Down" status, but I haven't been to bed in almost 24 hours, so that'll be a project for another day, :p

It's in a tar.gz archive which you can extract with all sorts of free software like 7zip.

 

Download link: http://sourceforge.net/projects/pingchecker/files/PingChecker_15.8.15.tar.gz/download

Project page: https://sourceforge.net/projects/pingchecker/

I linked directly to the file because as of this post, SourceForge hasn't updated the download button on the project page to point to the newest version that I just now uploaded.

 

Screenshot: The results stored in a text file when it's done.

ping-results.thumb.png.d5d98fca995449260

Screenshot: The highlighted results you see while it's still running.

ping-terminal.thumb.png.c71892e5f999e85f

 

Edited by Gerowen
added tags
Link to comment
https://www.neowin.net/forum/topic/1268872-updated-pingchecker/
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Gonna see about updating it again to include some simple cross platform GUI options, and to ask the user if they want to read hosts from an existing file or if they want to enter them manually.  Started working on that this evening.

  • 0

Almost finished with another update.

I've added graphical dialogs to replace the terminal, although the terminal will still be shown in the background for you to monitor longer operations in real time, and so you can see any error messages spit out by your Python interpreter.

I've added the option to either enter some targets manually (graphical window of course), or select a file to read targets from (graphical as well).

I've added a function that exports the results to a CSV file as well as the plain text file so if you have Office software installed, you can open the CSV file as a spreadsheet and sort the results by IP address, Up/Down status, etc.

I've added a built-in graphical text viewer for displaying the results to the user in a more user friendly fashion for Linux users.  I was using the "sensible-editor" command, which usually defaults to the terminal based "nano" editor, to keep from having to type a kajillion "try, except" arguments since it's no telling whether a user will have GEdit or KWrite or Kate, etc. installed on Linux.

I've accomplished the goals I set out for today which were to make it graphical, add .csv file support, let the user choose whether to enter targets manually or read them from a file, and to display the results file graphically on all systems.  Right now I'm just reviewing everything to make sure I've accounted for possible errors and trying to make the code a little more efficient.

This is mostly just a little pet project for myself to get better at Python while improving on a tool I made for myself years ago.

Here's a screenshot of one of the graphical windows which embeds an image showing you how a file containing targets should look.  This immediately precedes the file selection dialog where you pick the file.

working-gui.thumb.png.af1313c1c921391e51

Edited by Gerowen
type-o
This topic is now closed to further replies.
  • Posts

    • Microsoft admits one of the most crucial Outlook features is currently broken by Sayan Sen Microsoft is making some decent progress when it comes to Windows 11. Recently we have confirmed reports of some rather useful improvements landing in the next version of the OS, 26H2, wherein GPU driver TDR crashes may finally be fixed, plus the company is also allowing users to disable web content on the Search. On the Outlook front though things have not been so rosy. Last month in May we reported several problems affecting basic functionalities on the app. These included a problem where documents would open blank or corrupt themselves. Following that, Quick Steps, a very useful feature, would no longer work correctly, and finally, Microsoft acknowledged a problem wherein images would fail to load up properly inside the email. Microsoft had resolved those bugs later and almost exactly a month after we reported on them, the company has now admitted a new similarly basic issue, this time on Macs. Users recently started noticing that Outlook would no longer display email threads properly as the original message itself was not displayed. An affected user Tsoumpas, C (ngmb) nicely described the problem in a forum post they made on Microsoft's site. They wrote: "Description of the issue: After updating Outlook for Mac [Version 16.110 (26061317)] on 18/6/2026, replying to any email no longer includes the original message in the reply window. Prior to the update, replies correctly contained the original email text below my response. Expected behavior: The original message should be included in the reply, as in previous Outlook versions and according to the configured reply settings. Actual behavior: The reply window contains only a blank composition area (or only my response), with none of the original email text included." Obviously this must be a highly frustrating for users as noted by several in that thread. The post, at the time of writing, has also been upvoted by more than 40 users indicating that is a fairly widespread bug. Thankfully Microsoft seems to have acknowledged the problem right around that time as it opened a new issue on its official website. In the support article, the company recommends switching to Outlook for Mac from the legacy app, where the problem appears to be happening.
    • PotPlayer 260622 by Razvan Serea PotPlayer is an extremely light-weight multimedia player for Windows. It feels like the KMPlayer, but is in active development. Supports almost every available video formats out there. PotPlayer contains internal codecs and there is no need to install codecs manually. Other key features include WebCam/Analog/Digital TV devices support, gapless video playback, DXVA, live broadcasting. Distinctive features of the player is a high quality playback, support for all modern video and audio formats and a built DXVA video codecs. A wide range of subtitles are supported and you are also able to capture audio, video, and screenshots. A comprehensive video and audio player, that also supports TV channels, subtitles and skins. Its been described on the Internet as The KMPlayer redux, and it pretty much is. Daum PotPlayer 260622 (1.7.22963) changelog: Removed Kakao TV Added pause function when navigating via the navigation bar Significantly improved internal stability Fixed an issue where colors appeared strange during RGB24 processing Improved playback for some HTTP streams Improved sync processing for the built-in audio renderer Fixed an issue where certain MP4 files behaved abnormally during playback Download: Daum PotPlayer (64-bit) | 54.7 MB (Freeware) Download: Daum PotPlayer (32-bit) | 61.1 MB View: Daum PotPlayer Home Page | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Tixati 3.44 is out.
    • Speccy 1.34.084 by Razvan Serea Speccy will give you detailed statistics on every piece of hardware in your computer. Including CPU, Motherboard, RAM, Graphics Cards, Hard Disks, Optical Drives, Audio support. Additionally Speccy adds the temperatures of your different components, so you can easily see if there's a problem! Processor brand and model Hard drive size and speed Amount of memory (RAM) Graphics card Operating system At first glance, Speccy may seem like an application for system administrators and power users. It certainly is, but Speccy can also help normal users, in everyday computing life. If you need to add more memory to your system, for example, you can check how many memory slots your computer has and what memory's already installed. Then you can go out and buy the right type of memory to add on or replace what you've already got. Download: Speccy 1.34.084 | 20.5 MB (Freeware) View: Speccy Website | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • ImgDrive 2.2.7 by Razvan Serea ImgDrive is a CD/DVD/BD emulator - a tool that allows you to mount optical disc images by simply clicking on them in Windows Explorer. If you have downloaded an ISO image and want to use it without burning it to a blank disc, ImgDrive is the easiest way to do it. ImgDrive features: One-click mounting of iso, cue, nrg, mds/mdf, ccd, isz images Runs on 32-bit and 64-bit Windows versions Mount ape, flac, m4a, wav, wavpack, tta file as AUDIO CD (16-bit/44.1kHz) Mount a folder as DVD/BD Mount images in command line Does not require rebooting after installation Support up to 7 virtual drives at the same time Support multi session disc image (ccd/mds/nrg) A special portable version is available Translated to more than 10 languages Support File Type: .ccd - CloneCD image files .cue - Cue sheets files of ape/flac/m4a/tta/wav/wv/bin .iso - Standard ISO image files .isz - Compressed ISO image files .nrg - Nero image files .mds - Media descriptor image files ImgDrive 2.2.7 changelog: Added command line parameter to set number of drives Added AACS-Auth support for HD DVD Bumped kernel driver version to 2.2.7 Download: ImgDrive 2.2.7 | 692 KB (Freeware, paid upgrade available) Download: ImgDrive Portable 535 KB View: ImgDrive Home Page | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
  • Recent Achievements

    • Dedicated
      tuben earned a badge
      Dedicated
    • Week One Done
      mnsgroup earned a badge
      Week One Done
    • Conversation Starter
      sumytbe earned a badge
      Conversation Starter
    • One Year In
      B4dM1k3 earned a badge
      One Year In
    • One Year In
      DarkWun earned a badge
      One Year In
  • Popular Contributors

    1. 1
      +primortal
      522
    2. 2
      +Edouard
      199
    3. 3
      PsYcHoKiLLa
      94
    4. 4
      Michael Scrip
      82
    5. 5
      neufuse
      69
  • Tell a friend

    Love Neowin? Tell a friend!