File tree Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change 360
360
$command = [ScriptBlock ]::Create(" New-VHD -ParentPath $ParentVhd -Path `" $Destination \$CloneName .vhdx`" -Differencing" )
361
361
$vhd = Invoke-PSFCommand - ComputerName $computer - ScriptBlock $command - Credential $Credential
362
362
363
- if (-not $vhd ){
363
+ if (-not $vhd ) {
364
364
return
365
365
}
366
366
}
562
562
FQDN = $fqdn
563
563
}
564
564
565
+ # Test if the JSON folder can be reached
566
+ if (-not (Test-Path - Path " PSDCJSONFolder:\" )) {
567
+ $command = [scriptblock ]::Create(" Import-Module PSDatabaseClone -Force" )
568
+
569
+ try {
570
+ Invoke-PSFCommand - ComputerName $computer - ScriptBlock $command - Credential $Credential
571
+ }
572
+ catch {
573
+ Stop-PSFFunction - Message " Couldn't import module remotely" - Target $command
574
+ return
575
+ }
576
+ }
577
+
565
578
# Setup the json file
566
579
$jsonHostFile = " PSDCJSONFolder:\hosts.json"
567
580
668
681
IsEnabled = $active
669
682
}
670
683
684
+ # Test if the JSON folder can be reached
685
+ if (-not (Test-Path - Path " PSDCJSONFolder:\" )) {
686
+ $command = [scriptblock ]::Create(" Import-Module PSDatabaseClone -Force" )
687
+
688
+ try {
689
+ Invoke-PSFCommand - ComputerName $computer - ScriptBlock $command - Credential $Credential
690
+ }
691
+ catch {
692
+ Stop-PSFFunction - Message " Couldn't import module remotely" - Target $command
693
+ return
694
+ }
695
+ }
696
+
671
697
# Set the clone file
672
698
$jsonCloneFile = " PSDCJSONFolder:\clones.json"
673
699
Original file line number Diff line number Diff line change 578
578
CreatedOn = (Get-Date - format " yyyyMMddHHmmss" )
579
579
}
580
580
581
+ # Test if the JSON folder can be reached
582
+ if (-not (Test-Path - Path " PSDCJSONFolder:\" )) {
583
+ $command = [scriptblock ]::Create(" Import-Module PSDatabaseClone -Force" )
584
+
585
+ try {
586
+ Invoke-PSFCommand - ComputerName $computer - ScriptBlock $command - Credential $Credential
587
+ }
588
+ catch {
589
+ Stop-PSFFunction - Message " Couldn't import module remotely" - Target $command
590
+ return
591
+ }
592
+ }
593
+
581
594
# Set the image file
582
595
$jsonImageFile = " PSDCJSONFolder:\images.json"
583
596
You can’t perform that action at this time.
0 commit comments