From 6a50ee84b739e01009bc96c51beb33bf3dabbffe Mon Sep 17 00:00:00 2001 From: Timothy Wamalwa Date: Wed, 27 Apr 2022 01:21:46 +0300 Subject: [PATCH] Set the default page size to MaxPagesize to enable pagination as opposed the default 100 items returned when the argument "-All" is provided --- tools/Custom/ListCmdlet.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/Custom/ListCmdlet.cs b/tools/Custom/ListCmdlet.cs index 13660faf15f..f5367f3e881 100644 --- a/tools/Custom/ListCmdlet.cs +++ b/tools/Custom/ListCmdlet.cs @@ -107,7 +107,17 @@ public void InitializeCmdlet(ref global::System.Management.Automation.Invocation limit = top; } - int currentPageSize = invocationInfo.BoundParameters.ContainsKey("PageSize") ? PageSize : DefaultPageSize; + int currentPageSize = DefaultPageSize; + if(invocationInfo.BoundParameters.ContainsKey("PageSize")) + { + currentPageSize = PageSize; + } + + if(invocationInfo.BoundParameters.ContainsKey("All")) + { + currentPageSize = MaxPageSize; + } + if (invocationInfo.BoundParameters.ContainsKey("Top") && limit < currentPageSize) { currentPageSize = limit;