<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: A Best Practice Guide To Creating A Powershell Module	</title>
	<atom:link href="https://thesysadminchannel.com/powershell-module/feed/" rel="self" type="application/rss+xml" />
	<link>https://thesysadminchannel.com/powershell-module/</link>
	<description>Documenting My Life as a System Administrator</description>
	<lastBuildDate>Sat, 30 Dec 2023 04:16:01 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.2</generator>
	<item>
		<title>
		By: errwic		</title>
		<link>https://thesysadminchannel.com/powershell-module/#comment-22509</link>

		<dc:creator><![CDATA[errwic]]></dc:creator>
		<pubDate>Sat, 30 Dec 2023 04:16:01 +0000</pubDate>
		<guid isPermaLink="false">https://thesysadminchannel.com/?p=2882#comment-22509</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://thesysadminchannel.com/powershell-module/#comment-13282&quot;&gt;jim&lt;/a&gt;.

thank you so much, ive searched sooo many post trying to figure out why my module wouldnt load]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://thesysadminchannel.com/powershell-module/#comment-13282">jim</a>.</p>
<p>thank you so much, ive searched sooo many post trying to figure out why my module wouldnt load</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Nathan Bartell		</title>
		<link>https://thesysadminchannel.com/powershell-module/#comment-13516</link>

		<dc:creator><![CDATA[Nathan Bartell]]></dc:creator>
		<pubDate>Tue, 27 Jun 2023 22:54:48 +0000</pubDate>
		<guid isPermaLink="false">https://thesysadminchannel.com/?p=2882#comment-13516</guid>

					<description><![CDATA[Great article!  Did you ever write an article about module manifests?  We have many (many) scripts and we&#039;re trying to come up with the best way to organize them so we can use them in Runbooks.  I have a software development background so I&#039;m trying to merge that with the powershell world.  Thanks!]]></description>
			<content:encoded><![CDATA[<p>Great article!  Did you ever write an article about module manifests?  We have many (many) scripts and we&#8217;re trying to come up with the best way to organize them so we can use them in Runbooks.  I have a software development background so I&#8217;m trying to merge that with the powershell world.  Thanks!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: jim		</title>
		<link>https://thesysadminchannel.com/powershell-module/#comment-13282</link>

		<dc:creator><![CDATA[jim]]></dc:creator>
		<pubDate>Thu, 22 Jun 2023 13:42:26 +0000</pubDate>
		<guid isPermaLink="false">https://thesysadminchannel.com/?p=2882#comment-13282</guid>

					<description><![CDATA[Grouping all the functions into a single .psm1 file is probably the worst advice that can be given to someone starting out with modules. It is not difficult to understand a best practice approach to creating modules with public, private and tests folders.
Module Folder
    module.psd1 - Manifest, can use New-ModuleManifest to create
    module.psm1 - Contains functions to import all .ps1 files into memory and export public functions
    public - Contains functions that are exported
    private - Contains internal module functions
    tests - Contains Pester unit tests for module

To load all the .ps1 files from the module.psm1 file use:
Get-ChildItem -Path $PSScriptRoot\private, $PSScriptRoot\public -Filter *.ps1 &#124; ForEach-Object { . $_ }
To export the public functions from the module.psm1 file use:
Get-ChildItem -Path $PSScriptRoot\public\*.ps1 &#124; ForEach-Object { Export-ModuleMember -Function $_.Basename }

Then you just add new .ps1 files to the public or private folders to create new private or public functions.
Yes your post was &quot;basic&quot;, but not providing the best practice approach is doing a disservice.]]></description>
			<content:encoded><![CDATA[<p>Grouping all the functions into a single .psm1 file is probably the worst advice that can be given to someone starting out with modules. It is not difficult to understand a best practice approach to creating modules with public, private and tests folders.<br />
Module Folder<br />
    module.psd1 &#8211; Manifest, can use New-ModuleManifest to create<br />
    module.psm1 &#8211; Contains functions to import all .ps1 files into memory and export public functions<br />
    public &#8211; Contains functions that are exported<br />
    private &#8211; Contains internal module functions<br />
    tests &#8211; Contains Pester unit tests for module</p>
<p>To load all the .ps1 files from the module.psm1 file use:<br />
Get-ChildItem -Path $PSScriptRoot\private, $PSScriptRoot\public -Filter *.ps1 | ForEach-Object { . $_ }<br />
To export the public functions from the module.psm1 file use:<br />
Get-ChildItem -Path $PSScriptRoot\public\*.ps1 | ForEach-Object { Export-ModuleMember -Function $_.Basename }</p>
<p>Then you just add new .ps1 files to the public or private folders to create new private or public functions.<br />
Yes your post was &#8220;basic&#8221;, but not providing the best practice approach is doing a disservice.</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
