converting 1.0 snap-ins to 2.0 modules

converting 1.0 snap-ins to 2.0 modules

Post by Group Poli » Thu, 19 Nov 2009 12:06:20



Per the subject line, is this documented anywhere? I did a search on MSDN
and Google and didn't find anything particularly clear. I have some C#
snap-ins that I'd like to convert to 2.0 modules and am looking for
developer best practices, tips, hints, etc..

Thanks!

Darren
 
 
 

converting 1.0 snap-ins to 2.0 modules

Post by Marco Shaw » Fri, 20 Nov 2009 06:12:16

I'll assume you've seen this new documentation?

 
 
 

converting 1.0 snap-ins to 2.0 modules

Post by Marco Shaw » Fri, 20 Nov 2009 06:13:44

(Hit enter too fast on the last one.)

It might not address all your questions, but it is all very new:
http://www.yqcomputer.com/ %28VS.85%29.aspx

Marco
 
 
 

converting 1.0 snap-ins to 2.0 modules

Post by Group Poli » Fri, 20 Nov 2009 07:53:16

Thanks Marco-
I did see that and it helps a little. It doesn't exactly spell out a
migration path, but from the code samples, it appears that nothing really
changes in terms of writing binary cmdlets except that it is no longer
necessary to use the Snap-in classes. My assumption, perhaps incorrect, is
that I should be able to take a v1 cmdlet assembly unchanged and use
import-module in v2 to bring it into a Powershell session. In addition, I
have the option to write an module manifest to optionally tweak how that
import works. Does that sound correct? I guess one last question is, do I
have to handle help files any differently?

Thanks again,

Darren
 
 
 

converting 1.0 snap-ins to 2.0 modules

Post by x0 » Fri, 20 Nov 2009 10:06:06

100% correct Darren.

The DLL remains unchanged; you can just type import-module .
\mysnapin.dll and it just works. psd1 manifests control format/type
data files and can restrict export of cmdlets among other things.

-Oisin

On Nov 18, 5:53m, "Darren Mar-Elia \(Group Policy MVP\)"