I'm saving out the results of Get-Command like so:
gcm -type alias, filter, function, cmdlet | export-clixml > commands.xml
I then load that back in as:
$cmds = import-clixml commands.xml
However some things don't seem to work as I would expect e.g.:
> $cmds | ? {$_.CommandType -eq 'alias'}
>
which outputs nothing however the where expression works when you use it directly on GCM:
gcm -type alias, filter, function, cmdlet | ? {$_.CommandType -eq 'alias'}
CommandType Name Definition
----------- ---- ----------
Alias % ForEach-Object
I can get the deserialized version to work if I do this:
> $cmds | ? {[System.Management.Automation.CommandTypes]$_.CommandType -eq 'alias'}
Is this just an unfortunate consequence of round tripping?
--
Keith


