<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" media="screen" href="/styles/xslt/rss.xslt"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:c9="http://channel9.msdn.com">
<channel>
	<title>Comment Feed for Channel 9 - Windows PowerShell V2 Modules</title>
	<atom:link rel="self" type="application/rss+xml" href="http://channel9.msdn.com/Blogs/philpenn/PowerShell-V2-Modules/RSS"></atom:link>
	<image>
		<url>http://ecn.channel9.msdn.com/o9/previewImages/100/464640_100x75.jpg</url>
		<title>Channel 9 - Windows PowerShell V2 Modules</title>
		<link></link>
	</image>
	<description>
This video demonstrates converting a Windows PowerShell script to a Windows PowerShell module.

See more info at 
MSDN Code Gallery.

The video starts by introducing a simple script file, counter.ps1, with three functions and two variables.

The script file is dot sourced into the environment.&amp;nbsp; All variables and functions are now in scope.&amp;nbsp; The intent is to only have two of the functions in scope, with the rest being private implementation details.

Next, the file is renamed from counter.ps1 to counter.psm1 for the correct module extension.&amp;nbsp; Using the
Import-Module cmdlet, the module is loaded into scope.&amp;nbsp; It is demonstrated that the variables are private, however all functions are public.&amp;nbsp; This is shown using
Get-Command -module counter to list the exported commands.

Before changing the module it is necessary to remove it from scope.&amp;nbsp; This is accomplished using
Get-Module | Remove-Module to pipe any modules (only one in this sample) to be removed.

In order to hide certain functions, it is necessary to specific which are public using
Export-ModuleMember function_name.&amp;nbsp; By specifying only the intended public functions, others remain private, only accessible from within the module. 
&amp;nbsp; 
</description>
	<link></link>
	<language>en</language>
	<pubDate>Wed, 22 May 2013 06:54:04 GMT</pubDate>
	<lastBuildDate>Wed, 22 May 2013 06:54:04 GMT</lastBuildDate>
	<generator>Rev9</generator>
	<item>
		<title>Re: Windows PowerShell V2 Modules</title>
		<description>
			<![CDATA[
<p>Excellent introduction to modules!</p>
<p>posted by jupenator</p>]]>
		</description>
		<link>http://channel9.msdn.com/Blogs/philpenn/PowerShell-V2-Modules#c633921813070000000</link>
		<pubDate>Mon, 26 Oct 2009 19:15:07 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Blogs/philpenn/PowerShell-V2-Modules#c633921813070000000</guid>
		<dc:creator>jupenator</dc:creator>
	</item>
</channel>
</rss>