ConvertTo CimInstance - dsccommunity/DscResource.Common GitHub Wiki
Converts a hashtable into a CimInstance array.
ConvertTo-CimInstance [-Hashtable] <Hashtable> [[-ClassName] <String>] [[-Namespace] <String>]
[<CommonParameters>]
This function is used to convert a hashtable into MSFT_KeyValuePair objects. These are stored as an CimInstance array. DSC cannot handle hashtables but CimInstances arrays storing MSFT_KeyValuePair.
ConvertTo-CimInstance -Hashtable @{
String = 'a string'
Bool = $true
Int = 99
Array = 'a, b, c'
}
This example returns an CimInstance with the provided hashtable values.
The ClassName of the CimInstance to create.
Default value is to 'MSFT_KeyValuePair'.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: MSFT_KeyValuePair
Accept pipeline input: False
Accept wildcard characters: False
A hashtable with the values to convert.
Type: Hashtable
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
The Namespace of the CimInstance to create.
Default value is to 'root/microsoft/Windows/DesiredStateConfiguration'.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: Root/microsoft/Windows/DesiredStateConfiguration
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.