-------------------- Begin Script---------------
Option Explicit
Const HKEY_CURRENT_USER = &H80000001
Dim StrComputer, StrNameSpace, StrUserName, StrPassword
Dim StrPath, StrKey, StrValue
Dim ObjWMIService, ObjWbemLocator
StrComputer = "Comp01"
StrNameSpace = "\root\default:StdRegProv"
StrUserName = "adminuser"
StrPassword = "correctpassword"
Set ObjWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set ObjWMIService = objWbemLocator.ConnectServer(StrComputer, _
StrNameSpace, StrUserName, StrPassword)
StrKey = "SOFTWARE\Microsoft\Office\11.0\Outlook\Security"
StrValue = "OutlookSecureTempFolder"
ObjWMIService.GetStringValue HKEY_CURRENT_USER, StrKey, StrValue, StrPath
MsgBox StrPath
-------------------------- End Script --------------------
--
Regards - Peter
I can't verify at the moment, but I believe that once you are authenticated
to the remote computer, you can bind to other objects on the computer with
the same permissions. For example:
=======
Dim objReg
Set ObjWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set ObjWMIService = objWbemLocator.ConnectServer(StrComputer, _
StrNameSpace, StrUserName, StrPassword)
Set objReg = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" _
& strComputer & strNameSpace)
StrKey = "SOFTWARE\Microsoft\Office\11.0\Outlook\Security"
StrValue = "OutlookSecureTempFolder"
objReg.GetStringValue HKEY_CURRENT_USER, StrKey, StrValue, StrPath
========
However, if the computer is remote, I don't think you can access the
HKEY_CURRENT_USER hive.
--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
Your idea did indeed prevent the error I was having, but the result returned
was null which suggests that your closing thoughts about loading the HKCU
hive from remote machines using VBScript is likely right. Now you mentioned
it I seem to recall reading something about that in an MS scripting article
which I cannot seem to find again.
Thanks again for your help.
--
Regards - Peter
"Richard Mueller [MVP]" wrote:
> .
>