-
Notifications
You must be signed in to change notification settings - Fork 9
ConvertTo HashTable
dscbot edited this page Feb 13, 2024
·
2 revisions
Converts CimInstances into a hashtable.
ConvertTo-HashTable -CimInstance <CimInstance[]> [<CommonParameters>]
This function is used to convert a CimInstance array containing MSFT_KeyValuePair objects into a hashtable.
$newInstanceParameters = @{
ClassName = 'MSFT_KeyValuePair'
Namespace = 'root/microsoft/Windows/DesiredStateConfiguration'
ClientOnly = $true
}
$cimInstance = [Microsoft.Management.Infrastructure.CimInstance[]] (
(New-CimInstance @newInstanceParameters -Property @{
Key = 'FirstName'
Value = 'John'
}),
(New-CimInstance @newInstanceParameters -Property @{
Key = 'LastName'
Value = 'Smith'
})
)
ConvertTo-HashTable -CimInstance $cimInstance
This creates a array of CimInstances using the class name MSFT_KeyValuePair and passes it to ConvertTo-HashTable which returns a hashtable.
An array of CimInstances or a single CimInstance object to convert.
Type: CimInstance[]
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
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.
- Assert-BoundParameter
- Assert-ElevatedUser
- Assert-IPAddress
- Assert-Module
- Compare-DscParameterState
- Compare-ResourcePropertyState
- ConvertFrom-DscResourceInstance
- ConvertTo-CimInstance
- ConvertTo-HashTable
- Find-Certificate
- Get-ComputerName
- Get-DscProperty
- Get-EnvironmentVariable
- Get-LocalizedData
- Get-LocalizedDataForInvariantCulture
- Get-PSModulePath
- Get-TemporaryFolder
- Get-UserName
- New-ArgumentException
- New-ErrorRecord
- New-Exception
- New-InvalidDataException
- New-InvalidOperationException
- New-InvalidResultException
- New-NotImplementedException
- New-ObjectNotFoundException
- Remove-CommonParameter
- Set-DscMachineRebootRequired
- Set-PSModulePath
- Test-AccountRequirePassword
- Test-DscParameterState
- Test-DscProperty
- Test-IsNanoServer
- Test-IsNumericType
- Test-ModuleExist