【问题标题】:How to write a VB script that add reg and install cer - that i have in exe package如何编写添加 reg 并安装 cer 的 VB 脚本 - 我在 exe 包中
【发布时间】:2014-05-07 12:59:35
【问题描述】:

我正在编写一个具有 gui 的 vb 脚本,并且还写入注册表,并安装我拥有的证书。

在编写代码后,我使用 iexpress 创建一个 exe 文件,该文件将运行所有文件(cer 和 reg 文件)并安装我的脚本。

问题是我没有看到注册和证书正在安装。

test=MsgBox("To configure wsus on you pc",4,"Wsus installation")
If test = yes Then

Set WshShell = Wscript.CreateObject("Wscript.Shell") 
shell 'regedit -add "\\WSUS.reg"'
shell 'certmgr -add -c "\\wsus.cer" -s -r localMachine root'
shell 'certmgr -add -c "\\wsus.cer" -s -r localMachine trustedpublisher'

RestartServices "localhost", "wuauserv"
If Err.Number <> 0 Then
MsgBox (Err.number & "-" & err.Description)
else
MsgBox "Certificate Install completed"
End If

Else

End If

【问题讨论】:

标签: vbscript registry certificate cer


【解决方案1】:

test中的变量不会等于yes,而是6或7,6代表yes按钮,7代表no按钮。

因此,当您执行if 语句时,因为test 与yes 不匹配,因为它是6,它不会安装,只需转到Else 语句,该语句在end if 之前没有代码

【讨论】:

  • 我只写了这个: Set WshShell = Wscript.CreateObject("Wscript.Shell") shell 'regedit -add "\\WSUS.reg"' shell 'certmgr -add -c "\\wsus .cer" -s -r localMachine root' shell 'certmgr -add -c "\\wsus.cer" -s -r localMachinetrustedpublisher' RestartServices "localhost", "wuauserv"
  • 你用的是WshShell,但只能用shell调用,还有什么是RestartServices。是不是没有包含代码sn-p?
  • 这是我需要的重启特定服务。
猜你喜欢
  • 1970-01-01
  • 2020-04-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多