CmdID

CmdID / PowerShell / Cmdlets / Import

Import-PowerShellDataFile

Imports values from a .psd1 file without invoking its contents. PowerShell reference

From the PowerShell reference 2 parameters

Opens CmdID with your command, read as PowerShell. It is read in your browser and sent nowhere.

What it does

from the PowerShell reference, CC BY 4.0

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.AllNodesIdentify

Its page in the reference: Import-PowerShellDataFile.

Parameters

2 in the PowerShell reference
-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.