通过CMD快速安装VNC服务器,无ico

private void InstallVNC(string msifullpath,string password="vdsm")

{

try

{

string serviceName = "tvnserver";

ServiceController[] services = ServiceController.GetServices();

bool serviceExists = services.Any(s => s.ServiceName == serviceName);

if (serviceExists)

{

WriteTipInfo("远程服务已存在,跳过自动部署!", Color.Blue);

}

else

{

WriteTipInfo("远程服务未安装,即将自动部署", Color.Blue);

string cmd = string.Format("msiexec.exe /i \"{0}\" /norestart /qn SET_USEVNCAUTHENTICATION=1 VALUE_OF_USEVNCAUTHENTICATION=1 SET_PASSWORD=1 VALUE_OF_PASSWORD={1} SET_VIEWONLYPASSWORD=1 VALUE_OF_VIEWONLYPASSWORD={1} SET_USECONTROLAUTHENTICATION=1 VALUE_OF_USECONTROLAUTHENTICATION=1 SET_CONTROLPASSWORD=1 VALUE_OF_CONTROLPASSWORD={1} SET_RUNCONTROLINTERFACE=1 VALUE_OF_RUNCONTROLINTERFACE=0", msifullpath, password);

File.WriteAllText("InsertRemote.bat", cmd);

Process.Start("InsertRemote.bat");

WriteTipInfo("远程服务的执行自动安装完成!", Color.Blue);

}

}

catch (Exception err)

{

WriteTipInfo("远程服务自动安装过程出现异常:"+err.Message, Color.Red);

}

}

各安装配置命令见PDF:https://www.tightvnc.com/doc/win/TightVNC_2.7_for_Windows_Installing_from_MSI_Packages.pdf

相关推荐
hhb_6188 小时前
Dylan 语言核心特性与工程实践深度解析
开发语言·c#
CSharp精选营9 小时前
最新.NET新手入门学习网站合集(2026更新版)
c#·学习资料·开发教程·.net 新手入门·开放资源·.net网站
hhb_61812 小时前
C#高性能异步编程实战与底层原理深度解析
开发语言·c#
beyond谚语13 小时前
反射、特性和依赖注入
c#
Tiger_shl14 小时前
C# 托管对象、非托管对象 讲解
开发语言·c#
LF男男14 小时前
Action- C# 内置的委托类型
java·开发语言·c#
2501_9307077818 小时前
使用C#代码在 PowerPoint 中创建组合图表
开发语言·c#·powerpoint
Full Stack Developme20 小时前
Hutool DFA 教程
开发语言·c#
xiaoshuaishuai821 小时前
【无标题】
开发语言·windows·c#
SunnyDays101121 小时前
C# 如何快速比较 Word 文档并显示差异
c#·对比 word 文档·比较 word 文档