< Back
Copy-CDscResource
Post
NAME Copy-CDscResource
SYNOPSIS
Copies DSC resources.
SYNTAX
Copy-CDscResource [-Path] <String> [-Destination] <String> [-Recurse] [-PassThru] [-Force] [<CommonParameters>]
DESCRIPTION
This function copies a DSC resource or a directory of DSC resources to a DSC pull server share/website. All files
under `$Path` are copied.
DSC requires all files have a checksum file (e.g. `localhost.mof.checksum`), which this function generates for you
(in a temporary location).
Only new files, or files whose checksums have changed, are copied. You can force all files to be copied with the
`Force` switch.
`Copy-CDscResource` is new in Carbon 2.0.
PARAMETERS
-Path <String>
The path to the DSC resource to copy. If a directory is given, all files in that directory are copied.
Wildcards supported.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Destination <String>
The directory where the resources should be copied.
Required? true
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Recurse [<SwitchParameter>]
Recursively copy files from the source directory.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-PassThru [<SwitchParameter>]
Returns `IO.FileInfo` objects for each item copied to `Destination`.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-Force [<SwitchParameter>]
Copy resources, even if they are the same on the destination server.
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
System.IO.FileInfo
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Copy-CDscResource -Path 'localhost.mof' -Destination '\\\\dscserver\\DscResources'
Demonstrates how to copy a single resource to a resources SMB share. `localhost.mof` will only be copied if its
checksum is different than what is in `\\\\dscserver\\DscResources`.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Copy-CDscResource -Path 'C:\\Projects\\DscResources' -Destination '\\\\dscserver\\DscResources'
Demonstrates how to copy a directory of resources. Only files in the directory are copied. Every file in the
source must have a `.checksum` file. Only files whose checksums are different between source and destination will
be copied.
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Copy-CDscResource -Path 'C:\\Projects\\DscResources' -Destination '\\\\dscserver\\DscResources' -Recurse
Demonstrates how to recursively copy files.
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>Copy-CDscResource -Path 'C:\\Projects\\DscResources' -Destination '\\\\dscserver\\DscResources' -Force
Demonstrates how to copy all files, even if their `.checksum` files are the same.
-------------------------- EXAMPLE 5 --------------------------
PS C:\\>Copy-CDscResource -Path 'C:\\Projects\\DscResources' -Destination '\\\\dscserver\\DscResources' -PassThru
Demonstrates how to get `System.IO.FileInfo` objects for all resources copied to the destination. If all files are
up-to-date, nothing is copied, and no objects are returned.
RELATED LINKS
SYNOPSIS
Copies DSC resources.
SYNTAX
Copy-CDscResource [-Path] <String> [-Destination] <String> [-Recurse] [-PassThru] [-Force] [<CommonParameters>]
DESCRIPTION
This function copies a DSC resource or a directory of DSC resources to a DSC pull server share/website. All files
under `$Path` are copied.
DSC requires all files have a checksum file (e.g. `localhost.mof.checksum`), which this function generates for you
(in a temporary location).
Only new files, or files whose checksums have changed, are copied. You can force all files to be copied with the
`Force` switch.
`Copy-CDscResource` is new in Carbon 2.0.
PARAMETERS
-Path <String>
The path to the DSC resource to copy. If a directory is given, all files in that directory are copied.
Wildcards supported.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Destination <String>
The directory where the resources should be copied.
Required? true
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Recurse [<SwitchParameter>]
Recursively copy files from the source directory.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-PassThru [<SwitchParameter>]
Returns `IO.FileInfo` objects for each item copied to `Destination`.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-Force [<SwitchParameter>]
Copy resources, even if they are the same on the destination server.
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
System.IO.FileInfo
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Copy-CDscResource -Path 'localhost.mof' -Destination '\\\\dscserver\\DscResources'
Demonstrates how to copy a single resource to a resources SMB share. `localhost.mof` will only be copied if its
checksum is different than what is in `\\\\dscserver\\DscResources`.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Copy-CDscResource -Path 'C:\\Projects\\DscResources' -Destination '\\\\dscserver\\DscResources'
Demonstrates how to copy a directory of resources. Only files in the directory are copied. Every file in the
source must have a `.checksum` file. Only files whose checksums are different between source and destination will
be copied.
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Copy-CDscResource -Path 'C:\\Projects\\DscResources' -Destination '\\\\dscserver\\DscResources' -Recurse
Demonstrates how to recursively copy files.
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>Copy-CDscResource -Path 'C:\\Projects\\DscResources' -Destination '\\\\dscserver\\DscResources' -Force
Demonstrates how to copy all files, even if their `.checksum` files are the same.
-------------------------- EXAMPLE 5 --------------------------
PS C:\\>Copy-CDscResource -Path 'C:\\Projects\\DscResources' -Destination '\\\\dscserver\\DscResources' -PassThru
Demonstrates how to get `System.IO.FileInfo` objects for all resources copied to the destination. If all files are
up-to-date, nothing is copied, and no objects are returned.
RELATED LINKS