Project

PSPublishModule

Build, test, version, sign, and publish PowerShell modules with reusable PowerForge pipelines.

Stars 48
Forks 16
PowerShell Gallery downloads 17,213
Release v3.0.169
Language: C# Updated: 2026-10-13

API Reference

Command

Install-ModuleScript

Namespace PSPublishModule
Inputs
System.Management.Automation.PSObject System.String

Copies only PowerShell scripts from a module's Internals\Scripts folder to a destination path. The destination is flattened (no Module/Version subfolders).

Remarks

Copies only PowerShell scripts from a module's Internals\Scripts folder to a destination path. The destination is flattened (no Module/Version subfolders).

Examples

Authored help example

Copy PowerShell scripts from Internals\Scripts to a tools folder

PS>


Install-ModuleScript -Name EFAdminManager -Path 'C:\Tools' -Verbose
        

Copies PowerShell script files under Internals\Scripts recursively into C:\Tools, preserving subfolders. Shows each copied file.

Copy only specific scripts, unblocking and overwriting

PS>


Install-ModuleScript -Name EFAdminManager -Path 'C:\Tools' -Include 'Repair-*' -Unblock -OnExists Overwrite
        

Limits to files that start with Repair-, removes Windows Zone.Identifier (on Windows), and overwrites existing files.

Preview planned actions without copying

PS>


Get-Module -ListAvailable EFAdminManager | Install-ModuleScript -Path 'C:\Tools' -ListOnly
        

Shows Source, Destination, and chosen action for each file without writing anything.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.

Syntax

Install-ModuleScript [-Exclude <String[]>] [-Force] [-Include <String[]>] [-ListOnly] -Name <String> [-OnExists <Merge|Overwrite|Skip|Stop|Refresh>] -Path <String> [-RequiredVersion <Version>] [-ScriptsRelativePath <String>] [-Unblock] [<CommonParameters>]
#
Parameter set: ByName

Parameters

Exclude String[] optionalposition: namedpipeline: False
Wildcard exclude filters (relative to the scripts folder).
Force SwitchParameter optionalposition: namedpipeline: False
Force overwriting read-only files when -OnExists Overwrite or -OnExists Merge with -Force for new-only behavior.
Include String[] optionalposition: namedpipeline: False
Wildcard include filters (relative to the scripts folder). Defaults to '*.ps1'.
ListOnly SwitchParameter optionalposition: namedpipeline: False
Show which files would be copied without performing any changes.
Name String requiredposition: 0pipeline: True (ByPropertyName)
Module name to source scripts from (highest installed version is used by default).
OnExists OnExistsOption optionalposition: namedpipeline: Falsevalues: 5
Conflict handling when a destination file already exists. Defaults to Merge (keep existing).
Possible values: Merge, Overwrite, Skip, Stop, Refresh
Path String requiredposition: 1pipeline: False
Destination folder to copy scripts into (created if missing).
RequiredVersion Version optionalposition: namedpipeline: False
Optional exact module version to use when multiple versions are installed.
ScriptsRelativePath String optionalposition: namedpipeline: False
Relative path under the module root where scripts live. Defaults to 'Internals\Scripts'.
Unblock SwitchParameter optionalposition: namedpipeline: False
When set, attempts to remove the Windows Zone.Identifier (unblock) on copied files.
Install-ModuleScript [-Exclude <String[]>] [-Force] [-Include <String[]>] [-ListOnly] -Module <PSObject> [-OnExists <Merge|Overwrite|Skip|Stop|Refresh>] -Path <String> [-RequiredVersion <Version>] [-ScriptsRelativePath <String>] [-Unblock] [<CommonParameters>]
#
Parameter set: ByModule

Parameters

Exclude String[] optionalposition: namedpipeline: False
Wildcard exclude filters (relative to the scripts folder).
Force SwitchParameter optionalposition: namedpipeline: False
Force overwriting read-only files when -OnExists Overwrite or -OnExists Merge with -Force for new-only behavior.
Include String[] optionalposition: namedpipeline: False
Wildcard include filters (relative to the scripts folder). Defaults to '*.ps1'.
ListOnly SwitchParameter optionalposition: namedpipeline: False
Show which files would be copied without performing any changes.
Module PSObject requiredposition: namedpipeline: True (ByValue)
Specific module instance to source scripts from.
OnExists OnExistsOption optionalposition: namedpipeline: Falsevalues: 5
Conflict handling when a destination file already exists. Defaults to Merge (keep existing).
Possible values: Merge, Overwrite, Skip, Stop, Refresh
Path String requiredposition: 1pipeline: False
Destination folder to copy scripts into (created if missing).
RequiredVersion Version optionalposition: namedpipeline: False
Optional exact module version to use when multiple versions are installed.
ScriptsRelativePath String optionalposition: namedpipeline: False
Relative path under the module root where scripts live. Defaults to 'Internals\Scripts'.
Unblock SwitchParameter optionalposition: namedpipeline: False
When set, attempts to remove the Windows Zone.Identifier (unblock) on copied files.