Install-ModuleScript
Copies only PowerShell scripts from a module's Internals\Scripts folder to a destination path. The destination is flattened (no Module/Version subfolders).
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>]#ByNameInstall-ModuleScript
[-Exclude <String[]>]
[-Force]
[-Include <String[]>]
[-ListOnly]
-Module <PSObject>
[-OnExists <Merge| Overwrite| Skip| Stop| Refresh>]
[-Path] <String>
[-RequiredVersion <Version>]
[-ScriptsRelativePath <String>]
[-Unblock]
[<CommonParameters>]#ByModuleExamples
Copy PowerShell scripts from Internals\Scripts to a tools folder
Install-ModuleScript -Name EFAdminManager -Path 'C:\Tools' -VerboseCopies PowerShell script files under Internals\Scripts recursively into C:\Tools, preserving subfolders. Shows each copied file.
Copy only specific scripts, unblocking and overwriting
Install-ModuleScript -Name EFAdminManager -Path 'C:\Tools' -Include 'Repair-*' -Unblock -OnExists OverwriteLimits to files that start with Repair-, removes Windows Zone.Identifier (on Windows), and overwrites existing files.
Preview planned actions without copying
Get-Module -ListAvailable EFAdminManager | Install-ModuleScript -Path 'C:\Tools' -ListOnlyShows Source, Destination, and chosen action for each file without writing anything.
Parameters
- -Exclude String[]
- Wildcard exclude filters (relative to the scripts folder).
- -Force SwitchParameter
- Force overwriting read-only files when -OnExists Overwrite or -OnExists Merge with -Force for new-only behavior.
- -Include String[]
- Wildcard include filters (relative to the scripts folder). Defaults to '*.ps1'.
- -ListOnly SwitchParameter
- Show which files would be copied without performing any changes.
- -Name String
- Module name to source scripts from (highest installed version is used by default).
- -OnExists OnExistsOption
- Conflict handling when a destination file already exists. Defaults to Merge (keep existing).
- Possible values:
Merge,Overwrite,Skip,Stop,Refresh - -Path String
- Destination folder to copy scripts into (created if missing).
- -RequiredVersion Version
- Optional exact module version to use when multiple versions are installed.
- -ScriptsRelativePath String
- Relative path under the module root where scripts live. Defaults to 'Internals\Scripts'.
- -Unblock SwitchParameter
- When set, attempts to remove the Windows Zone.Identifier (unblock) on copied files.
- -Module PSObject
- Specific module instance to source scripts from.
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.