简体   繁体   English

PowerShell调用SCCM对象变量

[英]PowerShell call SCCM object variable

How does one call SCCM Object variables in PowerShell? 如何在PowerShell中调用SCCM对象变量?

Lets say I have a collection variable on SCCM Objects called "ABC_RegionCode" and it has a different value on every machine in the collection. 可以说我在SCCM对象上有一个名为“ ABC_RegionCode”的集合变量,并且在集合中的每台计算机上它都有不同的值。

How would i call this in Powershell? 我在Powershell中怎么称呼它?

$RegionCode = "ABC_RegionCode" will just give me the aforementioned string. $RegionCode = "ABC_RegionCode"只会给我上述字符串。

Ordinarily I'd suggest getting this straight from the database, but it's stored encrypted in v_CollectionVariable. 通常,我建议直接从数据库中获取此信息,但将其加密存储在v_CollectionVariable中。 If you're on 2012 you can try using Get-CMDeviceCollectionVariable ( https://technet.microsoft.com/en-us/library/jj821935%28v=sc.20%29.aspx ). 如果您使用的是2012年,则可以尝试使用Get-CMDeviceCollectionVariable( https://technet.microsoft.com/zh-cn/library/jj821935%28v=sc.20%29.aspx )。

So you'd call something like: 因此,您会打电话给类似:

$RegionCode = (Get-CMDeviceCollectionVariable -CollectionID "SMS00001" -VariableName "ABC_RegionCode").Value

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

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