寻找一个脚本/工具来转储 Windows Server 2008 R2 上已安装的功能和程序的列表
同一个编译的 .Net / C++ / Com 程序在两台看似相同的计算机上执行不同的操作。两者都安装了数十个东西。我想通过查看 ASCII 差异来找出两者之间的区别。在此之前,我需要以简单可读的格式“序列化”已安装内容的列表 - 按字母顺序排序+每行一个项目。
Python 脚本是理想的选择,但我还安装了 Perl、PowerShell。
谢谢。
The same compiled .Net / C++ / Com program does different things on two seemingly same computers. Both have DOZENS of things installed on them. I would like to figure out what the difference between the two is by looking at an ASCII diff. Before that I need to "serialize" the list of installed things in a plain readable format - sorted alphabetically + one item per line.
A Python script would be ideal, but I also have Perl, PowerShell installed.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以从注册表中获取已安装程序的列表。它位于 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall 下
如果这是一次性练习,您甚至可能不需要编写任何代码 - 只需使用 Regedit 将密钥导出到 .REG 文件。如果你确实想自动化它,Python 提供了 _winreg 模块用于注册表访问。
You can get the list of installed programs from the registry. It's under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
If this is a once-off exercise you may not even need to write any code - just use Regedit to export the key to a .REG file. If you do want to automate it Python provides the _winreg module for registry access.
Microsoft 提供的两种工具可能正是您所需要的:RegDump 和 RegDiff。您可以从各个地方下载它们,包括Microsoft Vista 徽标测试工具包的一部分。
此外,还有 Microsoft 支持文章如何使用 WinDiff 比较注册表文件。
对于Pythonic方式,这里是一个ActiveState配方,用于获取所有子项的格式化输出特定键(例如 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall)。
There are two tools from Microsoft that may be what you need: RegDump and RegDiff. You can download them from various places, including as part of the Microsoft Vista Logo Testing Toolkit.
Also, there is Microsoft Support article How to Use WinDiff to Compare Registry Files.
For a Pythonic way, here is an ActiveState recipe for getting formatted output of all the subkeys for a particular key (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall for example).
就我个人而言,我一直喜欢 sysinternals 的东西(功能强大、轻便、实用的工具 - 无需安装)
有命令行工具 psinfo 可以在本地或远程计算机上以各种格式获取您想要的内容(以及一些),区分修补程序和已安装的软件(前提是系统策略允许在远程进行)。
您还可以从此处实时运行它,因此虽然不是严格意义上的Pythonic,但您可以将其插入相当很好。
Personally I always liked sysinternals' stuff (powerfull, light, actual tools - no need to install)
There is command line tool psinfo that can get you what you want (and then some) in various formats, distinguishing hotfixes and installed software, on local or remote computer (providing system policies allow it on remote).
You can also run it live from here, so though not strictly pythonic you could plug it in quite nicely.
摘自从命令行列出已安装的软件< /a>:
警告:此命令似乎仅列出通过 Windows Installer 安装的软件。请参阅 Win32_Product 类
Taken from List installed software from the command line:
Caveat: It seems that this command only list software installed through Windows Installer. See Win32_Product class