Additional file for data

Welcome Forums General PowerShell Q&A Additional file for data

This topic contains 1 reply, has 2 voices, and was last updated by

 
Participant
8 months, 2 weeks ago.

  • Author
    Posts
  • #95023

    Participant
    Points: 0
    Rank: Member

    Hi,

    I'm creating a fairly large script, which needs to pull in Name, Dates, Site Location etc from a external file. What would be the best way to store this information in an external file. i know i can use psd1, Json, XMl, but not sure whats best.

    The values for the would have nested values, for example:

    @{
          Name = London
          Offices = "Office 1","Office 2","Office 3"
          Subnet = "1.1.1.1","1.1.2.1"
    
    }
    

    Thanks

    Tommy

  • #95107

    Participant
    Points: -16
    Rank: Member

    Hi Tommy,
    It totally depends on the amount of data you want to store. If its too large looking at something like SQL (MS SQLExpress) would help. Also because you mentioned you have nested data.

    Normally CSV can be a quick and easy way to store data. But there are limitations when it comes to nested and Sub information.

    You can also use XML as its more extensible. but this is still a flat file and can sometimes grow out to be too large
    All CSV, JSON, XML have native Powershell export and import commands. So this would be easy.

    As mentioned if you go down the SQL path, there is a free E book by Don Jones which can help you get an idea to set this up
    https://www.gitbook.com/book/devops-collective-inc/ditch-excel-making-historical-trend-reports-in-po/details

    there is also a powershell module you can download from the gallery if you don't want to go the whole 9 yards 🙂
    https://www.powershellgallery.com/packages/Write-ObjectToSQL/1.13

    Hope this help

    Regards
    Shihan

The topic ‘Additional file for data’ is closed to new replies.