Powershell parameter type recognition from another module

124 views Asked by At

I have 2 modules one written in c# one written in powershell.

The powershell module contains a cmdlet that returns a c# class

namespace SxServices
{
    [Cmdlet("Get", "SxWinService")]
    [OutputType(typeof(SxWinService))]
    public class GetSxWinService : SxCmdLetBase
    {

So now if I do a Get-Help Get-SxWinService -Full it will tell me that the cmd outputs DataObjects.WinServices.SxWinService. Which is great and the following code will give me intellisense on all the properties of this class.

Get-SxWinService blah | Select-Object -Property 

However in my second module (powershell) I an writing another cmdlet that accepts a parameter of type [DataObjects.WinServices.SxWinService].

Function Set-SxServiceDetails{
    [CmdletBinding()]
    param(
        [parameter()]
        [DataObjects.WinServices.SxWinService]$Service
    )

However powershell will not recognise the type and give me the list of valid properties for this type with intellisense. I feel that I am missing something! Anyone got any ideas?

1

There are 1 answers

0
Alexis Coles On

Sorry all cancel this, not sure what I was doing but this all works fine now.

Maybe just some cache needed updating or the module needed removing and reloading. Anyway seems that above is all you need to do.