To change the maximum results that a query yields:
  1. Open the web.config files on the CRM web servers. 
  2. Find the <appsettings> section of the file
  3.  Add the following line and save the web.config file:
<add key="WebShellAdHocQueryExportMaxRows" value="500000" />