Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


List USB information

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,64119
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> List USB information
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 List USB information - 9/8/2008 2:19:36 AM   
  nol


Posts: 5
Score: 0
Joined: 9/2/2008
Status: offline
Dear all,

I´m trying to make a script to return USB information on a txt file but without sucess... Can anyone help?

On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_USBController")
 For Each objItem in colItems
  Wscript.Echo "Name: " & objItem.Name
  Wscript.Echo "Manufacturer: " & objItem.Manufacturer
  Wscript.Echo "Device ID: " & objItem.DeviceID
  Wscript.Echo "PNP Device ID: " & objItem.PNPDeviceID
  Const ForAppending = 8
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  Set objTextFile = objFSO.OpenTextFile ("D:\Share\USBControlerInfo.txt", ForAppending, True)
   For Each objWMIService in colItems   
    objTextFile.WriteLine(objService.DisplayName & vbTab & objService.State)
   next
 Next 
objTextFile.Close

The txt is openned but nothing is writen to the file??
Thanks!
 
 
Post #: 1
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> List USB information Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts