MECM 上存储部署类型安装程序的 WMI 类是什么

发布于 2025-01-13 05:19:21 字数 260 浏览 0 评论 0原文

我需要通过 WMI 类检索与 MECM 应用程序相关的数据,更具体地说,我需要获取应用程序部署类型属性 - 安装/卸载程序。

您能帮我一下吗,我可以使用什么确切的 WMI 类来获取此信息。

感谢您的帮助。

部署类型道具

I need to retreive a data related the MECM Application via WMI classes, more specifically, I need to get Application Deployment Type properties - Installation / Uninstallation programs.

Could you please help me, what exact WMI class can I use to obtain this information.

Thank you for any help.

deployment type props

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

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

发布评论

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

评论(1

情绪操控生活 2025-01-20 05:19:21

不幸的是,这并不是很容易获取信息,但在 powershell(或任何可以真正访问 wmi 的编程语言)的帮助下,这是可以完成的。

信息本身存储在属性 SDMPackageXMLSMS_Application 类中。

现在,如果您查询此内容,您会注意到的第一件事是它可能是空的。那是因为它是一个惰性属性。要在 PS 中解决此问题,您必须在 wmi 对象上调用额外的 get()

如果您这样做(或者有一些工具可以显示所有惰性参数),您会注意到它(如名称所示)基本上是一个 XML 文档,它在内部存储了您需要的信息。因此您必须从 XML 中提取它。

关于如何为单个应用程序执行此操作的一些示例代码如下:

$app = Get-WmiObject -Class SMS_Application -Namespace "root\SMS\site_sitecode" -computer "your site server" -Filter "LocalizedDisplayName='your app name'"
$app.Get()
$installCMD = (([xml](($app).SDMPackageXML)).AppMgmtDigest.DeploymentType.Installer.InstallAction.Args.Arg | where {$_.Name -ieq "InstallCommandLine"}).'#text'
$uninstallCMD = (([xml](($app).SDMPackageXML)).AppMgmtDigest.DeploymentType.Installer.InstallAction.Args.Arg | where {$_.Name -ieq "UninstallCommandLine"}).'#text'

我不太擅长 xml 解析,因此可能有更好的方法来做到这一点,或者也许您不需要解析,但可以只对 xml 摘要进行字符串比较。只需首先查看 SDMPackageXML,然后您可能就会了解如何根据自己的需求最好地分析它。

This is unfortunately not very easy to get information afaik, but with some help from powershell (or any programming language that can access wmi really) it can be done.

The information itself is stored within the Class SMS_Application in the Property SDMPackageXML.

Now the first thing you will notice if you query this is it is probably empty. That is because it is a lazy property. To work around this in PS you have to for example call an extra get() on your wmi object.

If you do this (or have some tool that just shows all lazy parameters anyway) you will notice it is - as suggested by the name - basically an XML document, that stores the information you need deep inside. So you have to extract it from within the XML.

Some example code on how to do this for a single app would be:

$app = Get-WmiObject -Class SMS_Application -Namespace "root\SMS\site_sitecode" -computer "your site server" -Filter "LocalizedDisplayName='your app name'"
$app.Get()
$installCMD = (([xml](($app).SDMPackageXML)).AppMgmtDigest.DeploymentType.Installer.InstallAction.Args.Arg | where {$_.Name -ieq "InstallCommandLine"}).'#text'
$uninstallCMD = (([xml](($app).SDMPackageXML)).AppMgmtDigest.DeploymentType.Installer.InstallAction.Args.Arg | where {$_.Name -ieq "UninstallCommandLine"}).'#text'

I'm not great with xml parsing so there might be a better way to do it or maybe you don't need the parsing but can just string compare the xml digest. Just start by looking at a SDMPackageXML and then you will probably see how to best analyze it for your own needs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文