Skip to content

ConvertTo CimInstance

dscbot edited this page Feb 13, 2024 · 2 revisions

ConvertTo-CimInstance

SYNOPSIS

Converts a hashtable into a CimInstance array.

SYNTAX

ConvertTo-CimInstance -Hashtable <Hashtable> [<CommonParameters>]

DESCRIPTION

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.

EXAMPLES

EXAMPLE 1

ConvertTo-CimInstance -Hashtable @{
    String = 'a string'
    Bool   = $true
    Int    = 99
    Array  = 'a, b, c'
}

This example returns an CimInstance with the provided hashtable values.

PARAMETERS

-Hashtable

A hashtable with the values to convert.

Type: Hashtable
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.Object[]

NOTES

RELATED LINKS

Clone this wiki locally