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 300300 Stop-PSFFunction - Message " Please supply a database to create an image for" - Target $SourceSqlInstance - Continue
301301 }
302302
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-
309303 # Set time stamp
310304 $timestamp = Get-Date - format " yyyyMMddHHmmss"
311305
500494 $restore = Restore-DbaDatabase - SqlInstance $DestinationSqlInstance - SqlCredential $DestinationSqlCredential `
501495 - DatabaseName $tempDbName - Path $lastFullBackup `
502496 - DestinationDataDirectory $imageDataFolder `
503- - DestinationLogDirectory $imageLogFolder
497+ - DestinationLogDirectory $imageLogFolder - WithReplace
504498 }
505499 catch {
506500 Stop-PSFFunction - Message " Couldn't restore database $db as $tempDbName on $DestinationSqlInstance " - Target $restore - ErrorRecord $_ - Continue
526520 # Check if computer is local
527521 if ($computer.IsLocalhost ) {
528522 # Dismount the VHD
529- $null = Dismount-VHD - Path $vhdPath
523+ $null = Dismount-DiskImage - ImagePath $vhdPath
530524
531525 # Remove the access path
532526 $null = Remove-Item - Path $accessPath - Force
533527 }
534528 else {
535- $command = [ScriptBlock ]::Create(" Dismount-VHD -Path $vhdPath " )
529+ $command = [ScriptBlock ]::Create(" Dismount-DiskImage -ImagePath $vhdPath " )
536530 $null = Invoke-PSFCommand - ComputerName $computer - ScriptBlock $command - Credential $DestinationCredential
537531
538532 $command = [ScriptBlock ]::Create(" Remove-Item -Path $accessPath -Force" )
You can’t perform that action at this time.
0 commit comments