I’m going through some old scripts I’ve written or stolen from my years as a solutions engineer / developer and have come across one I thought was worthy of sharing.
The intent of this script was to loop through a list of USB devices found on a given PC.
I might store the results in a database as part of an device tracking inventory system or use the data to do something else in the code logic if I had found a specific USB device attached.
Example: VBScript to List all USB Devices
Get the code here on GitHub
'Win32_PnPEntity info here: http://msdn.microsoft.com/en-us/library/aa394353(v=vs.85).aspx
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colDevices = objWMIService.ExecQuery _
("Select * From Win32_USBControllerDevice")
For Each objDevice in colDevices
strDeviceName = objDevice.Dependent
strQuotes = Chr(34)
strDeviceName = Replace(strDeviceName, strQuotes, "")
arrDeviceNames = Split(strDeviceName, "=")
strDeviceName = arrDeviceNames(1)
Set colUSBDevices = objWMIService.ExecQuery _
("Select * From Win32_PnPEntity Where DeviceID = '" & strDeviceName & "'")
For Each objUSBDevice in colUSBDevices
Wscript.Echo objUSBDevice.Description & ": " & objUSBDevice.Manufacturer
If you run this script on a remote computer on a network domain instead of your own, you will probably have to run this script with Administrator rights depending on the who the network is configured.
You can check out my article on how to run VBScript as an administrator if you need help with that.
Hope this helps somebody! 🙂
SVN error: ra_serf: The server sent a truncated HTTP response body.
While working on a large enterprise project, I’m getting a Subversion (SVN) error “SVN error: ra_serf: The server sent a truncated HTTP response body.” when updating a repository to a network drive.
I found part of the answer on a Stack Overflow post about SVN error: E120106: ra_serf: The server sent a truncated HTTP response body.
This work around assumes the SVN checkout folder is already present provided was a two SVN command line commands.
$ svn cleanup
$ svn up
I ran the SVN command line commands manually for days but still the huge project updates would hang after about 5-10 minutes.
I decided I would try to automate this process a little bit to see if I could run the commands via a script and just repeat the cleanup and update commands every time it hung or stopped until the Subversion (SVN) update process has successfully completed.
Automating the SVN Cleanup and Update Commands in a VBScript.
Below is the script I just wrote today to try and automate the SVN processes.
- Create Windows Shell
- Use Shell and Run method calling taskkill command to kill any SVN processes that might be hung.
- Use Shell and Run SVN with the “cleanup” w/ path argument to identify the SVN Repository folder we are targeting.
- Use Shell and Run SVN with the update command, “up”, with path to identify the SVN Repository folder we are targeting.
The VBScript Code
Dim oShell : Set Oshell = CreateObject("WScript.Shell")
For i = 1 to 3
OShell.Run "taskkill /im svn.exe /F", 5, True
OShell.Run """C:\Program Files\VisualSVN Server\bin\svn.exe"" cleanup H:\Repo\", 1, True
OShell.Run """C:\Program Files\VisualSVN Server\bin\svn.exe"" up H:\Repo\", 1, True
Set OShell = Nothing
SVN Error: E120106 in a Nutshell
In summary, the SVN error E120106 for truncated HTTP response body is coming from the SVN server.
Everyone on this team has this issue and checkout code repository to their local C drives to checkout and commit work.
I suspect our network is just slow enough to cause a hiccup in communications between HTTP on SVN repository side and Windows file system.
I hope this work around and simple explanation help somebody out there with the same issue. 🙂