I am going to be crazy about that. I run the following code on XP Sp1 box,
if the strComputer=".", everything is fine. If I switch to remote computer,
it failed and return error "C:\Script\test.vbs(10, 1) Microsoft VBScript
runtime error: Permission denied: 'GetObject'", of course i use Domain Admin
accounts to run this script.
Option Explicit
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_CURRENT_USER = &H80000001
Dim strComputer, strKeyPath, strValueName, objRegistry, strValue
strComputer = "RemoteServer"
'strComputer = "."
Set objRegistry=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &
strComputer & "\root\default:StdRegProv")
strKeyPath = "SYSTEM\CurrentControlSet\Services\lanmanserver\parameters"
strValueName = "AutoShareServer"
objRegistry.GetDWORDValue
HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
If IsNull(strValue) Then
Wscript.Echo "The registry key does not exist."
Else
Wscript.Echo "The registry key exists."
End If
===========================
But the problem is when copy the file to other XP SP1 box, it works like a
charm. I do install the latest Windows Script 5.6 version on it, what's
wrong with the problem?
Many thanks for your time!
Hi,
WMI is required on both machines, the one running the script and the remote
computer. Also, DCOM must not be disabled. Both machines should be joined to
the domain, and you need administrator rights (generally, you should be a
member of the "Domain Admins" group, which should have admin rights on all
computers in the domain). On some networks, DCOM has been disabled to
prevent worms. WMI comes with Windows 2000 or above, and can be installed on
older clients.
--
Richard
Microsoft MVP Scripting and ADSI
HilltopLab web site - http://www.rlmueller.net
--
After I enabled DCOM on my XP, it works on my box. Cheers!
"Richard Mueller [MVP]" <rlmuelle...@ameritech.NOSPAM.net> wrote in
message news:eWE7YFQz...@tk2msftngp13.phx.gbl...