<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Running python script with windows task scheduler and ArcGIS Server python environment in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/running-python-script-with-windows-task-scheduler/m-p/1200169#M7610</link>
    <description>&lt;P&gt;I would use a python environment manager like &lt;STRONG&gt;conda &lt;/STRONG&gt;to create a separate environment for running automated scripts. Then you can have a &lt;STRONG&gt;.bat &lt;/STRONG&gt;script that calls conda, activates the particular environment you need, and runs your script.&lt;/P&gt;&lt;P&gt;We have about half a dozen scripts that run this way every night, and we can literally use those same scripts on any machine. You'll want to look at authentication strategies with the Python API. There's even one &lt;A href="https://developers.arcgis.com/python/guide/working-with-different-authentication-schemes/#web-tier-authentication-secured-with-iwa" target="_blank"&gt;designed to work with IWA&lt;/A&gt;, though I've not used it myself.&lt;/P&gt;</description>
    <pubDate>Sun, 07 Aug 2022 01:13:04 GMT</pubDate>
    <dc:creator>jcarlson</dc:creator>
    <dc:date>2022-08-07T01:13:04Z</dc:date>
    <item>
      <title>Running python script with windows task scheduler and ArcGIS Server python environment</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/running-python-script-with-windows-task-scheduler/m-p/1200163#M7609</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Background technical info:&amp;nbsp;&lt;/STRONG&gt;&amp;nbsp;We have a 10.6 or 10.9.1 ArcGIS Enterprise Installation (we are in the process of migrating so I have both available), IWA, and a requirement to use gMSA accounts to run the arcgis server windows service. Our arcgis pro licenses are managed by named users through arcgis online.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to understand if there's a way to run a scheduled script using windows task manager, without the need of an arcgis pro license. It seems like standard documentation online requires pointing to the arcgis pro-environment:&amp;nbsp;&lt;/P&gt;&lt;P&gt;"&lt;SPAN&gt;C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe&lt;/SPAN&gt;"&lt;/P&gt;&lt;P&gt;However, this requires (1) installing arcgis pro on our production server (2) running the windows task as a user that has also logged in to arcgis pro with a valid license (named user via arcgis online). I prefer not to go down that road since I don't want to use one of our arcgis pro licenses on this user.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, we moved to using the arcgis server's python environment instead:&lt;/P&gt;&lt;P&gt;"C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\bin\Python\envs\arcgispro-py3\python.exe"&lt;/P&gt;&lt;P&gt;However I'm finding no documentation to support this workflow. Also, it seems like going down this path only works if I run the task as the same gMSA user that runs the arcgis server windows service. Can any body confirm this??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Aug 2022 21:47:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/running-python-script-with-windows-task-scheduler/m-p/1200163#M7609</guid>
      <dc:creator>ChaimSchwartzIroads</dc:creator>
      <dc:date>2022-08-06T21:47:19Z</dc:date>
    </item>
    <item>
      <title>Re: Running python script with windows task scheduler and ArcGIS Server python environment</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/running-python-script-with-windows-task-scheduler/m-p/1200169#M7610</link>
      <description>&lt;P&gt;I would use a python environment manager like &lt;STRONG&gt;conda &lt;/STRONG&gt;to create a separate environment for running automated scripts. Then you can have a &lt;STRONG&gt;.bat &lt;/STRONG&gt;script that calls conda, activates the particular environment you need, and runs your script.&lt;/P&gt;&lt;P&gt;We have about half a dozen scripts that run this way every night, and we can literally use those same scripts on any machine. You'll want to look at authentication strategies with the Python API. There's even one &lt;A href="https://developers.arcgis.com/python/guide/working-with-different-authentication-schemes/#web-tier-authentication-secured-with-iwa" target="_blank"&gt;designed to work with IWA&lt;/A&gt;, though I've not used it myself.&lt;/P&gt;</description>
      <pubDate>Sun, 07 Aug 2022 01:13:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/running-python-script-with-windows-task-scheduler/m-p/1200169#M7610</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-08-07T01:13:04Z</dc:date>
    </item>
    <item>
      <title>Re: Running python script with windows task scheduler and ArcGIS Server python environment</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/running-python-script-with-windows-task-scheduler/m-p/1201570#M7625</link>
      <description>&lt;P&gt;Thank you Josh - even with a different environment I'd be facing the same question - which user do I need the task to run with, in order to be able to run python api?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2022 20:36:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/running-python-script-with-windows-task-scheduler/m-p/1201570#M7625</guid>
      <dc:creator>ChaimSchwartzIroads</dc:creator>
      <dc:date>2022-08-10T20:36:25Z</dc:date>
    </item>
    <item>
      <title>Re: Running python script with windows task scheduler and ArcGIS Server python environment</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/running-python-script-with-windows-task-scheduler/m-p/1201605#M7626</link>
      <description>&lt;P&gt;Well, it depends on what you're doing with the script. You can authenticate with the API using a named user, and the script would then have access to anything that user does. So an anonymous user could access any public layers and apps, but be unable to change anything, whereas an admin would be able to access and edit anything.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2022 21:23:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/running-python-script-with-windows-task-scheduler/m-p/1201605#M7626</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-08-10T21:23:39Z</dc:date>
    </item>
    <item>
      <title>Re: Running python script with windows task scheduler and ArcGIS Server python environment</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/running-python-script-with-windows-task-scheduler/m-p/1201619#M7627</link>
      <description>&lt;P&gt;Hi Josh, perhaps I wasn't being clear: my question is in regards to the user that the task is run as in windows task manager (not the arcgis user to connect to the portal). Windows task manager requires running the task as an admin user in order to be able to run the task whether the user is logged in or not.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2022 21:41:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/running-python-script-with-windows-task-scheduler/m-p/1201619#M7627</guid>
      <dc:creator>ChaimSchwartzIroads</dc:creator>
      <dc:date>2022-08-10T21:41:23Z</dc:date>
    </item>
  </channel>
</rss>

