Since the HashTable and output of Connect-NaController are of different types, PowerShell formats the output with the object that is passed through the pipeline first. There are two ways to change this:
1) Don't let the result of Connect-NaController get passed down the pipeline. You can accomplish this by capturing the output in a variable, or by piping the result into Out-Null:
Script:
$controller = Connect-NaController controllerA
$hash = @{Key1="Value";Key2="Value";Key3="Value"}
$hash
Or:
Connect-NaController controllerA | Out-Null
$hash = @{Key1="Value";Key2="Value";Key3="Value"}
$hash
Output:
Name Value
---- -----
Key1 Value
Key2 Value
Key3 Value
2) Explicitly pass the results of the HashTable and Connect-NaController to Format-Table. This will output tables for both types.
Script:
Connect-NaController controllerA | Format-Table
$hash = @{Key1="Value";Key2="Value";Key3="Value"}
$hash | Format-Table
Output:
Name Address Ontapi Version
---- ------- ------ -------
controllerA 192.168.0.102 1.14 NetApp Release 7.3.5: Mon Nov 22 20:37:51 PST 2010
Name Value
---- -----
Key1 Value
Key2 Value
Key3 Value
Thanks,
Steven