Advertisement
Advertisement
| 11.29.2007 at 05:25AM PST, ID: 22990342 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: |
Option Explicit
' Create Objects
dim objNetwork: set objNetwork = CreateObject("Wscript.Network")
' Set Variables
dim strComputer: strComputer = "."
dim strSID, arrDeviceID(), i: i = 0
dim objWMIService, objAccount, colDevices, objDevice
' Connect to Computer
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
' Get User SID
Set objAccount = objWMIService.Get _
("Win32_UserAccount.Name='" & objNetwork.UserName & "',Domain='" & objNetwork.UserDomain & "'")
strSID = objAccount.SID
' Collect CD & DVD ROMs
Set colDevices = objWMIService.ExecQuery("Select * from Win32_CDROMDrive")
For Each objDevice in colDevices
ReDim Preserve arrDeviceID(i)
arrDeviceID(i) = objDevice.DeviceID
i = i + 1
Next
' Connect to Registry & Set DVD Autoplay Default for Each DeviceID Detected
const HKEY_USERS = &H80000003
const HKEY_CURRENT_USER = &H80000001
dim objRegistry: set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
dim strKeyPath: strKeyPath = strSID & "\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\UserChosenExecuteHandlers"
dim strValue: strValue = "VLCPlayDVDMovieOnArrival"
dim strValueName
For i = 0 to UBound(arrDeviceID)
strValueName = "H:\\?\" & Replace(arrDeviceID(i),"\","#") & "#{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}+PlayDVDMovieOnArrival"
objRegistry.SetStringValue HKEY_USERS, strKeyPath, strValueName, strValue
'objRegistry.SetStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, strValue
Next
Wscript.Echo "Finished"
|