Код:
![Выделить весь код](images/misc/selectcode.png)
$sSourceFile = "\\Server\Share\SomeFile.iso"
$sDestPath = "c:\Temp"
if(Test-Path -Path $sSourceFile -PathType Leaf) {
if(Test-Path -Path $sDestPath -PathType Container) {
$sStartTime = Get-Date
Copy-Item -Path $sSourceFile -Destination $sDestPath -Force
(New-TimeSpan -Start $sStartTime -End (Get-Date)).ToString()
} else {
Write-Host "Destination path [$sDestPath] not found." -ForegroundColor Red
}
} else {
Write-Host "Source file [$sSourceFile] not found." -ForegroundColor Red
}