> For the complete documentation index, see [llms.txt](https://osd.osdeploy.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://osd.osdeploy.com/docs/trash/psmodule/copy-psmoduletofolder.md).

# 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

```
PS C:\> Get-Help Copy-PSModuleToFolder -Full

NAME
    Copy-PSModuleToFolder
    
SYNOPSIS
    Get-Module and copy the ModuleBase to a new Destination\ModuleBase
    
    
SYNTAX
    Copy-PSModuleToFolder [-Name] <String[]> [-Destination] <String> [-RemoveOldVersions] [<CommonParameters>]
    
    
DESCRIPTION
    Get-Module and copy the ModuleBase to a new Destination\ModuleBase
    

PARAMETERS
    -Name <String[]>
        Name of the PowerShell Module to Copy
        
        Required?                    true
        Position?                    1
        Default value                
        Accept pipeline input?       true (ByPropertyName)
        Accept wildcard characters?  true
        
    -Destination <String>
        Destination PSModule directory
        Copied Module is a Child of Destination
        
        Required?                    true
        Position?                    2
        Default value                
        Accept pipeline input?       true (ByPropertyName)
        Accept wildcard characters?  false
        
    -RemoveOldVersions [<SwitchParameter>]
        Removes older Module Versions from the Destination
        
        Required?                    false
        Position?                    named
        Default value                False
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer, PipelineVariable, and OutVariable. For more information, see 
        about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216). 
    
INPUTS
    
OUTPUTS
    
NOTES
    
    
        21.1.30.1   Initial Release
        21.1.30.2   Added WinPE Parameter
        21.1.30.3   Renamed PSModulePath Parameter to Destination, Added RemoveOldVersions
        21.1.31.1   Removed WinPE Parameter
        21.2.2.1	Renamed to Copy-ModuleToFolder so I don't mess with PowerShellGet
        21.2.9.1	Renamed to Copy-PSModuleToFolder to standardize
    
    
RELATED LINKS
    https://osd.osdeploy.com/module/functions/psmodule/copy-psmoduletofolder
```

## -Name

```
#String
-Name PShot

#Array of Strings
-Name PShot,OSD,OSDBuilder

#Wildcard
-Name OSD*

#Position 0
Copy-Module PShot
```

![](https://3420392058-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LpnxLqvh8u2fEz86kIM%2F-MSJFZkf1OComTqrz-oc%2F-MSJHq_-KJ2qTo4IIvfg%2Fimage.png?alt=media\&token=619f6f87-f27e-4008-8b21-fb568fd74aa0)

![](https://3420392058-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LpnxLqvh8u2fEz86kIM%2F-MSJFZkf1OComTqrz-oc%2F-MSJIBXzuO7T-Hl-kSTu%2Fimage.png?alt=media\&token=44699c53-188d-441e-95fc-7f8b1a7199d0)

## -Destination

```
#Module will be copied to T:\Temp\PShot\<ModuleVersion>
Copy-Module -Name PShot -Destination T:\Temp

#Module will be copied to C:\Program Files\WindowsPowerShell\Modules\OSD\<ModuleVersion>
Copy-Module -Name OSD -Destination "C:\Program Files\WindowsPowerShell\Modules"
```

## -RemoveOldVersions

```
-RemoveOldVersions [<SwitchParameter>]
    Removes older Module Versions from the Destination
    
    Required?                    false
    Position?                    named
    Default value                False
    Accept pipeline input?       false
    Accept wildcard characters?  false
```

![-RemoveOldVersions:$true](https://3420392058-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LpnxLqvh8u2fEz86kIM%2F-MSHRSM4HYJ3xvKY-lIO%2F-MSH_1po4HWcYzoJDbRk%2Fimage.png?alt=media\&token=0747bb1b-76ee-4bb5-9f44-f229eef8d564)

## Versioning

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

![](https://3420392058-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LpnxLqvh8u2fEz86kIM%2F-MSH9ELiaAw2Tr1XAE5A%2F-MSHFHiKVARHfJo2YjDZ%2Fimage.png?alt=media\&token=e78c61bc-b904-4141-91d7-daeef7ae2014)

## Version Subfolders

Version Subfolders are retained by Copy-Module, unless the **`-WinPE`** or **`-RemoveOldVersions`**&#x70;arameters are used

![-RemoveOldVersions:$false](https://3420392058-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LpnxLqvh8u2fEz86kIM%2F-MSHITU3J8SKlmlXW661%2F-MSHK5XWrtcnJFWtrFXi%2Fimage.png?alt=media\&token=8c6d6a17-47c2-41c2-8107-f0b370479f91)
