@@ -126,13 +126,15 @@ function New-PDCClone {
126126 Write-PSFMessage - Message " Started image creation" - Level Verbose
127127
128128 # Make up the data from the network path
129- try {
130- [uri ]$uri = New-Object System.Uri($Destination )
131- $uriHost = $uri.Host
132- }
133- catch {
134- Stop-PSFFunction - Message " The destination path $Destination is not valid" - ErrorRecord $_ - Target $Destination
135- return
129+ if ($Destination.StartsWith (" \\" )) {
130+ try {
131+ [uri ]$uri = New-Object System.Uri($Destination )
132+ $uriHost = $uri.Host
133+ }
134+ catch {
135+ Stop-PSFFunction - Message " The destination path $Destination is not valid" - ErrorRecord $_ - Target $Destination
136+ return
137+ }
136138 }
137139
138140 # Setup the computer object
@@ -310,10 +312,9 @@ function New-PDCClone {
310312 try {
311313 # Get the partition based on the disk
312314 $partition = Get-Partition - Disk $disk
313- $partition
315+
314316 # Create an access path for the disk
315- # $null = Add-PartitionAccessPath -DiskNumber $disk.Number -PartitionNumber $partition[1].PartitionNumber -AccessPath $accessPath -ErrorAction Ignore
316- $null = Add-PartitionAccessPath - DiskNumber $disk.Number - PartitionNumber 2 - AccessPath $accessPath - ErrorAction Ignore
317+ $null = Add-PartitionAccessPath - DiskNumber $disk.Number - PartitionNumber $partition [1 ].PartitionNumber - AccessPath $accessPath - ErrorAction Ignore
317318 }
318319 catch {
319320 Stop-PSFFunction - Message " Couldn't create access path for partition" - ErrorRecord $_ - Target $partition - Continue
@@ -327,7 +328,7 @@ function New-PDCClone {
327328
328329 # Loop through each of the database files and add them to the file structure
329330 foreach ($dbFile in $databaseFiles ) {
330- $dbFileStructure.Add ($dbFile.FullName )
331+ $null = $ dbFileStructure.Add ($dbFile.FullName )
331332 }
332333
333334 # Mount the database
@@ -448,8 +449,6 @@ function New-PDCClone {
448449 Stop-PSFFunction - Message " Image couldn't be found" - Target $imageName - Continue
449450 }
450451
451-
452-
453452 # Add the results to the custom object
454453 [PSCustomObject ]@ {
455454 ImageID = $imageId
0 commit comments