File tree Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Original file line number Diff line number Diff line change 300
300
Stop-PSFFunction - Message " Please supply a database to create an image for" - Target $SourceSqlInstance - Continue
301
301
}
302
302
303
- # Check if Hyper-V is enabled
304
- if (-not (Test-PSDCHyperVEnabled - HostName $uriHost - Credential $DestinationCredential )) {
305
- Stop-PSFFunction - Message " Hyper-V is not enabled on the host." - ErrorRecord $_ - Target $uriHost
306
- return
307
- }
308
-
309
303
# Set time stamp
310
304
$timestamp = Get-Date - format " yyyyMMddHHmmss"
311
305
500
494
$restore = Restore-DbaDatabase - SqlInstance $DestinationSqlInstance - SqlCredential $DestinationSqlCredential `
501
495
- DatabaseName $tempDbName - Path $lastFullBackup `
502
496
- DestinationDataDirectory $imageDataFolder `
503
- - DestinationLogDirectory $imageLogFolder
497
+ - DestinationLogDirectory $imageLogFolder - WithReplace
504
498
}
505
499
catch {
506
500
Stop-PSFFunction - Message " Couldn't restore database $db as $tempDbName on $DestinationSqlInstance " - Target $restore - ErrorRecord $_ - Continue
526
520
# Check if computer is local
527
521
if ($computer.IsLocalhost ) {
528
522
# Dismount the VHD
529
- $null = Dismount-VHD - Path $vhdPath
523
+ $null = Dismount-DiskImage - ImagePath $vhdPath
530
524
531
525
# Remove the access path
532
526
$null = Remove-Item - Path $accessPath - Force
533
527
}
534
528
else {
535
- $command = [ScriptBlock ]::Create(" Dismount-VHD -Path $vhdPath " )
529
+ $command = [ScriptBlock ]::Create(" Dismount-DiskImage -ImagePath $vhdPath " )
536
530
$null = Invoke-PSFCommand - ComputerName $computer - ScriptBlock $command - Credential $DestinationCredential
537
531
538
532
$command = [ScriptBlock ]::Create(" Remove-Item -Path $accessPath -Force" )
You can’t perform that action at this time.
0 commit comments