CmdID / PowerShell / Cmdlets / Import
Import-PowerShellDataFile
Imports values from a .psd1 file without invoking its contents. PowerShell reference
From the PowerShell reference 2 parameters
What it does
Imports values from a .psd1 file without invoking its contents. The Import-PowerShellDataFile cmdlet safely imports key-value pairs from hashtables defined in a .psd1 file. The values could be imported using Invoke-Expression on the contents of the file. However, Invoke-Expression runs any code contained in the file. This could produce unwanted results or execute unsafe code. Import-PowerShellDataFile imports the data without invoking the code. NOTE: You can only import the first 500 key-value pairs.
Import-PowerShellDataFile [[-Path] <string[]>] [<CommonParameters>]Import-PowerShellDataFile [-LiteralPath <string[]>] [<CommonParameters>]
Retrieve values from PSD1
Get-Content .\Configuration.psd1
$config = Import-PowerShellDataFile .\Configuration.psd1
$config.AllNodesIdentifyIts page in the reference: Import-PowerShellDataFile.
Parameters
-LiteralPathThe path to the file being imported. All characters in the path are treated as literal values.-PathThe path to the file being imported. Wildcards are allowed but only the first matching file is imported.