VBScript & C # Read / Write XML Without Locking a File

Scenario:

  • Network user is a member of the domain
  • Group Policy runs VBScript
  • VBScript reads from XML
  • VBScript performs operations based on information obtained from XML

What VBScript methods should I use so that on a network with multiple users accessing XML at the same time, I will not be prone to file locking issues?

If I made a C # program to read and modify an existing XML file from a network location while working (at the same time XML is being read), what C # methods should I use to read / write XML without blocking problems?

+4
source share
2 answers

For a C # program that accesses an XML file, you can do the following:

  • The backgroundWorker component is used to process read / write requests for an XML file.
  • add all relevant event handlers to find out about current updates, etc.
  • Call RunWorkerAsync to start a read / write operation.

Source: MSDN

0
source

I do not understand why it is so difficult. Just work with 2 files.

  • VBScript is read from A1.xml
  • C # A2.xml program write / update program, and then replace A1.xml

And vbs might look like ...

Set xmlDoc = CreateObject("Msxml2.DOMDocument.6.0") xmlDoc.Async = False bReturn = False Do Until bReturn WScript.Sleep 3500 bReturn = xmlDoc.Load(".../A1.xml") Loop '... 
0
source

All Articles