简体   繁体   English

用于静默安装 .exe 的 PowerShell 脚本

[英]PowerShell script to silent install .exe

I have to deploy an .exe silently for our employees.我必须为我们的员工默默地部署一个 .exe。 Although the program is very old and does not show any documentation of any parameters.尽管该程序很旧并且没有显示任何参数的任何文档。 The only parameter i could find is the silent install one which is /s我能找到的唯一参数是静默安装,它是 /s

But.. once i execute the .exe with /si get a prompt asking me to enter a password because the installer is protected with a password.但是..一旦我用 /si 执行 .exe 就会得到一个提示,要求我输入密码,因为安装程序受密码保护。 I have the pass but is it possible to create a script in PS to automaticly enter the password?我有通行证,但是可以在PS中创建一个脚本来自动输入密码吗? Normally it would be something like "/p PASSWORD " but none of those parameters are anywhere to be found.通常它会类似于“/p PASSWORD ”,但在任何地方都找不到这些参数。

You commented:你评论说:

The thing is i want the installer.exe to not even give me a pop up asking for the password.问题是我希望 installer.exe 甚至不给我一个要求输入密码的弹出窗口。 But i can't find the correct parameter to give the password prior to installation.但是在安装之前我找不到正确的参数来提供密码。

Whether you can do that depends on how the installer is constructed.您是否可以这样做取决于安装程序的构造方式。 If it forces a GUI password prompt and does not provide a way to bypass that, then you cannot automate it reliably.如果它强制一个 GUI 密码提示并且没有提供绕过它的方法,那么你就不能可靠地自动化它。

Alternatively: You could use a reference computer (a virtual machine would work well for this), use a snapshot tool that can log all changes to the file system and registry, run your installer, record the changes, and then build your own installer that doesn't require the password.或者:您可以使用参考计算机(虚拟机可以很好地执行此操作),使用可以记录对文件系统和注册表的所有更改的快照工具,运行您的安装程序,记录更改,然后构建您自己的安装程序不需要密码。

This question is probably much better suited to superuser , however.然而,这个问题可能更适合superuser

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM