2012以使用WMI从SCCM客户端远程安装

2012以使用WMI从SCCM客户端远程安装

本文介绍了从C#查询SCCM 2012以使用WMI从SCCM客户端远程安装/不安装应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

大家好

我正在寻求帮助,以便从"SELECT * FROM CCM_Application"中收集信息。 -namespace" ROOT\ccm\ClientSDK"



并将其信息显示在DataGrid中。

问题是数据I我得到的是不完整的,我可以实际获取数据的对象是在DeploymentReport对象中看来。



我需要Name,InstallState,EvaluationState等信息br />


powershell中的相同查询会提取此信息,但我无法正确地从C#获取。





I am asking for help to gather information from the "SELECT * FROM CCM_Application" -namespace "ROOT\ccm\ClientSDK"

and display its information into a DataGrid.
The problem is the data I am getting is not complete and the objects I could actually get the data from is in the DeploymentReport Object it seems.

I need information such as Name,InstallState,EvaluationState

the same query in powershell pulls this information but I am unable to get it from C# correctly.





        public CCMView(string targetComputer)
        {
            InitializeComponent();
            // Display loading animations.
            //gridError.Visibility = Visibility.Collapsed;
          //  gridLoading.Visibility = Visibility.Visible;
            new Thread(() => RefreshProcessesList()) { IsBackground = true }.Start();

        }


        private void RefreshProcessesList()
        {
            try
            {
                ManagementScope scope = new ManagementScope(@"\\" + GlobalVar.TargetComputerName + @"\ROOT\ccm\ClientSDK:CCM_SoftwareBase");
                SelectQuery query = new SelectQuery("Select * From CCM_SoftwareBase");
                 var typeDescriptors = new ObservableCollection<ManagementObjectTypeDescriptor>();

                using (var searcher = new ManagementObjectSearcher(scope, query))
                {
                    using (var managementObjects = searcher.Get())
                    {
                        foreach (ManagementBaseObject managementObject in managementObjects)
                        {
                            using (managementObject)
                            {
                                typeDescriptors.Add(new ManagementObjectTypeDescriptor(managementObject));
                            }
                        }
                    }
                }
                this.Dispatcher.Invoke((Action)(() =>
                {
                CcmAppsGrid.ItemsSource = new ArrayList(typeDescriptors);
                    gridError.Visibility = Visibility.Collapsed;
                    gridLoading.Visibility = Visibility.Collapsed;
                    CcmAppsGrid.Items.SortDescriptions.Clear();
                    CcmAppsGrid.Items.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));

                }));

            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(ex.Message);
            }
        }




推荐答案

感谢您在此发帖。

我们正在安装SCCM2012环境,请耐心等待。

We are installing the SCCM2012 environment , please wait patiently.

我们可以及时处理你的问题。

We could deal with your problem in time.

最好的问候,

杰克


这篇关于从C#查询SCCM 2012以使用WMI从SCCM客户端远程安装/不安装应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 00:15