![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | registry caching/protecting Hi all, I have a little script to read a registry value using WMI: Const HKEY_LOCAL_MACHINE = &H80000002 Set StdOut = WScript.StdOut Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\.\root\default:StdRegProv") strKeyPath = "SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\CurrentVersion" strValueName = "CurrentVersion" lStatus = objReg.GetStringValue (HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue) StdOut.WriteLine "Status: " & lStatus StdOut.WriteLine "Value: " & strValue Set objReg = Nothing Running on a Win 2003 R2 x64 SP2 the output looks like: Status: 0 Value: 10.0.1600.22 So far so good. If i now open regedit and rename the registry value let's say to "OldVersion" without changing the script, rerunning the script still shows to above result ???? Is there any registry caching or registry protecting going on and how to prevent this from happen ?? TIA acki Little ad on info: Running this script on a vista ent. (with sql server installed to have the requested regkeys) the script act as expected (error after renaming regkey with regedit) ??? |
My System Specs![]() |
| | #2 (permalink) |
| | Re: registry caching/protecting "Dan" <Dan@xxxxxx> wrote in message news:7870CA45-42F7-402C-81C5-C1991D5259F3@xxxxxx Quote: > Hi all, > I have a little script to read a registry value using WMI: > > > Const HKEY_LOCAL_MACHINE = &H80000002 > > Set StdOut = WScript.StdOut > Set objReg = > GetObject("winmgmts:{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\.\root\default:StdRegProv") > > strKeyPath = "SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\CurrentVersion" > strValueName = "CurrentVersion" > lStatus = objReg.GetStringValue > (HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue) > > StdOut.WriteLine "Status: " & lStatus > StdOut.WriteLine "Value: " & strValue > Set objReg = Nothing > > Running on a Win 2003 R2 x64 SP2 the output looks like: > Status: 0 > Value: 10.0.1600.22 > > So far so good. > > If i now open regedit and rename the registry value let's say to > "OldVersion" without changing the script, rerunning the script still shows > to > above result ???? > Is there any registry caching or registry protecting going on and how to > prevent this from happen ?? > > TIA > acki > > Little ad on info: > Running this script on a vista ent. (with sql server installed to have the > requested regkeys) the script act as expected (error after renaming regkey > with regedit) ??? Renaming the value "CurrentVersion" to "OldVersion" caused the script to return a blank. Perhaps you were renaming the wrong value. Note also that your line [StdOut.WriteLine "Value: " & strValue] contains a misnomer. You're not returning a registry "value" but the "value data" for the value name "CurrentVersion". |
My System Specs![]() |
| | #3 (permalink) |
| | Re: registry caching/protecting Pegasus, The problem is only on win2k3 x64 systems The script returns the data from HKLM\SOFTWARE\Wow6432Node\Microsoft\MSSQLServer\MSSQLServer\CurrentVersion and not from HKLM\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\CurrentVersion so renameing in the second hive does not change the script output... Thx for your quick response anyway. I'm sure not renaming wrong key as it only exists ( "Pegasus [MVP]" wrote: Quote: > > "Dan" <Dan@xxxxxx> wrote in message > news:7870CA45-42F7-402C-81C5-C1991D5259F3@xxxxxx Quote: > > Hi all, > > I have a little script to read a registry value using WMI: > > > > > > Const HKEY_LOCAL_MACHINE = &H80000002 > > > > Set StdOut = WScript.StdOut > > Set objReg = > > GetObject("winmgmts:{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\.\root\default:StdRegProv") > > > > strKeyPath = "SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\CurrentVersion" > > strValueName = "CurrentVersion" > > lStatus = objReg.GetStringValue > > (HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue) > > > > StdOut.WriteLine "Status: " & lStatus > > StdOut.WriteLine "Value: " & strValue > > Set objReg = Nothing > > > > Running on a Win 2003 R2 x64 SP2 the output looks like: > > Status: 0 > > Value: 10.0.1600.22 > > > > So far so good. > > > > If i now open regedit and rename the registry value let's say to > > "OldVersion" without changing the script, rerunning the script still shows > > to > > above result ???? > > Is there any registry caching or registry protecting going on and how to > > prevent this from happen ?? > > > > TIA > > acki > > > > Little ad on info: > > Running this script on a vista ent. (with sql server installed to have the > > requested regkeys) the script act as expected (error after renaming regkey > > with regedit) ??? > When I ran your script on my WinXP machine then it behaved as expected. > Renaming the value "CurrentVersion" to "OldVersion" caused the script to > return a blank. Perhaps you were renaming the wrong value. Note also that > your line [StdOut.WriteLine "Value: " & strValue] contains a misnomer. > You're not returning a registry "value" but the "value data" for the value > name "CurrentVersion". > > > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: registry caching/protecting Sorry, I don't have a 64-bit system available to test your script. Instead of WMI you might try the RegRead method of the WshShell object. "Dan" <Dan@xxxxxx> wrote in message news:117B6809-C10D-457C-B635-A21AF611D75A@xxxxxx Quote: > Pegasus, > The problem is only on win2k3 x64 systems > > The script returns the data from > HKLM\SOFTWARE\Wow6432Node\Microsoft\MSSQLServer\MSSQLServer\CurrentVersion > > and not from > HKLM\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\CurrentVersion > > so renameing in the second hive does not change the script output... > Thx for your quick response anyway. > > > > I'm sure not renaming wrong key as it only exists ( > "Pegasus [MVP]" wrote: > Quote: >> >> "Dan" <Dan@xxxxxx> wrote in message >> news:7870CA45-42F7-402C-81C5-C1991D5259F3@xxxxxx Quote: >> > Hi all, >> > I have a little script to read a registry value using WMI: >> > >> > >> > Const HKEY_LOCAL_MACHINE = &H80000002 >> > >> > Set StdOut = WScript.StdOut >> > Set objReg = >> > GetObject("winmgmts:{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\.\root\default:StdRegProv") >> > >> > strKeyPath = >> > "SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\CurrentVersion" >> > strValueName = "CurrentVersion" >> > lStatus = objReg.GetStringValue >> > (HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue) >> > >> > StdOut.WriteLine "Status: " & lStatus >> > StdOut.WriteLine "Value: " & strValue >> > Set objReg = Nothing >> > >> > Running on a Win 2003 R2 x64 SP2 the output looks like: >> > Status: 0 >> > Value: 10.0.1600.22 >> > >> > So far so good. >> > >> > If i now open regedit and rename the registry value let's say to >> > "OldVersion" without changing the script, rerunning the script still >> > shows >> > to >> > above result ???? >> > Is there any registry caching or registry protecting going on and how >> > to >> > prevent this from happen ?? >> > >> > TIA >> > acki >> > >> > Little ad on info: >> > Running this script on a vista ent. (with sql server installed to have >> > the >> > requested regkeys) the script act as expected (error after renaming >> > regkey >> > with regedit) ??? >> When I ran your script on my WinXP machine then it behaved as expected. >> Renaming the value "CurrentVersion" to "OldVersion" caused the script to >> return a blank. Perhaps you were renaming the wrong value. Note also that >> your line [StdOut.WriteLine "Value: " & strValue] contains a misnomer. >> You're not returning a registry "value" but the "value data" for the >> value >> name "CurrentVersion". >> >> >> |
My System Specs![]() |
| | #5 (permalink) |
| | Re: registry caching/protecting If you run a .vbs script from your command prompt the cscript.exe in C:\Windows\SysWOW64 is used. Unfortunatly this is a 32-vit exe and therefor the keys/values in Wow6432 hive are shown... :-( Just use cscript.exe in c:\windows\system (=64 bit version) and your happy again :-) acki "Pegasus [MVP]" wrote: Quote: > Sorry, I don't have a 64-bit system available to test your script. Instead > of WMI you might try the RegRead method of the WshShell object. > > > "Dan" <Dan@xxxxxx> wrote in message > news:117B6809-C10D-457C-B635-A21AF611D75A@xxxxxx Quote: > > Pegasus, > > The problem is only on win2k3 x64 systems > > > > The script returns the data from > > HKLM\SOFTWARE\Wow6432Node\Microsoft\MSSQLServer\MSSQLServer\CurrentVersion > > > > and not from > > HKLM\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\CurrentVersion > > > > so renameing in the second hive does not change the script output... > > Thx for your quick response anyway. > > > > > > > > I'm sure not renaming wrong key as it only exists ( > > "Pegasus [MVP]" wrote: > > Quote: > >> > >> "Dan" <Dan@xxxxxx> wrote in message > >> news:7870CA45-42F7-402C-81C5-C1991D5259F3@xxxxxx > >> > Hi all, > >> > I have a little script to read a registry value using WMI: > >> > > >> > > >> > Const HKEY_LOCAL_MACHINE = &H80000002 > >> > > >> > Set StdOut = WScript.StdOut > >> > Set objReg = > >> > GetObject("winmgmts:{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\.\root\default:StdRegProv") > >> > > >> > strKeyPath = > >> > "SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\CurrentVersion" > >> > strValueName = "CurrentVersion" > >> > lStatus = objReg.GetStringValue > >> > (HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue) > >> > > >> > StdOut.WriteLine "Status: " & lStatus > >> > StdOut.WriteLine "Value: " & strValue > >> > Set objReg = Nothing > >> > > >> > Running on a Win 2003 R2 x64 SP2 the output looks like: > >> > Status: 0 > >> > Value: 10.0.1600.22 > >> > > >> > So far so good. > >> > > >> > If i now open regedit and rename the registry value let's say to > >> > "OldVersion" without changing the script, rerunning the script still > >> > shows > >> > to > >> > above result ???? > >> > Is there any registry caching or registry protecting going on and how > >> > to > >> > prevent this from happen ?? > >> > > >> > TIA > >> > acki > >> > > >> > Little ad on info: > >> > Running this script on a vista ent. (with sql server installed to have > >> > the > >> > requested regkeys) the script act as expected (error after renaming > >> > regkey > >> > with regedit) ??? > >> > >> When I ran your script on my WinXP machine then it behaved as expected. > >> Renaming the value "CurrentVersion" to "OldVersion" caused the script to > >> return a blank. Perhaps you were renaming the wrong value. Note also that > >> your line [StdOut.WriteLine "Value: " & strValue] contains a misnomer. > >> You're not returning a registry "value" but the "value data" for the > >> value > >> name "CurrentVersion". > >> > >> > >> > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Caching PNG thumbnails in Vista | Vista General | |||
| Caching PNG thumbnails in Vista | Vista music pictures video | |||
| Disabling Thumbnail caching | Vista file management | |||
| Floppy caching? | Vista hardware & devices | |||
| memory caching | Vista General | |||