[CmdletBinding(SupportsShouldProcess)] param( [Parameter(Mandatory)][string]$Source, [Parameter(Mandatory)][string]$Destination ) $ErrorActionPreference = 'Stop' if (-not (Test-Path -LiteralPath $Source -PathType Leaf)) { throw 'Source workbook is missing.' } if (Test-Path -LiteralPath $Destination) { throw 'Destination exists; choose a new file path.' } if ($PSCmdlet.ShouldProcess($Destination, 'Copy workbook')) { [IO.File]::Copy([IO.Path]::GetFullPath($Source), [IO.Path]::GetFullPath($Destination), $false) }