What is the best way to store configuration information for Powershell

Welcome Forums General PowerShell Q&A What is the best way to store configuration information for Powershell

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

3 years, 2 months ago.

  • Author
  • #32733

    Points: 12
    Rank: Member


    I want to store configuration information for powershell script on network share. I just want to launch powershell script without passing information about configuration file and code will pull local computer name and try to match computer name to configuration file in configuration directory via wildcard match.
    My questions
    1. Is it easier to store/retrieve information from XML or JSON or any other suggestions as far as format.
    2. How do I properly implement computername matching against individual files in folder if I want to support wildcard matching bearing in mind I can not name files having wildcards inside them.
    The whole reason for this is that I want to implement robust IIS log compression where each set of servers would have to have different rules as far as how many logs to keep which websites logs needs to be copied and where etc.

  • #32734

    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    Provided the configuration information is represented as an object with properties, both CLIXML and JSON are probably equally easy to use. JSON is perhaps easier to hand-edit, if needed.

    Seems like what you're trying to do is re-create portions of Desired State Configuration, though. If your network share was a DSC Pull Server (and it could be – an SMB Pull Server is nothing more than a file share), it seems like you could do a lot of this with DSC instead of hand-coding something yourself.

The topic ‘What is the best way to store configuration information for Powershell’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort