Rob van der Woude's Scripting Pages

Help text for HasHardware.cs

(view help text of HasHardware.cs as plain text)

HasHardware.exe,  Version 1.05
Check the actual number of connected input and video devices available

Usage:    HasHardware.exe  [ hardware  [ type ] ]  [ output ]

Hardware: /I  check dIsplay (monitors) only (default: keyboard, monitor, mouse)
          /K  check Keyboards only          (default: keyboard, monitor, mouse)
          /M  check Mice only               (default: keyboard, monitor, mouse)

Type:     /A  count Analog (VGA) monitors only          (default: all types)
          /D  count Digital (DVI/HDMI/DP) monitors only (default: all types)
          /P  count PS/2 mice and/or keyboards only     (default: all types)
          /S  count Serial mice and/or keyboards only   (default: all types)
          /U  count USB mice and/or keyboards only      (default: all types)

Output:   /C  Continue on (access denied) errors (default: terminate on error)
          /H  Hide (access denied) errors        (default: terminate on error)
          /Q  Quiet mode: no screen output       (default: # per device class)
          /V  Verbose output: display properties (default: # per device class)
          /Y  YesNo mode: available or not?      (see Notes)

Notes:    This program requires elevated privileges.
          Hardware and types can be combined, e.g. /K /M /P /U for PS/2 and
          USB keyboards and mice; if no type is specified, all types will be
          listed.
          Command line switches /Q and /V are mutually exclusive.
          In case of access denied errors, switches /C and /H will use
          alternative WMI queries to count keyboards and/or mice; with /C an
          error message will be displayed, followed by the "plan B count", and
          return code will equal -1; with /H the "plan B count" will be shown
          without error message, and return code will not be affected; the
          alternative WMI queries may return less details, e.g. there is no way
          to determine the keyboard connector type without elevated privileges.
          Return code equals the sum of detected matching devices, or with /Y
          100 x K + 10 x V + M  (K = keyboards, V = monitors, M = mice),
          or -1 in case of command line or access denied errors.

Examples:   HasHardware
            Show keyboards, monitors and mice (all types)
            Return code equals total number of matching devices

            HasHardware /Y
            Show keyboards, monitors and mice
            Return code 111 if at least 1 keyboard and at least 1 monitor and
            at least 1 mouse were detected

            HasHardware /M /K /U /Y
            Show USB keyboards and mice, ignore monitors
            Return code 101 if at least 1 USB keyboard and at least 1 USB mouse
            were detected

            HasHardware /U /D
            Show USB keyboards and mice and digital moitors
            Return code equals total number of matching devices

Written by Rob van der Woude
https://www.robvanderwoude.com

page last uploaded: 2022-10-05; loaded in 0.0189 seconds