[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Find all com prrts usb ports etc

Posted on 2007-08-11
8
Medium Priority
?
216 Views
Last Modified: 2010-03-05
Hi,

I want a script which can get all the Com,USB,VGA,Ps2, and any other ports a machine has.

All the data to a csv file.With header of any available ports...

I have all machine names in a file.

Regards
Sharath
0
Comment
Question by:bsharath
  • 4
  • 4
8 Comments
 
LVL 26

Expert Comment

by:Farhan Kazi
ID: 19677012
:: ================
:: READ THIS FIRST
:: ================
:: * To run this script you must have domain administrators rights.
:: * This script require "Computers.txt" file on C: drive root from where it will pick computer names.
:: * Successful run will generate "SystemName_Ports.csv" on C: drive root.
:: * Copy and Paste following script into notepad and save it with any name having .bat extension.
:: Batch Script Start

@Echo Off
SETLOCAL EnableDelayedExpansion

IF NOT EXIST C:\Computers.txt Goto ShowErr
FOR %%R IN (C:\Computers.txt) Do IF %%~zR EQU 0 Goto ShowErr
FOR /F %%c IN ('Type Computers.txt') Do (
    Echo Processing: %%c
      PING -n 1 -w 1000 %%c|Find /I "TTL" >NUL
      IF NOT ErrorLevel 1 (
            WMIC /NODE:"%%c" PORTCONNECTOR GET ExternalReferenceDesignator >C:\%%c_Ports.csv
      )ELSE (Echo %%c: Not able to connect)
)      

Goto EndScript
:ShowErr
Echo "C:\Computers.txt" file does not exist or file is empty!
:EndScript
ENDLOCAL
:: Batch Script End
0
 
LVL 11

Author Comment

by:bsharath
ID: 19678317
I get this.

ExternalReferenceDesignator  
COM 1                        
Parallel                    
Keyboard                    
PS/2 Mouse                  


But no usb?
And i dont get info for Rack servers
It just shows this.
ExternalReferenceDesignator  

Can you put all results in 1 file instead of each file for each machine.
0
 
LVL 26

Expert Comment

by:Farhan Kazi
ID: 19678676
:: ================
:: READ THIS FIRST
:: ================
:: * To run this script you must have domain administrators rights.
:: * This script require "Computers.txt" file on C: drive root from where it will pick computer names.
:: * Following script requires 'Devcon.exe' on same path from where this script required to be run
::    'Devcon.exe' can be freely be downloaded from following site:
::     http://support.microsoft.com/kb/311272
:: * Successful run will generate "SystemPorts.txt" on C: drive root.
:: * Copy and Paste following script into notepad and save it with any name having .bat extension.
:: Batch Script Start

@Echo Off
SETLOCAL EnableDelayedExpansion

IF NOT EXIST C:\Computers.txt Goto ShowErr
FOR %%R IN (C:\Computers.txt) Do IF %%~zR EQU 0 Goto ShowErr
IF EXIST C:\SystemPorts.txt DEL /F /Q C:\SystemPorts.txt

FOR /F %%c IN ('Type Computers.txt') Do (
    Echo Processing: %%c
      PING -n 1 -w 1000 %%c|Find /I "TTL" >NUL
      IF NOT ErrorLevel 1 (
                  Echo ----------------- >>C:\SystemPorts.txt
                  Echo %%c >>C:\SystemPorts.txt            
                  Echo ----------------- >>C:\SystemPorts.txt
                  SET Qry=Devcon -m:\\%%c ListClass Display Ports USB Keyboard Mouse
                  FOR /F "Delims=: Tokens=2" %%H IN ('!Qry!') Do (@Echo %%H >>C:\SystemPorts.txt)
      )ELSE (
        Echo ----------------- >>C:\SystemPorts.txt
        Echo %%c: Not able to connect >>C:\SystemPorts.txt
        Echo ----------------- >>C:\SystemPorts.txt)
)      

Goto EndScript
:ShowErr
Echo "C:\Computers.txt" file does not exist or file is empty!
:EndScript
ENDLOCAL
:: Batch Script EndServer                               
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Author Comment

by:bsharath
ID: 19678710
Farhan
I get this.

-----------------
hydsophos            
-----------------
 RADEON 7000 SERIES      
 Communications Port (COM1)
 Intel(R) 82801EB USB Universal Host Controller - 24D2
 Intel(R) 82801EB USB Universal Host Controller - 24D4
 Intel(R) 82801EB USB Universal Host Controller - 24D7
 Intel(R) 82801EB USB2 Enhanced Host Controller - 24DD
 USB Root Hub
 USB Root Hub
 USB Root Hub
 USB Root Hub
 USB Composite Device
 USB Composite Device
 Generic USB Hub
 HID Keyboard Device
 HID Keyboard Device
 HID-compliant mouse
 HID-compliant mouse
-----------------
Indiasophos            
-----------------
 RADEON 7000 SERIES      
 LogMeIn Mirror Driver
 Communications Port (COM1)
 Intel(R) 82801EB USB Universal Host Controller - 24D2
 Intel(R) 82801EB USB Universal Host Controller - 24D4
 Intel(R) 82801EB USB Universal Host Controller - 24D7
 Intel(R) 82801EB USB2 Enhanced Host Controller - 24DD
 USB Root Hub
 USB Root Hub
 USB Root Hub
 USB Root Hub
 USB Composite Device
 Generic USB Hub
 HID Keyboard Device
 HID-compliant mouse
-----------------
dev-chen-mrd100            
-----------------
 Standard VGA Graphics Adapter
 LogMeIn Mirror Driver
 ECP Printer Port (LPT1)
 Communications Port (COM1)
 Standard Universal PCI to USB Host Controller
 Standard Universal PCI to USB Host Controller
 Standard Universal PCI to USB Host Controller
 Standard Universal PCI to USB Host Controller
 Standard Enhanced PCI to USB Host Controller
 USB Root Hub
 USB Root Hub
 USB Root Hub
 USB Root Hub
 USB Root Hub
 Standard 101/102-Key or Microsoft Natural PS/2 Keyboard
 PS/2 Compatible Mouse

What does these mean...
0
 
LVL 26

Expert Comment

by:Farhan Kazi
ID: 19678722
Perfect, it shows number of ports that are enabled (Bios) on system. First is shows Display Card, COM and LPT Ports,  USB Ports, Keyboard and Mouse.
0
 
LVL 11

Author Comment

by:bsharath
ID: 19678731
Now how should i count how many usb's are there in Dev-chen-mrd100..
0
 
LVL 26

Accepted Solution

by:
Farhan Kazi earned 2000 total points
ID: 19678857
Above script depicts the information of Device Manager, to verify go to the 'Dev-chen-mrd100' and follow these steps.

    * Right-click My Computer
    * Click on Properties
    * Click on the Hardware tab
    * Click on the device Manager button
    * Scroll down as needed until you see Universal Serial Bus Controllers
    * Expand that by clicking on the boxed plus sign in front of Universal Serial Bus Controllers
0
 
LVL 11

Author Comment

by:bsharath
ID: 19679078
Farhan this is a nice one.If you can change this script a bit i shall raise a new Q.
Machinename   Com port   VGA  LPT   USB  
Dev-chen-mrd100   1          1       1        4
Is there a way to do this.

Please let me know i shall raise a Q....
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Issue: One Windows 2008 R2 64bit server on the network unable to connect to a buffalo Device (Linkstation) with firmware version 1.56. There are a total of four servers on the network this being one of them. Troubleshooting Steps: Connect via h…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question