[AccessD] OT:Registry question (Cross-posted to dba-Tech)

MartyConnelly martyconnelly at shaw.ca
Fri Aug 6 16:12:39 CDT 2004


You can also modify with WMI on WinXP Win2000, don't forget to backup 
registry before testing


'to change the registry the actual current user logged in to
Sub testwmi()
Dim WSHShell, RegLocate, RegLocate1, RegLocate2
Dim strComputer, objRegistry, regName, regName1, regName2
Dim regValue, regValue1, regValue2
'Set WSHShell = WScript.CreateObject("WScript.Shell")

Const HKEY_CURRENT_USER = &H80000001
strComputer = "." 'local machine



'Define Registry Keys to be edited
RegLocate = "SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings"
regName = "ProxyEnable"
regValue = 0
RegLocate1 = "SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings"
regName1 = "ProxyServer"
regValue1 = ""
RegLocate2 = "SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings"
regName2 = "AutoConfigURL"
regValue2 = "ftp://gateway/pub/proxy.pac"
Call ModifyDWORD(strComputer, HKEY_CURRENT_USER, RegLocate, regName, 
regValue)
Call ModifyRegString(strComputer, HKEY_CURRENT_USER, RegLocate1, 
regName1, regValue1)
Call ModifyRegString(strComputer, HKEY_CURRENT_USER, RegLocate2, 
regName2, regValue2)
End Sub


Sub ModifyDWORD(strComputer, strRegistryHive, strRegPath, strRegName, 
intRegValue)
Dim objRegistry
Set objRegistry = 
GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
              strComputer & "\root\default:StdRegProv")
Dim Result

Result = objRegistry.SetDWORDValue(strRegistryHive, strRegPath, 
strRegName, intRegValue)


End Sub


Sub ModifyRegString(strComputer, strRegistryHive, strRegPath, 
strRegName, strRegValue)
Dim objRegistry
Set objRegistry = 
GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
   strComputer & "\root\default:StdRegProv")
Dim Result
Result = objRegistry.SetStringValue(strRegistryHive, strRegPath, 
strRegName, strRegValue)


End Sub

DWUTKA at marlow.com wrote:

>The Hive should be under HKEY_USERS
>
>Drew
>
>-----Original Message-----
>From: accessd-bounces at databaseadvisors.com
>[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Lavsa, Rich
>Sent: Friday, August 06, 2004 1:58 PM
>To: 'Access Developers discussion and problem solving'
>Subject: RE: [AccessD] OT:Registry question (Cross-posted to dba-Tech)
>
>
>There is a problem with doing that though.  You only see 2 hives, the "Local
>Machine" and "Local Users".  You don't see the Current User hive which is
>what I though he was after all along.
>
>-----Original Message-----
>From: DWUTKA at marlow.com [mailto:DWUTKA at marlow.com] 
>Sent: Friday, August 06, 2004 2:23 PM
>To: accessd at databaseadvisors.com
>Subject: RE: [AccessD] OT:Registry question (Cross-posted to dba-Tech)
>
>
>Start --> Run 
>regedit
>Okay
>Registry (Menu)
>Connect Network Registry...
>Type Computer Name
>Click Ok
>
>Drew
>
>
>-----Original Message-----
>From: accessd-bounces at databaseadvisors.com
>[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Andy Lacey
>Sent: Friday, August 06, 2004 12:49 PM
>To: 'Access Developers discussion and problem solving'
>Subject: RE: [AccessD] OT:Registry question (Cross-posted to dba-Tech)
>
>
>Howd'ya do that then?
>
>-- Andy Lacey
>http://www.minstersystems.co.uk 
>
>  
>
>>-----Original Message-----
>>From: accessd-bounces at databaseadvisors.com
>>[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of 
>>DWUTKA at marlow.com
>>Sent: 06 August 2004 17:19
>>To: accessd at databaseadvisors.com
>>Subject: RE: [AccessD] OT:Registry question (Cross-posted to dba-Tech)
>>
>>
>>Also, in a Windows 2k environment, you can use regedit, and
>>log into another registry on the network. So while that user 
>>is on their machine, you can edit the registry from your machine.
>>
>>Drew
>>
>>    
>>
>
>  
>

-- 
Marty Connelly
Victoria, B.C.
Canada






More information about the AccessD mailing list