I'm maintaining a transport agent that has a C# custom action installer class to install itself.
This code invokes powershell commands (Get-TransportServer, Get-ExchangeServer) to determine some things and then invokes the Install-TransportAgent (or Uninstall-TransportAgent for uninstall) command.
Currently the code detects whether it's installing for Exchange 2007 or 2010 and uses either:
"Microsoft.Exchange.Management.PowerShell.Admin"
"Microsoft.Exchange.Management.PowerShell.e2010"
as the name of the PS snap-in.
I guess that Exchange 2013 doesn't use either of the same strings, so there's probably going to need more changes in the future to handle that.
Is there a better (Exchange version independent) way of installing a transport agent?
Ideally I think I ought to be able to call underlying Exchange interfaces (the things the powershell commands must eventually use) rather than having to do things indirectly via powershell commands.