<p lang=“en-AU” style=“margin: 0in; font-family: Calibri; font-size: 11.0pt;”>Hi everyone.</p>
<p lang=“en-AU” style=“margin: 0in; font-family: Calibri; font-size: 11.0pt;”></p>
<p lang=“en-AU” style=“margin: 0in; font-family: Calibri; font-size: 11.0pt;”>We need some help / advice from some experts, so I thought where better than the PowerShell.org forums!</p>
<p lang=“en-AU” style=“margin: 0in; font-family: Calibri; font-size: 11.0pt;”></p>
<p lang=“en-AU” style=“margin: 0in; font-family: Calibri; font-size: 11.0pt;”>A friend of mine has started a community based project that is written in Powershell that I am a core contributor for. The high level summary of the project is to automate the creation of As Built Reports for the various technologies we deal with on a day to day basis as consultants, primarily in the infrastructure space.</p>
<p lang=“en-AU” style=“margin: 0in; font-family: Calibri; font-size: 11.0pt;”></p>
<p lang=“en-AU” style=“margin: 0in; font-family: Calibri; font-size: 11.0pt;”>We both are not strong in powershell, and are learning a lot as we go. This is actually one of the drivers for us both pursuing the project.</p>
<p lang=“en-AU” style=“margin: 0in; font-family: Calibri; font-size: 11.0pt;”></p>
<p lang=“en-AU” style=“margin: 0in; font-family: Calibri; font-size: 11.0pt;”>The project was originally written simply as a powershell script, but we have been working to break it out in to several PowerShell modules. We want to re-release the project shortly, and we have a few key goals that we’d like the project to stand by. One of those is to get it published on the PowerShell Gallery which of course requires the project to be written as a module (or several modules … I’ll explain shortly). Some other goals are that it needs to be easy for people to use and we want it to be easy for people to contribute to.</p>
<p lang=“en-AU” style=“margin: 0in; font-family: Calibri; font-size: 11.0pt;”></p>
<p lang=“en-AU” style=“margin: 0in; font-family: Calibri; font-size: 11.0pt;”>The project is probably easiest explained as being:</p>
<p lang=“en-AU” style=“margin: 0in; font-family: Calibri; font-size: 11.0pt;”></p>
- A core "wrapper" module / set of cmdlets that are re-used no matter what technology the report is being generated for. This also handles the structure of the saved artefact output by the cmdlet
- Separate modules per report type / technology, and it is here where the core code is written to extract information from a particular device / product / technology. The data is then fed back in to the core wrapper script (above) where it is saved as word / text / html / xml
- Keep the JSON file in the root of each report, but have a function that copies the JSON configuration to a folder the user running the cmdlet specifies. Therefore the JSON file inside of the module is simply acting as a template, if you like. The user would then edit the copy of the original JSON file, which would be stored in whatever folder they specified
- Write a powershell function in each report module that will create the JSON file in a folder the user running the cmdlet specifies.