Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Disable USB for writing - Run sript for multiple computers

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Disable USB for writing - Run sript for multiple computers
  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 >>
 Disable USB for writing - Run sript for multiple computers - 9/10/2008 1:40:53 AM   
  nol


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

This script will disable USB for writing data to mobile devices, on local computer.

On Error Resume Next
message = "This script will prevent Windows XP from writing to storage devices via USB." + vbcr + vbcr
message = message + "Continue?"
result = msgBox(message, VBYesNo + vbQuestion + vbDefaultButton2 + vbSystemModal, "Disable Writing to USB Storage Devices")
 If result = vbCancel Then
     WScript.Quit
 End If
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.RegWrite "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\usbstor\Start", 4, "REG_DWORD"        '3=Unlock  /  4=Lock
message = "Please reboot your computer for changes to take effect." + vbcr + vbcr
MsgBox message, vbOKOnly, "Disable Writing to USB Storage Devices"
Set WshShell = Nothing
Wscript.Quit

I have 1.000 computers in an access database that I need to run this script. Can anyone help me make this script read computers from database and run this?
Thanks!
 
 
Post #: 1
 
 RE: Disable USB for writing - Run sript for multiple co... - 9/10/2008 1:49:08 AM   
  dm_4ever


Posts: 2669
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
If you want to do this on various remote computers you will need to make sure you have administrative rights and rather than use WScript.Shell to write to the registry you will need to look at using WMI and the StdRegProv.....do a search and you'll find plenty of examples on writing values using WMI.

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to nol)
 
 
Post #: 2
 
 
 
  

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 >> Disable USB for writing - Run sript for multiple computers 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