Skip to content

Commit 9aeb990

Browse files
committed
Changed function to retrieve config value. Added hyper-v check.
1 parent 0fa603b commit 9aeb990

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

functions/New-PSDCClone.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
$pdcSqlInstance = Get-PSFConfigValue -FullName psdatabaseclone.database.Server
116116
$pdcDatabase = Get-PSFConfigValue -FullName psdatabaseclone.database.name
117117
if (-not $PSDCSqlCredential) {
118-
$pdcCredential = Get-PSFConfig -FullName psdatabaseclone.database.credential -Fallback $null
118+
$pdcCredential = Get-PSFConfigValue -FullName psdatabaseclone.database.credential -Fallback $null
119119
}
120120
else{
121121
$pdcCredential = $PSDCSqlCredential
@@ -157,6 +157,11 @@
157157
Stop-PSFFunction -Message "Could not connect to Sql Server instance $SqlInstance" -ErrorRecord $_ -Target $SqlInstance
158158
}
159159

160+
# Check if Hyper-V enabled for the SQL instance
161+
if (-not (Test-PSDCHyperVEnabled -HostName $server.Name -Credential $Credential)) {
162+
Stop-PSFFunction -Message "Hyper-V is not enabled on the remote host." -ErrorRecord $_ -Target $uriHost -Continue
163+
}
164+
160165
# Setup the computer object
161166
$computer = [PsfComputer]$server.Name
162167

0 commit comments

Comments
 (0)