How to use a config file (ini, conf,…) with a PowerShell Script?Elevated Powershell scriptPowershell help: have a “disk space” script link…but how do I use it?Powershell script to create folders from CSV list of usersHow can I run an elevated powershell script as part of VMWare Customization Specification?Powershell - Windows forms - script calling another script, 2nd script modifying form elementsUsing Powershell to Create Exchange Contacts from a .CSV filePowershell script scheduled task will not endRunning Exchange Powershell script from a batch file: command doesn't work. What's wrong with my syntax?Read file with parameters as parameter in powershell scriptCopy files to network drive with powershell script and task schedule

How to laser-level close to a surface

Cycling to work - 30mile return

How do we explain the use of a software on a math paper?

Who is frowning in the sentence "Daisy looked at Tom frowning"?

pwaS eht tirsf dna tasl setterl fo hace dorw

Combining two Lorentz boosts

Why does string strummed with finger sound different from the one strummed with pick?

Windows reverting changes made by Linux to FAT32 partion

Does the US Supreme Court vote using secret ballots?

How can I monitor the bulk API limit?

Why would company (decision makers) wait for someone to retire, rather than lay them off, when their role is no longer needed?

Former Employer just sent me an IP Agreement

Bookshelves: the intruder

Why does a table with a defined constant in its index compute 10X slower?

How many Dothraki are left as of Game of Thrones S8E5?

Why using a variable as index of a list-item does not retrieve that item with clist_item:Nn?

How was the blinking terminal cursor invented?

Should I twist DC power and ground wires from a power supply?

FIFO data structure in pure C

How do I balance a campaign consisting of four kobold PCs?

Why does the U.S military use mercenaries?

How to get all possible paths in 0/1 matrix better way?

on the truth quest vs in the quest for truth

Divisor Rich and Poor Numbers



How to use a config file (ini, conf,…) with a PowerShell Script?


Elevated Powershell scriptPowershell help: have a “disk space” script link…but how do I use it?Powershell script to create folders from CSV list of usersHow can I run an elevated powershell script as part of VMWare Customization Specification?Powershell - Windows forms - script calling another script, 2nd script modifying form elementsUsing Powershell to Create Exchange Contacts from a .CSV filePowershell script scheduled task will not endRunning Exchange Powershell script from a batch file: command doesn't work. What's wrong with my syntax?Read file with parameters as parameter in powershell scriptCopy files to network drive with powershell script and task schedule






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








14















Is it possible to use a configuration file with a PowerShell script?



For example, the configuration file:



#links
link1=http://www.google.com
link2=http://www.apple.com
link3=http://www.microsoft.com


And then call this information in the PS1 script:



start-process iexplore.exe $Link1









