Copy-PSModuleToFolder
OSD 21.2.9.2+
Copy-PSModuleToFolder used to copy an installed PowerShell Module to separate destination directory. The destination directory will be created if it does not exist
1
PS C:\> Get-Help Copy-PSModuleToFolder -Full
2
3
NAME
4
Copy-PSModuleToFolder
5
6
SYNOPSIS
7
Get-Module and copy the ModuleBase to a new Destination\ModuleBase
8
9
10
SYNTAX
11
Copy-PSModuleToFolder [-Name] <String[]> [-Destination] <String> [-RemoveOldVersions] [<CommonParameters>]
12
13
14
DESCRIPTION
15
Get-Module and copy the ModuleBase to a new Destination\ModuleBase
16
17
18
PARAMETERS
19
-Name <String[]>
20
Name of the PowerShell Module to Copy
21
22
Required? true
23
Position? 1
24
Default value
25
Accept pipeline input? true (ByPropertyName)
26
Accept wildcard characters? true
27
28
-Destination <String>
29
Destination PSModule directory
30
Copied Module is a Child of Destination
31
32
Required? true
33
Position? 2
34
Default value
35
Accept pipeline input? true (ByPropertyName)
36
Accept wildcard characters? false
37
38
-RemoveOldVersions [<SwitchParameter>]
39
Removes older Module Versions from the Destination
40
41
Required? false
42
Position? named
43
Default value False
44
Accept pipeline input? false
45
Accept wildcard characters? false
46
47
<CommonParameters>
48
This cmdlet supports the common parameters: Verbose, Debug,
49
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
50
OutBuffer, PipelineVariable, and OutVariable. For more information, see
51
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
52
53
INPUTS
54
55
OUTPUTS
56
57
NOTES
58
59
60
21.1.30.1 Initial Release
61
21.1.30.2 Added WinPE Parameter
62
21.1.30.3 Renamed PSModulePath Parameter to Destination, Added RemoveOldVersions
63
21.1.31.1 Removed WinPE Parameter
64
21.2.2.1 Renamed to Copy-ModuleToFolder so I don't mess with PowerShellGet
65
21.2.9.1 Renamed to Copy-PSModuleToFolder to standardize
66
67
68
RELATED LINKS
69
https://osd.osdeploy.com/module/functions/psmodule/copy-psmoduletofolder
Copied!

-Name

1
#String
2
-Name PShot
3
4
#Array of Strings
5
-Name PShot,OSD,OSDBuilder
6
7
#Wildcard
8
-Name OSD*
9
10
#Position 0
11
Copy-Module PShot
Copied!

-Destination

1
#Module will be copied to T:\Temp\PShot\<ModuleVersion>
2
Copy-Module -Name PShot -Destination T:\Temp
3
4
#Module will be copied to C:\Program Files\WindowsPowerShell\Modules\OSD\<ModuleVersion>
5
Copy-Module -Name OSD -Destination "C:\Program Files\WindowsPowerShell\Modules"
Copied!

-RemoveOldVersions

1
-RemoveOldVersions [<SwitchParameter>]
2
Removes older Module Versions from the Destination
3
4
Required? false
5
Position? named
6
Default value False
7
Accept pipeline input? false
8
Accept wildcard characters? false
Copied!
-RemoveOldVersions:$true

Versioning

If multiple versions of a Module exist, only the latest will be copied

Version Subfolders

Version Subfolders are retained by Copy-Module, unless the -WinPE or -RemoveOldVersionsparameters are used
-RemoveOldVersions:$false