Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/Commands/Base/PnPConnectedCmdlet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ protected override void ProcessRecord()
throw new PSInvalidOperationException(errorMessage);
}

Connection.RestoreCachedContext(Connection.Url);
if (Connection.Context.Url != Connection.Url)
{
Connection.RestoreCachedContext(Connection.Url);
}

// With ErrorAction:Ignore, the $Error variable should not be populated with the error, otherwise it should
if (!ParameterSpecified("ErrorAction") || !(new[] { "ignore" }.Contains(MyInvocation.BoundParameters["ErrorAction"].ToString().ToLowerInvariant())))
Expand Down