Answered by:
Update WLAN / Wireless Profile with Powershell Script

Question
-
I Create a WLAN Profile with GUI and import WLAN xml. This WLAN xml contains a WLAN Key in Section <keyMaterial>********</keyMaterial>. This works perfect.
Now i will automating the WLAN Profile key update every week. The Update of the xml is not the Problem, but the import will not work. I have test with Set-CMWirelessProfileConfigurationItem or Set-CMWirelessProfile .
What can i do to update the WLAN profile with a script.
Answers
-
Hi,
Is it possible to create the DigestXML by clicking View Xml Definition of the Wi-FI profile? Then update the digestXML accordingly (Update KeyMaterial property and Version information) and then use Set-CMWirelessProfileConfigurationItem to update the Configuration Policy.
For example:
$obj = Get-CMWirelessProfileConfigurationItem -id '16785204' Set-CMWirelessProfileConfigurationItem -InputObject $obj -DigestPath 'e:\package\UpdatedSCDigestXML.xml'
After the changes from server side, this should reflect to clients after some time as it's deployed as a 'Policy'.
Please remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.- Edited by Frank DongModerator Wednesday, February 14, 2018 9:48 AM
- Marked as answer by henrik.b Thursday, February 15, 2018 12:10 PM
-
i have play a little with powershell an xml and i found a workarround .
#read WLAN Password from a file [string]$wlanpwd=Get-Content$PSScriptRoot\wlanpwd.txt # Read the current WLAN Rule $obj =Get-CMWirelessProfileConfigurationItem -Name 12345 #edit the current rule pwd [xml]$key=$obj.SDMPackageXML [xml]$passphrease=$key.DesiredConfigurationDigest.ConfigurationPolicy.Rules.Rule[1].Expression.Operands.ConstantValue.Value $passphrease.WLANProfile.MSM.security.sharedKey.keyMaterial =$wlanpwd $key.DesiredConfigurationDigest.ConfigurationPolicy.Rules.Rule[1].Expression.Operands.ConstantValue.Value =$passphrease.OuterXml #save the new Rule Set-CMWirelessProfileConfigurationItem -Name 12345 -DigestXml $key.OuterXml
All replies
-
Hi,
Is it possible to create the DigestXML by clicking View Xml Definition of the Wi-FI profile? Then update the digestXML accordingly (Update KeyMaterial property and Version information) and then use Set-CMWirelessProfileConfigurationItem to update the Configuration Policy.
For example:
$obj = Get-CMWirelessProfileConfigurationItem -id '16785204' Set-CMWirelessProfileConfigurationItem -InputObject $obj -DigestPath 'e:\package\UpdatedSCDigestXML.xml'
After the changes from server side, this should reflect to clients after some time as it's deployed as a 'Policy'.
Please remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.- Edited by Frank DongModerator Wednesday, February 14, 2018 9:48 AM
- Marked as answer by henrik.b Thursday, February 15, 2018 12:10 PM
-
i have play a little with powershell an xml and i found a workarround .
#read WLAN Password from a file [string]$wlanpwd=Get-Content$PSScriptRoot\wlanpwd.txt # Read the current WLAN Rule $obj =Get-CMWirelessProfileConfigurationItem -Name 12345 #edit the current rule pwd [xml]$key=$obj.SDMPackageXML [xml]$passphrease=$key.DesiredConfigurationDigest.ConfigurationPolicy.Rules.Rule[1].Expression.Operands.ConstantValue.Value $passphrease.WLANProfile.MSM.security.sharedKey.keyMaterial =$wlanpwd $key.DesiredConfigurationDigest.ConfigurationPolicy.Rules.Rule[1].Expression.Operands.ConstantValue.Value =$passphrease.OuterXml #save the new Rule Set-CMWirelessProfileConfigurationItem -Name 12345 -DigestXml $key.OuterXml