As part of creating Windows PowerShell modules, I have recently created a script to create the structure required, as follows:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[CmdletBinding()] | |
Param ( | |
[String] | |
$ModuleName = "TestModule", | |
[String] | |
$Author = "", | |
[String] | |
[ValidateScript({Get-Item $_ })] | |
$Path = "C:\Sandbox\PowerShell\Modules" | |
) | |
New-Item ($Path + "\" + $ModuleName + "\" + $ModuleName) -Type Directory | Out-Null | |
New-Item ($Path + "\" + $ModuleName + "\" + $ModuleName + "\Private") -Type Directory | Out-Null | |
New-Item ($Path + "\" + $ModuleName + "\" + $ModuleName + "\Public") -Type Directory | Out-Null | |
New-Item ($Path + "\" + $ModuleName + "\" + $ModuleName + "\en-US") -Type Directory | Out-Null | |
New-Item ($Path + "\" + $ModuleName + "\" + $ModuleName + "\lib") -Type Directory | Out-Null | |
New-Item ($Path + "\" + $ModuleName + "\" + $ModuleName + "\bin") -Type Directory | Out-Null | |
New-Item ($Path + "\" + $ModuleName + "\Tests") -Type Directory | Out-Null | |
New-Item ($Path + "\" + $ModuleName + "\" + $ModuleName + "\" + $ModuleName + ".psm1") -Type File | Out-Null | |
New-Item ($Path + "\" + $ModuleName + "\" + $ModuleName + "\" + $ModuleName + ".Format.ps1.xml") -Type File | Out-Null | |
New-Item ($Path + "\" + $ModuleName + "\" + $ModuleName + "\en-US\about_$ModuleName.help.txt") -Type File | Out-Null | |
New-Item ($Path + "\" + $ModuleName + "\Tests\" + $ModuleName + ".Tests.ps1") -Type File | Out-Null |
This will create the following items in the specified path: