Hi All,
I am trying out the Crescendo module and I am getting an error when running the Export-CrescendoModule . The json looks good but I am getting this error “InvalidOperation: You cannot call a method on a null-valued expression.”
here is the code I am running
Import-Module Microsoft.PowerShell.Crescendo -Verbose
$tempJson = New-TemporaryFile
New-CrescendoCommand -Verb 'Get' -Noun 'ChocoPackage' | %{
$_.OriginalName = 'choco'
$_.OriginalCommandElements = @(
'search',
'--limit-output',
'--local-only'
)
$_.Description = 'Get installed Chocolatey packages'
$_.Parameters = @(
@{
Name = 'Package'
ParameterType = 'string'
Description = 'Package Name'
}
)
$_.OutputHandlers = @(
@{
ParameterSetName = 'Default'
Handler = {
param ( $output )
$output | ForEach-Object {
$name,$version = $_ -split '\|'
[pscustomobject]@{
Name = $name
Version = $version
}
}
}
}
)
$_
} | ConvertTo-Json | Out-File $tempJson
Export-CrescendoModule -ConfigurationFile $tempJson -ModuleName .\Get-ChocoPackage.psm1 -Force
any help would be greatly appreciated! Thx