I am working with a PowerShell script which needs to take data from a file and use them as parameters to the functions written in it. So basically what I am looking for is something like a JSON or XML file but I am not sure about what to use.
What I am looking for is the one which is relatively easier to use, passes datatypes or objects instead of strings.
A part of data would look something like this in XML :
<RegistryEntriesList>
<registryPath>HKLM:\\Software\\Lenovo\\Configuration\\</registryPath> <registryProperty>PATH </registryProperty>
<registryPath>HKLM:\\Software\\Lenovo\\Configuration\\</registryPath> <registryProperty>LOGS </registryProperty>
<registryPath>HKLM:\\Software\\Lenovo\\Connections\\</registryPath> <registryProperty>MinConnectionsPerTarget</registryProperty>
<registryPath>HKLM:\\Software\\Lenovo\\Connections\\</registryPath> <registryProperty>MaxWorkingIscsiConnections</registryProperty>
<registryPath>HKLM:\\Software\\Lenovo\\Connections\\</registryPath> <registryProperty>WaitIntervalInMilliseconds</registryProperty>
Another part would like this in JSON:
"entredInput":[{"title":"Powershell","desc":"first"},
{"title":"json","desc":"third"},
{"title":"Configfile","desc":"second"}]
And many more like this.
Basically I would be using these for automation purpose. I know PowerShell4.0 alone has the cmdlet ConvertFrom-JSON but it dosent work on PS2.0 and I want my script to run on any version of PowerShell, i.e any release of Windows. So I guess XML might be a better option but I am not sure. Is there any other option ??
I have gone through many weblinks about JSON vs XML and they have only confused me a lot. Kindly let me select a better option among JSON, XML and SOMETHINGELSE. Thanks for going through the question.
No comments:
Post a Comment