I've never tried to use WScript to do this. VFox ships with several
different samples that read the Registry. This works on my Win 8.1 machine:
#DEFINE HKEY_LOCAL_MACHINE -2147483646 && BITSET(0,31)+2
LOCAL regfile, oReg, lnValue, llRetVal
regfile = HOME(2)+"classes\registry.prg"
SET PROCEDURE TO (m.regfile) ADDITIVE
oReg = CreateObject("registry")
lnValue = 0
llRetVal = oReg.GetRegKey("DisableAntiSpyware",@lnValue,;
"Software\Microsoft\Windows Defender",;
HKEY_LOCAL_MACHINE)
WAIT WINDOW "The value is " + STR(lnValue)
On Tue, Jan 13, 2015 at 6:37 PM, Jack Skelley <[email protected]>
wrote:
> Good Evening All:
> I would like to be able to read a registry key in Windows 8.1 to see if
> the Windows Defender is active. So:
> gbError = .f. &&on error handles a key not found
> goWSHShell = CreateObject("WScript.Shell")
> lcKey = "HKLM\SOFTWARE\Microsoft\Windows Defender\DisableAntiSpyware"
> lnReturn = goWSHShell.RegRead(lcKey)
> do case
> case gbError
> gcDefender = "Microsoft Windows Defender Key Not Found..."
> case lnReturn = 1
> gcDefender = "Microsoft Windows Defender Found And Enabled..."
> case lnReturn = 0
> gcDefender = "Microsoft Windows Defender Present But Not Enabled..."
> endcase
> wait window gcDefender timeout 1
> I have zero issues reading a registry key in Windows 7 but in 8.1 I get an
> error 'invalid root key'
> I am sure it has something to do with the permissions of the key. I
> checked the permissions this and it gives 'read' rights to all users.
> But I still can't access the key.
> So how do you accesses the key? Thanks for any help.
> Best regards
> Jack
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/CACW6n4sr1C6G6Fkt=U4LK54GuhDC8=ZJCVMu_yOiT=uqnon...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.