怎么了?此代码适用于 Windows 7,不适用于 Windows 8。看起来错误代码一直为空。
Dim objShell, RegLocateName, RegLocatedn0, strName
Set objShell = WScript.CreateObject("WScript.Shell")
On Error Resume Next
Set objUser = GetObject("LDAP://" & strUser)
Set objSysInfo = CreateObject("ADSystemInfo")
strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUser)
strName = objUser.FullName
strPhone = objUser.homePhone
RegLocateName = "HKEY_LOCAL_MACHINE\SOFTWARE\Activa\ActivaTSP\calleridname0"
RegLocatedn0 = "HKEY_LOCAL_MACHINE\SOFTWARE\Activa\ActivaTSP\dn0"
Set Shell = CreateObject( "WScript.Shell" )
Shell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Activa\ActivaTSP\authType", 1, "REG_DWORD"
'Shell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Activa\ActivaTSP\calleridname0", "" & strName , "REG_SZ"
objShell.RegWrite RegLocateName,strName,"REG_SZ"
objShell.RegWrite RegLocatedn0,strPhone,"REG_SZ"
'Shell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Activa\ActivaTSP\dn0", "750", "REG_SZ"
Shell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Activa\ActivaTSP\outgoingContext", "from-internal", "REG_SZ"
Shell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Activa\ActivaTSP\agentContext", "from-internal", "REG_SZ"
Shell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Activa\ActivaTSP\host", "192.168.31.51", "REG_SZ"
Shell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Activa\ActivaTSP\user", "activa", "REG_SZ"
Shell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Activa\ActivaTSP\password", "OutlookHBRP", "REG_SZ"