1 réponse
- Le plus récent
- Le plus de votes
- La plupart des commentaires
0
What is your use case. Could you please brief on the same. I am guessing that the powershell output is enabling pagination which is causing you to see only 50 records. Please check if you are getting a nexttoken
in your reponse. Output Pagination with AWS Tools for PowerShell
I havent tested this code, let me know if this works:
# Get the account ID $account_id = Get-Account # Get the first page of results $results = Get-MgnSourceServer -AccountId $account_id -MaxResults 100 # Loop through the results while ($results.Count -gt 0) { # Get the current page of results foreach ($source_server in $results) { Write-Host $source_server } # Get the next page of results $results = Get-MgnSourceServer -AccountId $account_id -MaxResults 100 -NextToken $results.NextToken }
You may try out some of the below steps if it works for you:
- In case of powershell, total number of items to return in the command's output could be controlled by using the parameter
-MaxResult <Int32>
- If your command result returns more than the value defined for
MaxResults
, then you would need to use the parameter-NextToken
to fetch the next set of records. - You may also try the AWS CLI
describe-source-servers
with options like--no-paginate
or--max-items
- You may try the AWS API documentation for
DescribeSourceServers
with request bodymaxResults
ornextToken
Let me know if this helps you.
Contenus pertinents
- demandé il y a un an
- demandé il y a 7 mois
- demandé il y a un an
- demandé il y a un an
- AWS OFFICIELA mis à jour il y a 2 ans
- AWS OFFICIELA mis à jour il y a un an
- AWS OFFICIELA mis à jour il y a un an
Hi Vijesh, thanks for the suggestion. I have tried the -NextToken option, however it didn't work, it keep on fetch the same 50 records every time. Since there is no fix found for the Powershell module, I am going to continue with the AWS CLI, which is fetching all the source Servers. Thanks for suggesting the AWS CLI.