Deserializes a PowerShell File or any object-graphs from PowerShell file to an object.
Import-ObjectGraph
-Path <String[]>
[<CommonParameters>]Import-ObjectGraph
-LiteralPath <String[]>
[<CommonParameters>]Import-ObjectGraph
[-ListAs <Object>]
[-MapAs <Object>]
[-LanguageMode <PSLanguageMode>]
[-Encoding <Object>]
[<CommonParameters>]The Import-ObjectGraph cmdlet safely converts a PowerShell formatted expression contained by a file
to an object-graph existing of a mixture of nested arrays, hash tables and objects that contain a list
of strings and values.
Specifies the path to a file where Import-ObjectGraph imports the object-graph.
Wildcard characters are permitted.
| Type: | String[] |
| Mandatory: | True |
| Position: | Named |
| Default value: | |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Specifies a path to one or more locations that contain a PowerShell the object-graph. The value of LiteralPath is used exactly as it's typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell PowerShell not to interpret any characters as escape sequences.
| Type: | String[] |
| Mandatory: | True |
| Position: | Named |
| Default value: | |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
If supplied, the array sub-expression @( ) syntaxes without an type initializer or with an unknown or
denied type initializer will be converted to the given list type.
| Type: | Object |
| Mandatory: | False |
| Position: | Named |
| Default value: | |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
If supplied, the array sub-expression @{ } syntaxes without an type initializer or with an unknown or
denied type initializer will be converted to the given map (dictionary or object) type.
The default MapAs is an (ordered) PSCustomObject for PowerShell Data (psd1) files and
a (unordered) HashTable for any other files, which usually concerns PowerShell (.ps1) files that
support explicit type initiators.
| Type: | Object |
| Mandatory: | False |
| Position: | Named |
| Default value: | |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Defines which object types are allowed for the deserialization, see: About language modes
- Any type that is not allowed by the given language mode, will be omitted leaving a bare
[ValueType],[String],[Array]or[HashTable]. - Any variable that is not
$True,$Falseor$Nullwill be converted to a literal string, e.g.$Test.
The default LanguageMode is Restricted for PowerShell Data (psd1) files and Constrained for any
other files, which usually concerns PowerShell (.ps1) files.
Caution
In full language mode, ConvertTo-Expression permits all type initializers. Cmdlets, functions,
CIM commands, and workflows will not be invoked by the ConvertFrom-Expression cmdlet.
Take reasonable precautions when using the Invoke-Expression -LanguageMode Full command in scripts.
Verify that the class types in the expression are safe before instantiating them. In general, it is
best to design your configuration expressions with restricted or constrained classes, rather than
allowing full freeform expressions.
| Type: | PSLanguageMode |
| Mandatory: | False |
| Position: | Named |
| Default value: | |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Specifies the type of encoding for the target file. The default value is utf8NoBOM.
| Type: | Object |
| Mandatory: | False |
| Position: | Named |
| Default value: | |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |