Import-Power
Shell
Data
File
Imports values from a .PSD1 file without invoking its contents
Syntax
Import-PowerShellDataFile
[[-Path] <String[]>]
[<CommonParameters>]
Import-PowerShellDataFile
[-LiteralPath <String[]>]
[<CommonParameters>]
Description
The Import-PowerShellDataFile cmdlet returns a hashtable consisting of the key-value pairs in a .PSD1 file.
Examples
1: Retrieve values from PSD1
PS C:\> $content = Import-PowerShellDataFile .\Configuration.psd1
PS C:\> $content
Name Value
---- -----
key1 value1
key2 value2
This examples retrieves the key-value pairs stored in the hashtable kept inside the Configuration.psd1 file.
Optional Parameters
-LiteralPath
Type: | String[] |
Aliases: | PSPath |
Position: | Named |
Default value: | None |
Accept pipeline input: | True (ByPropertyName) |
Accept wildcard characters: | False |
-Path
Type: | String[] |
Position: | 0 |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |