远程访问OPC自动配置脚本,当OPC服务器与客户机不在同一台计算机时使用此设定。
新建bat文件,将以下红色脚本复制到文件里并运行00,00,\ >>opc.reg
echo 00,00,01,02,00,00,00,00,00,05,20,00,00,00,20,02,00,00,01,02,00,00,00,00,00,\ >>opc.reg echo 05,20,00,00,00,20,02,00,00 >>opc.reg
echo "EnableDCOM"="Y" >>opc.reg
echo "DefaultAccessPermission"=hex:01,00,04,80,58,00,00,00,68,00,00,00,00,00,00,00,\ >>opc.reg echo 14,00,00,00,02,00,44,00,03,00,00,00,00,00,14,00,07,00,00,00,01,01,00,00,00,\ >>opc.reg echo 00,00,01,00,00,00,00,00,00,14,00,07,00,00,00,01,01,00,00,00,00,00,05,0a,00,\ >>opc.reg echo 00,00,00,00,14,00,07,00,00,00,01,01,00,00,00,00,00,05,12,00,00,00,01,02,00,\ >>opc.reg echo 00,00,00,00,05,20,00,00,00,20,02,00,00,01,02,00,00,00,00,00,05,20,00,00,00,\ >>opc.reg echo 20,02,00,00 >>opc.reg
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Ole\AppCompat] >>opc.reg
echo
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Ole\AppCompat\ActivationSecurityCheckExemptionList] >>opc.reg
echo "{A50398B8-9075-4FBF-A7A1-456BF21937AD}"="1" >>opc.reg
echo "{AD65A69D-3831-40D7-9629-9B0B50A93843}"="1" >>opc.reg
echo "{0040D221-54A1-11D1-9DE0-006097042D69}"="1" >>opc.reg
echo "{2A6D72F1-6E7E-4702-B99C-E40D3DED33C3}"="1" >>opc.reg
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Ole\NONREDIST] >>opc.reg
echo "System.EnterpriseServices.Thunk.dll"="" >>opc.reg
@regedit /s opc.reg
rem echo 对本机的OPC Server进行配置
rem set opcsv=3FB14190-DEF2-4bba-998A-719C49C74DE1
rem reg add "HKEY_CLASSES_ROOT\AppID\{%opcsv%}" /v "RunAs" /t REG_SZ /d "Interactive User" /f >nul
rem reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AppID\{%opcsv%}" /v "RunAs" /t REG_SZ /d "Interactive User" /f >nul
echo 对本机的OPC Server进行配置,请在OPCname.txt文件中填写正确的OPC Server名称
for /F "tokens=*" %%a in (OPCname.txt) do for /F "skip=4 tokens=3" %%b IN ('reg query "HKEY_CLASSES_ROOT\%%a\CLSID"') DO @echo %%b & reg add "HKEY_CLASSES_ROOT\AppID\%%b" /v "RunAs" /t REG_SZ /d "Interactive User" /f & reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AppID\%%b" /v "RunAs" /t REG_SZ /d "Interactive User" /f
echo 恭喜您!OPCServer端的配置已经完成。需要注意事项如下:
echo 1. 本配置程序必须是您已经安装了相应的OPCServer及opcenum(枚举本机中的OPCServer) echo 如你未安装,将不会为你安装opcenum程序。
echo 2. 目前版本不能遍历本机已安装的OPCServer,因此不能对OPCServer进行配置。请自行对