::::::::::::::::::::::修改注册表,获取管理员权限::::::::::::::::::::::
@echo off
echo 获取Administrator权限
cacls.exe "%SystemDrive%\System Volume Information" >nul 2>nul
if %errorlevel%==0 goto Admin
if exist "%temp%\getadmin.vbs" del /f /q "%temp%\getadmin.vbs"
echo Set RequestUAC = CreateObject^("Shell.Application"^)>"%temp%\getadmin.vbs"
echo RequestUAC.ShellExecute "%~s0","","","runas",1 >>"%temp%\getadmin.vbs"
echo WScript.Quit >>"%temp%\getadmin.vbs"
"%temp%\getadmin.vbs" /f
if exist "%temp%\getadmin.vbs" del /f /q "%temp%\getadmin.vbs"
exit
:Admin
echo 成功取得Administrator权限

::::::::::::::::::::::修改注册表,关闭UAC::::::::::::::::::::::
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "ConsentPromptBehaviorAdmin" /t reg_dword /d 0 /F
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "EnableLUA" /t reg_dword /d 0 /F
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "PromptOnSecureDesktop" /t reg_dword /d 0 /F

::::::::::::::::::::::安装VNC::::::::::::::::::::::
echo 开始安装,请勿关闭.......

if /i %PROCESSOR_ARCHITECTURE% EQU AMD64 goto installX64
if /i %PROCESSOR_ARCHITECTURE% NEQ AMD64 goto installX86

rem 安装64位程序
:installX64
cd  %~dp0

rem 建立连接
rem net use \\172.16.200.101\ipc$ "密码" /user:"用户名"
net use \\172.16.200.101\ipc$ "P@ssw0rd" /user:"free\temp"

mkdir c:\temp
copy \\172.16.200.101\nc-dfs\IT\公用目录\常用办公软件\vnc\tightvnc.msi c:\temp\ /y
msiexec.exe /i c:\temp\tightvnc.msi /quiet /norestart ADDLOCAL="Server" SET_USEVNCAUTHENTICATION=1 VALUE_OF_USEVNCAUTHENTICATION=1 SET_PASSWORD=1 VALUE_OF_PASSWORD=admin@123 SET_VIEWONLYPASSWORD=1 VALUE_OF_VIEWONLYPASSWORD=admin@123 SET_USECONTROLAUTHENTICATION=1 VALUE_OF_USECONTROLAUTHENTICATION=1 SET_CONTROLPASSWORD=1 VALUE_OF_CONTROLPASSWORD=admin@123 /log VNCx64.log
echo 安装日志:VNCx64.log
goto endend

rem 安装32位程序
:installX86
cd  %~dp0

rem 建立连接
rem net use \\172.16.200.101\ipc$ "密码" /user:"用户名"
net use \\172.16.200.101\ipc$ "P@ssw0rd" /user:"free\temp"

mkdir c:\temp
copy \\172.16.200.101\nc-dfs\IT\公用目录\常用办公软件\vnc\tightvnc-32bit.msi c:\temp\ /y
msiexec.exe /i c:\temp\tightvnc-32bit.msi /quiet /norestart ADDLOCAL="Server" SET_USEVNCAUTHENTICATION=1 VALUE_OF_USEVNCAUTHENTICATION=1 SET_PASSWORD=1 VALUE_OF_PASSWORD=admin@123 SET_VIEWONLYPASSWORD=1 VALUE_OF_VIEWONLYPASSWORD=admin@123 SET_USECONTROLAUTHENTICATION=1 VALUE_OF_USECONTROLAUTHENTICATION=1 SET_CONTROLPASSWORD=1 VALUE_OF_CONTROLPASSWORD=admin@123 /log VNCx86.log
echo 安装日志:VNCx86.log
goto endend

:endend

rd /s /q c:\temp
net use \\172.16.200.101\ipc$ /delete
echo 安装完毕
pause

VNC:admin@123