share|improve this question






























    14















    Is it possible to use a configuration file with a PowerShell script?



    For example, the configuration file:



    #links
    link1=http://www.google.com
    link2=http://www.apple.com
    link3=http://www.microsoft.com


    And then call this information in the PS1 script:



    start-process iexplore.exe $Link1









    share|improve this question


























      14












      14








      14


      7






      Is it possible to use a configuration file with a PowerShell script?



      For example, the configuration file:



      #links
      link1=http://www.google.com
      link2=http://www.apple.com
      link3=http://www.microsoft.com


      And then call this information in the PS1 script:



      start-process iexplore.exe $Link1









      share|improve this question
















      Is it possible to use a configuration file with a PowerShell script?



      For example, the configuration file:



      #links
      link1=http://www.google.com
      link2=http://www.apple.com
      link3=http://www.microsoft.com


      And then call this information in the PS1 script:



      start-process iexplore.exe $Link1






      powershell scripting






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 5 '18 at 20:28









      Twisty Impersonator

      2,52861943




      2,52861943










      asked Sep 30 '10 at 0:04









      Xavier CXavier C

      3882411




      3882411




















          4 Answers
          4






          active

          oldest

          votes


















          17














          Thanks a lot for your help Dennis and Tim! Your answers put me on the good track and I found this



          SETTINGS.TXT



          #from http://tlingenf.spaces.live.com/blog/cns!B1B09F516B5BAEBF!213.entry
          #
          [General]
          MySetting1=value

          [Locations]
          InputFile="C:Users.txt"
          OutputFile="C:output.log"

          [Other]
          WaitForTime=20
          VerboseLogging=True


          POWERSHELL COMMAND



          #from http://tlingenf.spaces.live.com/blog/cns!B1B09F516B5BAEBF!213.entry
          #
          Get-Content "C:settings.txt" | foreach-object -begin $h=@ -process $k = [regex]::split($_,'='); if(($k[0].CompareTo("") -ne 0) -and ($k[0].StartsWith("[") -ne $True)) $h.Add($k[0], $k[1])


          then



          After executing the code snippet, a variable ($h) will contain the values in a HashTable.



          Name Value
          ---- -----
          MySetting1 value
          VerboseLogging True
          WaitForTime 20
          OutputFile "C:output.log"
          InputFile "C:Users.txt"


          *To retrieve an item from the table, use the command $h.Get_Item("MySetting1").*






          share|improve this answer




















          • 3





            You can also get the settings out by the much friendlier $h.MySetting1

            – Ryan Shillington
            Nov 13 '15 at 19:54











          • I get an array out of bounds exception in the regex parser line, despite using the exact same .txt file shown in this answer and the parser code (no changes) => Index was outside the bounds of the array. At C:testConfigreader.ps1:13 char:264 + ... -ne $True)) $h.Add($k[0], $k[1]) } + ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (:) [], IndexOutOfRangeException + FullyQualifiedErrorId : System.IndexOutOfRangeException Does anyone have this working correctly?

            – Shiva
            Mar 9 '17 at 0:24



















          3














          There's a good thread here which shows this code (quoting from the linked thread):



          # from http://www.eggheadcafe.com/software/aspnet/30358576/powershell-and-ini-files.aspx
          param ($file)

          $ini = @
          switch -regex -file $file

          "^[(.+)]$"
          $section = $matches[1]
          $ini[$section] = @

          "(.+)=(.+)"
          $name,$value = $matches[1..2]
          $ini[$section][$name] = $value


          $ini


          Then you can do:



          PS> $links = import-ini links.ini
          PS> $links["search-engines"]["link1"]
          http://www.google.com
          PS> $links["vendors"]["link1"]
          http://www.apple.com


          Assuming an INI file that looks like this:



          [vendors]
          link1=http://www.apple.com
          [search-engines]
          link1=http://www.google.com


          Unfortunately the regexes are missing from the code at the link so you'll have to reproduce them, but there's a version that handles files without section headers and lines that are comments.






          share|improve this answer























          • You can handle comments easily by just adding another case to the switch with '^#' . Also you can access hashtable contents with a dot as well, so $links.vendors.link1 should work too which might be a little better to read.

            – Joey
            Oct 20 '10 at 7:20



















          2














          yes, the cmdlets you're looking for are get-content and select-string.



          $content=get-content C:links.txt
          start-process iexplore.exe $content[0]





          share|improve this answer






























            0














            For a more comprehensive approach, consider https://github.com/alekdavis/ConfigFile . This module supports config files in JSON format, as well as INI. It allows expanding variables and does a few neat tricks. The thing to remember is that the names of the key-value pairs in the INI file must match the names of the script parameters or variables.






            share|improve this answer























              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "2"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f186030%2fhow-to-use-a-config-file-ini-conf-with-a-powershell-script%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              4 Answers
              4






              active

              oldest

              votes








              4 Answers
              4






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              17














              Thanks a lot for your help Dennis and Tim! Your answers put me on the good track and I found this



              SETTINGS.TXT



              #from http://tlingenf.spaces.live.com/blog/cns!B1B09F516B5BAEBF!213.entry
              #
              [General]
              MySetting1=value

              [Locations]
              InputFile="C:Users.txt"
              OutputFile="C:output.log"

              [Other]
              WaitForTime=20
              VerboseLogging=True


              POWERSHELL COMMAND



              #from http://tlingenf.spaces.live.com/blog/cns!B1B09F516B5BAEBF!213.entry
              #
              Get-Content "C:settings.txt" | foreach-object -begin $h=@ -process $k = [regex]::split($_,'='); if(($k[0].CompareTo("") -ne 0) -and ($k[0].StartsWith("[") -ne $True)) $h.Add($k[0], $k[1])


              then



              After executing the code snippet, a variable ($h) will contain the values in a HashTable.



              Name Value
              ---- -----
              MySetting1 value
              VerboseLogging True
              WaitForTime 20
              OutputFile "C:output.log"
              InputFile "C:Users.txt"


              *To retrieve an item from the table, use the command $h.Get_Item("MySetting1").*






              share|improve this answer




















              • 3





                You can also get the settings out by the much friendlier $h.MySetting1

                – Ryan Shillington
                Nov 13 '15 at 19:54











              • I get an array out of bounds exception in the regex parser line, despite using the exact same .txt file shown in this answer and the parser code (no changes) => Index was outside the bounds of the array. At C:testConfigreader.ps1:13 char:264 + ... -ne $True)) $h.Add($k[0], $k[1]) } + ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (:) [], IndexOutOfRangeException + FullyQualifiedErrorId : System.IndexOutOfRangeException Does anyone have this working correctly?

                – Shiva
                Mar 9 '17 at 0:24
















              17














              Thanks a lot for your help Dennis and Tim! Your answers put me on the good track and I found this



              SETTINGS.TXT



              #from http://tlingenf.spaces.live.com/blog/cns!B1B09F516B5BAEBF!213.entry
              #
              [General]
              MySetting1=value

              [Locations]
              InputFile="C:Users.txt"
              OutputFile="C:output.log"

              [Other]
              WaitForTime=20
              VerboseLogging=True


              POWERSHELL COMMAND



              #from http://tlingenf.spaces.live.com/blog/cns!B1B09F516B5BAEBF!213.entry
              #
              Get-Content "C:settings.txt" | foreach-object -begin $h=@ -process $k = [regex]::split($_,'='); if(($k[0].CompareTo("") -ne 0) -and ($k[0].StartsWith("[") -ne $True)) $h.Add($k[0], $k[1])


              then



              After executing the code snippet, a variable ($h) will contain the values in a HashTable.



              Name Value
              ---- -----
              MySetting1 value
              VerboseLogging True
              WaitForTime 20
              OutputFile "C:output.log"
              InputFile "C:Users.txt"


              *To retrieve an item from the table, use the command $h.Get_Item("MySetting1").*






              share|improve this answer




















              • 3





                You can also get the settings out by the much friendlier $h.MySetting1

                – Ryan Shillington
                Nov 13 '15 at 19:54











              • I get an array out of bounds exception in the regex parser line, despite using the exact same .txt file shown in this answer and the parser code (no changes) => Index was outside the bounds of the array. At C:testConfigreader.ps1:13 char:264 + ... -ne $True)) $h.Add($k[0], $k[1]) } + ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (:) [], IndexOutOfRangeException + FullyQualifiedErrorId : System.IndexOutOfRangeException Does anyone have this working correctly?

                – Shiva
                Mar 9 '17 at 0:24














              17












              17








              17







              Thanks a lot for your help Dennis and Tim! Your answers put me on the good track and I found this



              SETTINGS.TXT



              #from http://tlingenf.spaces.live.com/blog/cns!B1B09F516B5BAEBF!213.entry
              #
              [General]
              MySetting1=value

              [Locations]
              InputFile="C:Users.txt"
              OutputFile="C:output.log"

              [Other]
              WaitForTime=20
              VerboseLogging=True


              POWERSHELL COMMAND



              #from http://tlingenf.spaces.live.com/blog/cns!B1B09F516B5BAEBF!213.entry
              #
              Get-Content "C:settings.txt" | foreach-object -begin $h=@ -process $k = [regex]::split($_,'='); if(($k[0].CompareTo("") -ne 0) -and ($k[0].StartsWith("[") -ne $True)) $h.Add($k[0], $k[1])


              then



              After executing the code snippet, a variable ($h) will contain the values in a HashTable.



              Name Value
              ---- -----
              MySetting1 value
              VerboseLogging True
              WaitForTime 20
              OutputFile "C:output.log"
              InputFile "C:Users.txt"


              *To retrieve an item from the table, use the command $h.Get_Item("MySetting1").*






              share|improve this answer















              Thanks a lot for your help Dennis and Tim! Your answers put me on the good track and I found this



              SETTINGS.TXT



              #from http://tlingenf.spaces.live.com/blog/cns!B1B09F516B5BAEBF!213.entry
              #
              [General]
              MySetting1=value

              [Locations]
              InputFile="C:Users.txt"
              OutputFile="C:output.log"

              [Other]
              WaitForTime=20
              VerboseLogging=True


              POWERSHELL COMMAND



              #from http://tlingenf.spaces.live.com/blog/cns!B1B09F516B5BAEBF!213.entry
              #
              Get-Content "C:settings.txt" | foreach-object -begin $h=@ -process $k = [regex]::split($_,'='); if(($k[0].CompareTo("") -ne 0) -and ($k[0].StartsWith("[") -ne $True)) $h.Add($k[0], $k[1])


              then



              After executing the code snippet, a variable ($h) will contain the values in a HashTable.



              Name Value
              ---- -----
              MySetting1 value
              VerboseLogging True
              WaitForTime 20
              OutputFile "C:output.log"
              InputFile "C:Users.txt"


              *To retrieve an item from the table, use the command $h.Get_Item("MySetting1").*







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Mar 9 '17 at 0:46









              Shiva

              1034




              1034










              answered Sep 30 '10 at 18:51









              Xavier CXavier C

              3882411




              3882411







              • 3





                You can also get the settings out by the much friendlier $h.MySetting1

                – Ryan Shillington
                Nov 13 '15 at 19:54











              • I get an array out of bounds exception in the regex parser line, despite using the exact same .txt file shown in this answer and the parser code (no changes) => Index was outside the bounds of the array. At C:testConfigreader.ps1:13 char:264 + ... -ne $True)) $h.Add($k[0], $k[1]) } + ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (:) [], IndexOutOfRangeException + FullyQualifiedErrorId : System.IndexOutOfRangeException Does anyone have this working correctly?

                – Shiva
                Mar 9 '17 at 0:24













              • 3





                You can also get the settings out by the much friendlier $h.MySetting1

                – Ryan Shillington
                Nov 13 '15 at 19:54











              • I get an array out of bounds exception in the regex parser line, despite using the exact same .txt file shown in this answer and the parser code (no changes) => Index was outside the bounds of the array. At C:testConfigreader.ps1:13 char:264 + ... -ne $True)) $h.Add($k[0], $k[1]) } + ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (:) [], IndexOutOfRangeException + FullyQualifiedErrorId : System.IndexOutOfRangeException Does anyone have this working correctly?

                – Shiva
                Mar 9 '17 at 0:24








              3




              3





              You can also get the settings out by the much friendlier $h.MySetting1

              – Ryan Shillington
              Nov 13 '15 at 19:54





              You can also get the settings out by the much friendlier $h.MySetting1

              – Ryan Shillington
              Nov 13 '15 at 19:54













              I get an array out of bounds exception in the regex parser line, despite using the exact same .txt file shown in this answer and the parser code (no changes) => Index was outside the bounds of the array. At C:testConfigreader.ps1:13 char:264 + ... -ne $True)) $h.Add($k[0], $k[1]) } + ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (:) [], IndexOutOfRangeException + FullyQualifiedErrorId : System.IndexOutOfRangeException Does anyone have this working correctly?

              – Shiva
              Mar 9 '17 at 0:24






              I get an array out of bounds exception in the regex parser line, despite using the exact same .txt file shown in this answer and the parser code (no changes) => Index was outside the bounds of the array. At C:testConfigreader.ps1:13 char:264 + ... -ne $True)) $h.Add($k[0], $k[1]) } + ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (:) [], IndexOutOfRangeException + FullyQualifiedErrorId : System.IndexOutOfRangeException Does anyone have this working correctly?

              – Shiva
              Mar 9 '17 at 0:24














              3














              There's a good thread here which shows this code (quoting from the linked thread):



              # from http://www.eggheadcafe.com/software/aspnet/30358576/powershell-and-ini-files.aspx
              param ($file)

              $ini = @
              switch -regex -file $file

              "^[(.+)]$"
              $section = $matches[1]
              $ini[$section] = @

              "(.+)=(.+)"
              $name,$value = $matches[1..2]
              $ini[$section][$name] = $value


              $ini


              Then you can do:



              PS> $links = import-ini links.ini
              PS> $links["search-engines"]["link1"]
              http://www.google.com
              PS> $links["vendors"]["link1"]
              http://www.apple.com


              Assuming an INI file that looks like this:



              [vendors]
              link1=http://www.apple.com
              [search-engines]
              link1=http://www.google.com


              Unfortunately the regexes are missing from the code at the link so you'll have to reproduce them, but there's a version that handles files without section headers and lines that are comments.






              share|improve this answer























              • You can handle comments easily by just adding another case to the switch with '^#' . Also you can access hashtable contents with a dot as well, so $links.vendors.link1 should work too which might be a little better to read.

                – Joey
                Oct 20 '10 at 7:20
















              3














              There's a good thread here which shows this code (quoting from the linked thread):



              # from http://www.eggheadcafe.com/software/aspnet/30358576/powershell-and-ini-files.aspx
              param ($file)

              $ini = @
              switch -regex -file $file

              "^[(.+)]$"
              $section = $matches[1]
              $ini[$section] = @

              "(.+)=(.+)"
              $name,$value = $matches[1..2]
              $ini[$section][$name] = $value


              $ini


              Then you can do:



              PS> $links = import-ini links.ini
              PS> $links["search-engines"]["link1"]
              http://www.google.com
              PS> $links["vendors"]["link1"]
              http://www.apple.com


              Assuming an INI file that looks like this:



              [vendors]
              link1=http://www.apple.com
              [search-engines]
              link1=http://www.google.com


              Unfortunately the regexes are missing from the code at the link so you'll have to reproduce them, but there's a version that handles files without section headers and lines that are comments.






              share|improve this answer























              • You can handle comments easily by just adding another case to the switch with '^#' . Also you can access hashtable contents with a dot as well, so $links.vendors.link1 should work too which might be a little better to read.

                – Joey
                Oct 20 '10 at 7:20














              3












              3








              3







              There's a good thread here which shows this code (quoting from the linked thread):



              # from http://www.eggheadcafe.com/software/aspnet/30358576/powershell-and-ini-files.aspx
              param ($file)

              $ini = @
              switch -regex -file $file

              "^[(.+)]$"
              $section = $matches[1]
              $ini[$section] = @

              "(.+)=(.+)"
              $name,$value = $matches[1..2]
              $ini[$section][$name] = $value


              $ini


              Then you can do:



              PS> $links = import-ini links.ini
              PS> $links["search-engines"]["link1"]
              http://www.google.com
              PS> $links["vendors"]["link1"]
              http://www.apple.com


              Assuming an INI file that looks like this:



              [vendors]
              link1=http://www.apple.com
              [search-engines]
              link1=http://www.google.com


              Unfortunately the regexes are missing from the code at the link so you'll have to reproduce them, but there's a version that handles files without section headers and lines that are comments.






              share|improve this answer













              There's a good thread here which shows this code (quoting from the linked thread):



              # from http://www.eggheadcafe.com/software/aspnet/30358576/powershell-and-ini-files.aspx
              param ($file)

              $ini = @
              switch -regex -file $file

              "^[(.+)]$"
              $section = $matches[1]
              $ini[$section] = @

              "(.+)=(.+)"
              $name,$value = $matches[1..2]
              $ini[$section][$name] = $value


              $ini


              Then you can do:



              PS> $links = import-ini links.ini
              PS> $links["search-engines"]["link1"]
              http://www.google.com
              PS> $links["vendors"]["link1"]
              http://www.apple.com


              Assuming an INI file that looks like this:



              [vendors]
              link1=http://www.apple.com
              [search-engines]
              link1=http://www.google.com


              Unfortunately the regexes are missing from the code at the link so you'll have to reproduce them, but there's a version that handles files without section headers and lines that are comments.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Sep 30 '10 at 1:29









              Dennis WilliamsonDennis Williamson

              51.2k1193128




              51.2k1193128












              • You can handle comments easily by just adding another case to the switch with '^#' . Also you can access hashtable contents with a dot as well, so $links.vendors.link1 should work too which might be a little better to read.

                – Joey
                Oct 20 '10 at 7:20


















              • You can handle comments easily by just adding another case to the switch with '^#' . Also you can access hashtable contents with a dot as well, so $links.vendors.link1 should work too which might be a little better to read.

                – Joey
                Oct 20 '10 at 7:20

















              You can handle comments easily by just adding another case to the switch with '^#' . Also you can access hashtable contents with a dot as well, so $links.vendors.link1 should work too which might be a little better to read.

              – Joey
              Oct 20 '10 at 7:20






              You can handle comments easily by just adding another case to the switch with '^#' . Also you can access hashtable contents with a dot as well, so $links.vendors.link1 should work too which might be a little better to read.

              – Joey
              Oct 20 '10 at 7:20












              2














              yes, the cmdlets you're looking for are get-content and select-string.



              $content=get-content C:links.txt
              start-process iexplore.exe $content[0]





              share|improve this answer



























                2














                yes, the cmdlets you're looking for are get-content and select-string.



                $content=get-content C:links.txt
                start-process iexplore.exe $content[0]





                share|improve this answer

























                  2












                  2








                  2







                  yes, the cmdlets you're looking for are get-content and select-string.



                  $content=get-content C:links.txt
                  start-process iexplore.exe $content[0]





                  share|improve this answer













                  yes, the cmdlets you're looking for are get-content and select-string.



                  $content=get-content C:links.txt
                  start-process iexplore.exe $content[0]






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Sep 30 '10 at 0:11









                  TimTim

                  21613




                  21613





















                      0














                      For a more comprehensive approach, consider https://github.com/alekdavis/ConfigFile . This module supports config files in JSON format, as well as INI. It allows expanding variables and does a few neat tricks. The thing to remember is that the names of the key-value pairs in the INI file must match the names of the script parameters or variables.






                      share|improve this answer



























                        0














                        For a more comprehensive approach, consider https://github.com/alekdavis/ConfigFile . This module supports config files in JSON format, as well as INI. It allows expanding variables and does a few neat tricks. The thing to remember is that the names of the key-value pairs in the INI file must match the names of the script parameters or variables.






                        share|improve this answer

























                          0












                          0








                          0







                          For a more comprehensive approach, consider https://github.com/alekdavis/ConfigFile . This module supports config files in JSON format, as well as INI. It allows expanding variables and does a few neat tricks. The thing to remember is that the names of the key-value pairs in the INI file must match the names of the script parameters or variables.






                          share|improve this answer













                          For a more comprehensive approach, consider https://github.com/alekdavis/ConfigFile . This module supports config files in JSON format, as well as INI. It allows expanding variables and does a few neat tricks. The thing to remember is that the names of the key-value pairs in the INI file must match the names of the script parameters or variables.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered May 6 at 6:23









                          Alek DavisAlek Davis

                          123115




                          123115



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Server Fault!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f186030%2fhow-to-use-a-config-file-ini-conf-with-a-powershell-script%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Wikipedia:Vital articles Мазмуну Biography - Өмүр баян Philosophy and psychology - Философия жана психология Religion - Дин Social sciences - Коомдук илимдер Language and literature - Тил жана адабият Science - Илим Technology - Технология Arts and recreation - Искусство жана эс алуу History and geography - Тарых жана география Навигация менюсу

                              Bruxelas-Capital Índice Historia | Composición | Situación lingüística | Clima | Cidades irmandadas | Notas | Véxase tamén | Menú de navegacióneO uso das linguas en Bruxelas e a situación do neerlandés"Rexión de Bruxelas Capital"o orixinalSitio da rexiónPáxina de Bruselas no sitio da Oficina de Promoción Turística de Valonia e BruxelasMapa Interactivo da Rexión de Bruxelas-CapitaleeWorldCat332144929079854441105155190212ID28008674080552-90000 0001 0666 3698n94104302ID540940339365017018237

                              What should I write in an apology letter, since I have decided not to join a company after accepting an offer letterShould I keep looking after accepting a job offer?What should I do when I've been verbally told I would get an offer letter, but still haven't gotten one after 4 weeks?Do I accept an offer from a company that I am not likely to join?New job hasn't confirmed starting date and I want to give current employer as much notice as possibleHow should I address my manager in my resignation letter?HR delayed background verification, now jobless as resignedNo email communication after accepting a formal written offer. How should I phrase the call?What should I do if after receiving a verbal offer letter I am informed that my written job offer is put on hold due to some internal issues?Should I inform the current employer that I am about to resign within 1-2 weeks since I have signed the offer letter and waiting for visa?What company will do, if I send their offer letter to another company