简体   繁体   English

SCCM PowerShell获取配置基准计算机

[英]SCCM PowerShell Get Configuration Baseline computers

I am working with Configuration Baselines. 我正在使用配置基准。 I would like to start from "Get-CMBaseline -Name MyBaselineName" and work my way to the name of the machines. 我想从“ Get-CMBaseline -Name MyBaselineName”开始,然后按我的方式处理计算机的名称。 I am try to figure out how to get the machines names that are "Compliant", "Error", and "Non-Compliant". 我试图弄清楚如何获取“兼容”,“错误”和“不兼容”的计算机名称。 I see the names of the machines in "Deployment Status" but I need them via PowerShell. 我在“部署状态”中看到了计算机的名称,但是我需要通过PowerShell来使用它们。

There are many things that are possible via the built in cmdlets but some just are not (yet?). 通过内置的cmdlet可以实现许多功能,但是有些还不行(还好吗?)。 However it is almost always possible to get the same behavior the console has with wmi (because the console uses wmi itself) 但是,几乎总是可以通过WMI获得与控制台相同的行为(因为控制台使用WMI本身)

To find out how it is good to know that there is a log file "SMSProv.log" that tells you what the console does for every dialog you open. 要了解知道有一个日志文件“ SMSProv.log”是多么好,该文件告诉您控制台为您打开的每个对话框执行的操作。 It is located on the site server wherever you installed the ConfigMgr in a sub-folder Logs (so default would be %Program Files%\\Microsoft Configuration Manager\\Logs). 它位于站点服务器上您在子文件夹“日志”中安装ConfigMgr的位置(因此默认值为%Program Files%\\ Microsoft Configuration Manager \\ Logs)。

So if you use that when checking the deployment status of a baseline you will notice that it basically translates to 3 commands (All in the namespace 因此,如果在检查基线的部署状态时使用它,您会注意到它基本上转换为3个命令(全部在命名空间中

Root\SMS\site_<SiteCode>

on your siteserver): 在您的站点服务器上):

SELECT * FROM SMS_DCMDeploymentCompliantAssetDetails WHERE AssignmentID=<AssignmentID>

SELECT * FROM SMS_DCMDeploymentNonCompliantAssetDetails WHERE AssignmentID=<AssignmentID>

SELECT * FROM SMS_DCMDeploymentErrorAssetDetails WHERE AssignmentID=<AssignmentID>

where AssignemtID is the ID you would get eg from 其中AssignemtID是您将从中获取的ID,例如

(Get-CMBaselineDeployment -Name "<Your Baslines Name>").AssignmentID

A little exception would be that the console filters the error further by error type but to me it seems like this is maybe not even what you want and you could easily do it in Powershell later if you need to. 一个小小的例外是控制台会根据错误类型进一步过滤错误,但对我来说,这似乎根本不是您想要的,并且以后可以根据需要在Powershell中轻松地进行操作。

The SQL command is also available in most cases in the SMSProv.log, and in some cases it leads to a faster execution. 在大多数情况下,SQLPro命令在SMSProv.log中也可用,并且在某些情况下,它可以加快执行速度。 However in this one probably not really and it is a lot more complex most of the time. 但是,在这种情况下可能并非如此,并且在大多数情况下它要复杂得多。

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

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