PowerShell 调用 SCCM 对象变量
PowerShell call SCCM object variable
如何在 PowerShell 中调用 SCCM 对象变量?
假设我在 SCCM 对象上有一个名为 "ABC_RegionCode" 的集合变量,它在集合中的每台机器上都有不同的值。
我如何在 Powershell 中调用它?
$RegionCode = "ABC_RegionCode"
只会给我上述字符串。
通常我建议直接从数据库中获取它,但它是加密存储在 v_CollectionVariable 中的。如果你在 2012 年,你可以尝试使用 Get-CMDeviceCollectionVariable (https://technet.microsoft.com/en-us/library/jj821935%28v=sc.20%29.aspx).
所以你会这样调用:
$RegionCode = (Get-CMDeviceCollectionVariable -CollectionID "SMS00001" -VariableName "ABC_RegionCode").Value
如何在 PowerShell 中调用 SCCM 对象变量?
假设我在 SCCM 对象上有一个名为 "ABC_RegionCode" 的集合变量,它在集合中的每台机器上都有不同的值。
我如何在 Powershell 中调用它?
$RegionCode = "ABC_RegionCode"
只会给我上述字符串。
通常我建议直接从数据库中获取它,但它是加密存储在 v_CollectionVariable 中的。如果你在 2012 年,你可以尝试使用 Get-CMDeviceCollectionVariable (https://technet.microsoft.com/en-us/library/jj821935%28v=sc.20%29.aspx).
所以你会这样调用:
$RegionCode = (Get-CMDeviceCollectionVariable -CollectionID "SMS00001" -VariableName "ABC_RegionCode").Value