如何在使用CMD(PSEXEC)的远程计算机上安装证书

发布于 2025-01-17 21:53:39 字数 261 浏览 3 评论 0原文

我正在尝试使用 cmd 在远程计算机上安装证书。在您建议使用 PS 之前,请记住我无法使用 PS,因为远程计算机是一些没有 PS 的自定义 Windows。
因此,对于我远程执行的所有操作,我都使用 psexec。

我制作了一个bat文件,它将使用certutil将证书添加到指定的存储中,但我不确定如何将它们复制到那里将它们推送到存储,然后删除文件。需要注意的一点是,对于我登录的远程计算机,我需要使用本地帐户。

这里有人有什么建议吗?

I'm trying to install a certificate using cmd on a remote machine. Before you suggest PS please keep in mind I can't use PS since the remote machine is some custom Windows which doesn't have it.
So for everything I am doing remotely I use psexec.

I made a bat file which will use certutil to add certificates to designated stores but I am unsure on how to copy them there push them to store and then remove the files after that. One think to note is that for the remote machine I am logging into I need to use a local account.

Does anyone here have any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

愛上了 2025-01-24 21:53:39

您可以通过命令行将证书作为 base64 编码文本传输:

REM Convert binary to base64
certutil.exe -encode -f ".\certificate.cer" ".\tmp.b64"

REM Read base64 into variable
SET BASE64CERT=type .\tmp.b64

REM Run commands on remote computer
psexec.exe \\REMOTECOMPUTER "echo %BASE64CERT%> 'c:\Windows\temp\certificate.cer' && certutil.exe -addstore -f 'MY' 'c:\Windows\temp\certificate.cer' ** del 'c:\Windows\temp\certificate.cer'

You could transmit the certificates as base64 encoded text over the command line:

REM Convert binary to base64
certutil.exe -encode -f ".\certificate.cer" ".\tmp.b64"

REM Read base64 into variable
SET BASE64CERT=type .\tmp.b64

REM Run commands on remote computer
psexec.exe \\REMOTECOMPUTER "echo %BASE64CERT%> 'c:\Windows\temp\certificate.cer' && certutil.exe -addstore -f 'MY' 'c:\Windows\temp\certificate.cer' ** del 'c:\Windows\temp\certificate.cer'
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文