So you’re in the middle of an OCS deployment and you need to change a WMI value. It’s easy to use PowerShell to view and modify OCS 2007 R2 WMI values and I find it to be much easier and faster than using the alternatives, WBEMTest or VBScript.
The PowerShell command that makes this possible is Get-WmiObject.
To view WMI values, use the following syntax:
PS > Get-WmiObject -computer HOSTNAME -query "select * from WMI_CLASS where
backend='SQL_SERVER\\SQL_INSTANCE'"
Enterprise Edition Example:
PS > Get-WmiObject -computer ocsent_hostname -query "select * from
MSFT_SIPGroupExpansionSetting where backend='SQL01\\OCSInstance'"
Standard Edition Example:
PS > Get-WmiObject -computer ocsstd_hostname -query "select * from
MSFT_SIPGroupExpansionSetting where backend='(local)\\rtc'"
Depending on where the WMI value lives, you may not need the
where backend='SQL_SERVER\\SQL_INSTANCE'
For example, the where clause is not necessary when using WMI to query Mediation server config settings. This is because a Mediation server is not associated with a particular pool. Any value that is associated with a particular Enterprise Pool or Standard Server will need this where clause.
Mediation Server Example:
PS > Get-WmiObject -computer ocsmed1 -query "select * from MSFT_SIPMediationServerConfigSetting"
This should produce output that looks like this:
__GENUS : 2
__CLASS : MSFT_SIPMediationServerConfigSetting
__SUPERCLASS :
__DYNASTY : MSFT_SIPMediationServerConfigSetting
__RELPATH : MSFT_SIPMediationServerConfigSetting.InstanceID="{...
__PROPERTY_COUNT : 17
__DERIVATION : {}
__SERVER : OCSMED1
__NAMESPACE : root\cimv2
__PATH : \\OCSMED1\root\cimv2:MSFT_SIPMediationServer...
DefaultCodec : RTA_NB
GatewayEncryptionLevel : DoNotSupportEncryption
GatewayListeningAddress : 205.134.81.3
GatewayListeningPort : 5060
GatewayNextHopAddress : 205.134.81.2
GatewayNextHopPort : 5060
GatewayTransportType : TCP
InstanceID : {3338C248-FA9C-4151-AAE5-75A556E8C73E}
MediaPortRangeFrom : 60000
MediaPortRangeTo : 64000
ProxyEncryptionLevel : SupportEncryption
ProxyListeningAddress : 192.168.133.79
ProxyListeningPort : 5061
ProxyNextHopFQDN : CORPOCS3.contoso.com
ProxyNextHopPort : 5061
QoSEnabled : False
RemovePlusFromRequestURI : False
So now we can view WMI values in PowerShell, let’s see how to change a WMI value. I’ll show you how to configure the Mediation server to strip the leading (+) plus sign from outbound calls. For this example, the Mediation server is named ‘ocsmed1′.
First, I want to store the Mediation server WMI values in a temporary variable.
PS > $temp = Get-WmiObject -computer ocsmed1 -query "select * from MSFT_SIPMediationServerConfigSetting"
You can verify that the values were stored correctly by typing the variable and hitting Enter. It should return the exact same output as shown above:
PS > $temp
Now set the ‘RemovePlusFromRequestURI’ value to true:
PS > $temp.RemovePlusFromRequestURI = $true
Next, write the changed values back to WMI:
PS > $temp.Put()
On Windows 2008, use the following command to install PowerShell:
Servermanagercmd.exe -install powershell
Other platforms can download PowerShell here.
Office Communications Server and WMI


Comments on this entry are closed.