Skip to content

Instantly share code, notes, and snippets.

@software-mariodiana
Last active December 28, 2015 06:19
Show Gist options
  • Save software-mariodiana/7456325 to your computer and use it in GitHub Desktop.
Save software-mariodiana/7456325 to your computer and use it in GitHub Desktop.
Turn off POS logging in RetailStore.
Imports System.Xml
Sub TurnOffPOSLoggingInFile(posConfigFilePath As String)
Dim doc As New XmlDocument()
doc.Load(posConfigFilePath)
' We want the "Add" nodes, which are the only child nodes at the end of this path
Dim posConfigurationNodes As XmlNodeList = doc.Item("configuration").Item("system.diagnostics").Item("switches").ChildNodes
' Explicitly restricting this to these 3 makes it even safer
Dim targets As New ArrayList()
targets.Add("TraceEnableSwitch")
targets.Add("TrickleTraceEnableSwitch")
targets.Add("TraceLevelSwitch")
Dim settingName As String
For Each posAddNode As XmlNode In posConfigurationNodes
settingName = posAddNode.Attributes("name").Value
If targets.Contains(settingName) Then
posAddNode.Attributes("value").Value = "0"
End If
Next
doc.Save(posConfigFilePath)
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment