|
259 | 259 | $availableMB = (Get-PSDrive -Name $ImageLocalPath.Substring(0, 1)).Free / 1MB |
260 | 260 | } |
261 | 261 | else { |
262 | | - $command = [ScriptBlock]::Create("(Get-PSDrive -Name $($ImageLocalPath).Substring(0, 1)).Free / 1MB") |
263 | | - $ImageLocalPath = Invoke-PSFCommand -ComputerName $computer -ScriptBlock $commandGetLocalPath -Credential $DestinationCredential |
| 262 | + $command = [ScriptBlock]::Create("(Get-PSDrive -Name $($ImageLocalPath.Substring(0, 1)) ).Free / 1MB") |
| 263 | + $availableMB = Invoke-PSFCommand -ComputerName $computer -ScriptBlock $commandGetLocalPath -Credential $DestinationCredential |
264 | 264 | } |
265 | 265 |
|
266 | 266 | $dbSizeMB = $db.Size |
|
303 | 303 | $null = New-PSDCVhdDisk -Destination $imagePath -FileName "$imageName.vhdx" |
304 | 304 | } |
305 | 305 | else { |
306 | | - $command = [ScriptBlock]::Create("$null = New-PSDCVhdDisk -Destination $imagePath -FileName '$imageName.vhdx'") |
| 306 | + $command = [ScriptBlock]::Create("New-PSDCVhdDisk -Destination $imagePath -FileName '$imageName.vhdx'") |
307 | 307 | $null = Invoke-PSFCommand -ComputerName $computer -ScriptBlock $command -Credential $DestinationCredential |
308 | 308 | } |
309 | 309 |
|
|
321 | 321 | $diskResult = Initialize-PSDCVhdDisk -Path $vhdPath -Credential $DestinationCredential |
322 | 322 | } |
323 | 323 | else { |
324 | | - $command = [ScriptBlock]::Create("Initialize-PSDCVhdDisk -Path $vhdPath -Credential $DestinationCredential") |
| 324 | + $command = [ScriptBlock]::Create("Initialize-PSDCVhdDisk -Path $vhdPath") |
325 | 325 | $diskResult = Invoke-PSFCommand -ComputerName $computer -ScriptBlock $command -Credential $DestinationCredential |
326 | 326 | } |
327 | 327 | } |
|
337 | 337 | try { |
338 | 338 | # Check if computer is local |
339 | 339 | if ($computer.IsLocalhost) { |
340 | | - $null = New-Item -Path $accessPath -ItemType Directory -Force:$Force |
| 340 | + $null = New-Item -Path $accessPath -ItemType Directory -Force |
341 | 341 | } |
342 | 342 | else { |
343 | | - $command = [ScriptBlock]::Create("New-Item -Path $accessPath -ItemType Directory -Force:$Force") |
| 343 | + $command = [ScriptBlock]::Create("New-Item -Path $accessPath -ItemType Directory -Force") |
344 | 344 | $null = Invoke-PSFCommand -ComputerName $computer -ScriptBlock $command -Credential $DestinationCredential |
345 | 345 | } |
346 | 346 | } |
|
358 | 358 | $null = Add-PartitionAccessPath -DiskNumber $disk.Number -PartitionNumber $partition[1].PartitionNumber -AccessPath $accessPath -ErrorAction SilentlyContinue |
359 | 359 | } |
360 | 360 | else { |
361 | | - $command = [ScriptBlock]::Create("Add-PartitionAccessPath -DiskNumber $disk.Number -PartitionNumber $partition[1].PartitionNumber -AccessPath $accessPath -ErrorAction SilentlyContinue") |
| 361 | + $command = [ScriptBlock]::Create("Add-PartitionAccessPath -DiskNumber $($disk.Number) -PartitionNumber $($partition[1].PartitionNumber) -AccessPath $accessPath -ErrorAction SilentlyContinue") |
362 | 362 | $null = Invoke-PSFCommand -ComputerName $computer -ScriptBlock $command -Credential $DestinationCredential |
363 | 363 | } |
364 | 364 |
|
|
0 commit comments