WMI 获取证书颁发机构列表

WMI get certification authorities list

我尝试编写 2 个 WMIC 命令来生成所有已安装的列表 applications 在 mashine 和另一个 certificates 并将其写入文件。

一个问题是我的证书命令不能正常工作。第二个命令 returns 与安装的应用程序相同的文件除了安装的证书。我真的不明白为什么,因为在我看来命令看起来不错。这是以下 2 个命令:

rem command to check installed aplications
wmic product get /format:csv > %USERPROFILE%/Desktop/vistadraft-applications-%Computername%-%Username%.csv && echo [.] [STARTING] && echo [.] application version list [PROCESSING] && echo [.] [FINISHED]

rem command to check installed certificates
wmic product get /format:csv > %USERPROFILE%/Desktop/vistadraft-certificates-%Computername%-%Username%.csv && echo [.] [STARTING] && echo [.] certification authorities list [PROCESSING] && echo [.] [FINISHED]

拜托,谁知道哪里出了问题?

引用 msdn

To run the following WMI Command-Line Tools, your account must be in the Administrators group and the tool must be run from an elevated command prompt. The built-in administrator account can also run these tools.

因此您需要运行 wmic 作为管理员。

a. 只需右键单击 cmd.exe 和 select "Run as Administrator" 然后 运行 您的脚本。

b. 保存批处理文件并右击,selecting Run as Administrator

最后,我建议您将路径用双引号引起来。

rem command to check installed aplications
wmic product get /format:csv > "%USERPROFILE%/Desktop/vistadraft-applications-%Computername%-%Username%.csv" && echo [.] [STARTING] && echo [.] application version list [PROCESSING] && echo [.] [FINISHED]

rem command to check installed certificates
wmic product get /format:csv > "%USERPROFILE%/Desktop/vistadraft-certificates-%Computername%-%Username%.csv" && echo [.] [STARTING] && echo [.] certification authorities list [PROCESSING] && echo [.] [FINISHED]