![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | How to import variable values? Is there a preferred or recommended way to have an .ini-like file for Powershell? In a configuration script that I'm writing, I want to be able to use it at two different locations, which require different values for various settings. I was thinking of using the & operator with a separate .ps1 script that initialized all of the variables to the initial values I wanted, but would an XML or INI file loaded into a hash-table be more appropriate/best-practice? Ideally, it would be nice to encrypt the variable files so that I could maintain them in the same common directory, and specify either (along with the respective password) from the command line, while at the same time preventing prying eyes from opening and viewing the contents of those variables. |
My System Specs![]() |
| | #2 (permalink) |
| | RE: How to import variable values? I don't know if it's "recommended" or not, but I've done pretty much what you're asking using export-clixml. If data needs to be loaded into a hash table, I just construct it as a hash table, and export that. When I need it back, I just do an import-clixml, and I have my hash table back. As far as keeping it away from "prying eyes", that's what NTFS permissions are for, IMHO. "C S S" wrote: Quote: > Is there a preferred or recommended way to have an .ini-like file for > Powershell? In a configuration script that I'm writing, I want to be able to > use it at two different locations, which require different values for various > settings. > > I was thinking of using the & operator with a separate .ps1 script that > initialized all of the variables to the initial values I wanted, but would an > XML or INI file loaded into a hash-table be more appropriate/best-practice? > > Ideally, it would be nice to encrypt the variable files so that I could > maintain them in the same common directory, and specify either (along with > the respective password) from the command line, while at the same time > preventing prying eyes from opening and viewing the contents of those > variables. > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| values | VB Script | |||
| Re: how to change xml values | PowerShell | |||
| Import-CSV from Web/Variable | PowerShell | |||
| how to assign values to array and how to create array via variable | PowerShell | |||
| How can I ensure that a variable is a built-in powershell variable? | PowerShell | |||