0

I want manual pagination for PowerShell commands for SharePoint such as Get-SPUser or Get-SPSite. I know there is command viz. Out-Host -paging facility available but it is not manual pagination i.e. it does not take argument of pageSize=30. I want a facility of taking this argument of pageSize so that it will display those many records ( in this case say 30 ) per page.

-Limit parameter does not take range like (0..10) or (10..20) so it is also not useful

Can anybody help how to accomplish manual pagination for PowerShell ?

2 Answers 2

0

Out of the box you can use more or out-host. In both cases we won't be able to set number of items to be displayed.

In your case you can try storing the items in an Array object and then iterate it based on your page length.

0

Yes. There is manual pagination available by select-object command as follows

Get-SPUser -web <siteCollectionURL> | select-object -Index (0..10)

This command will produce first 10 users in site collection

(0..10) refers to range i.e. from index 0 to 10

Thus one can achieve manual pagination by playing with indices using -Index parameter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.