Below is a small PowerShell script.
function test() {
$paramstring = "name=vindhya
id=182122"
$hash_params = convertfrom-stringdata -stringdata $paramstring
Write-Host $hash_params
callee $hash_params
}
function callee() {
param($hash_params)
#$hash_params
}
test
Output is System.Collections.Hashtable.
But if Write-Host is replaced by Write-Output then,
function test() {
$paramstring="name=vindhya
id=182122"
$hash_params = convertfrom-stringdata -stringdata $paramstring
Write-Output $hash_params
callee $hash_params
}
function callee() {
param($hash_params)
#$hash_params
}
test
Output is
Name Value
---- -----
name vindhya
id 182122
Why are Write-Host and Write-Output behaving differently?