Skip to content

Commit 0cfebe0

Browse files
committed
Bug 1824431
Error reads as below when a directory is input: PS C:\> $Out = Get-AzureSiteRecoveryRecoveryPlanFile -Path C:\Windows -RecoveryPlan $RPList[0] Get-AzureSiteRecoveryRecoveryPlanFile : Operation failed. The input path is a directory. Please provide file path. Check the examples of commandlets Parameter name: Path At line:1 char:8 + $Out = Get-AzureSiteRecoveryRecoveryPlanFile -Path C:\Windows -RecoveryPlan $RPL ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [Get-AzureSiteRecoveryRecoveryPlanFile], Exception + FullyQualifiedErrorId : Microsoft.Azure.Commands.RecoveryServices.GetAzureSiteRecoveryRecoveryPlanFile
1 parent d8adffa commit 0cfebe0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Service/GetAzureSiteRecoveryRecoveryPlanFile.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
using System;
1616
using System.Collections.Generic;
17+
using System.IO;
1718
using System.Management.Automation;
1819
using Microsoft.Azure.Commands.RecoveryServices.SiteRecovery;
1920
using Microsoft.WindowsAzure.Management.SiteRecovery.Models;
@@ -79,7 +80,12 @@ public override void ExecuteCmdlet()
7980
/// </summary>
8081
private void GetRecoveryPlanFile()
8182
{
82-
RecoveryPlanXmlOuput recoveryPlanXmlOuput =
83+
if (Directory.Exists(this.Path))
84+
{
85+
throw new ArgumentException("The input path is a directory. Please provide file path. Check the examples of the commandlet", "Path");
86+
}
87+
88+
RecoveryPlanXmlOuput recoveryPlanXmlOuput =
8389
RecoveryServicesClient.GetAzureSiteRecoveryRecoveryPlanFile(this.Id);
8490
System.IO.File.WriteAllText(this.Path, recoveryPlanXmlOuput.RecoveryPlanXml);
8591
}

0 commit comments

Comments
 (0)