' Device configurator ' (c)oded by offtopic@mail.ru 2004 ' on error resume next Domain = "cohovineyard" path="\\cohovineyard.com\SYSVOL\cohovineyard.com\scripts" Devices=Array("*floppy*", "*CDROM*") Groups=Array("Copm Floppy", "Comp CDROM") Dim objGroup Set Args = WScript.Arguments Set fso = CreateObject("Scripting.FileSystemObject") set WshShell = WScript.CreateObject("WScript.Shell") Set WshSysEnv = WshShell.Environment("PROCESS") strSystem = WshSysEnv("Computername")&"$" strAction = Args(0) Function VerifyGroupMembers( strDomain, strGroup, strMember ) VerifyGroupMembers = False Set objGroup = GetObject("WinNT://" & Domain & "/" & strGroup & ",group") For Each objUser In objGroup.Members if UCase(objUser.Name)=UCase(strMember) then VerifyGroupMembers = True Exit For End If next End Function Sub EnableDev(device) set scriptState = WshShell.Exec(path&"\devcon.exe enable "&device) While (scriptState.Status = 0) WScript.Sleep(100) Wend End Sub Sub DisableDev(device, group) if VerifyGroupMembers(Domain, Group, StrSystem) then set scriptState = WshShell.Exec(path&"\devcon.exe disable "&device) While (scriptState.Status = 0) WScript.Sleep(100) Wend end if End Sub if strAction="enable" then for i = 0 to UBound(Devices) Call EnableDev(Devices(i)) Next else for i = 0 to UBound(Devices) Call DisableDev(Devices(i), Groups(i)) Next end if