![WMI 对象可通过命令行获得,但不能通过 Get-WmiObject 获得。](https://linux22.com/image/699148/WMI%20%E5%AF%B9%E8%B1%A1%E5%8F%AF%E9%80%9A%E8%BF%87%E5%91%BD%E4%BB%A4%E8%A1%8C%E8%8E%B7%E5%BE%97%EF%BC%8C%E4%BD%86%E4%B8%8D%E8%83%BD%E9%80%9A%E8%BF%87%20Get-WmiObject%20%E8%8E%B7%E5%BE%97%E3%80%82.png)
为什么我可以使用 获取 WMI 对象Get-CMBoundaryGroup
,但不能直接使用Get-WmiObject
?我Invalid namespace "root\sms\site_CAS"
使用时Get-WmiObject
$boundaryGroup1 = Get-CMBoundaryGroup -Name 'BoundaryGroupName'
$class = $boundaryGroup1.ManagedObject.__CLASS #SMS_BoundaryGroup
$namespace = $boundaryGroup1.ManagedObject.__NAMESPACE #root\sms\site_CAS
$boundaryGroup2 = Get-WmiObject -Class $class -Namespace $namespace #Invalid namespace "root\sms\site_CAS"