<?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: Python: how can I run a system command as administrator and capture the command output? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-how-can-i-run-a-system-command-as/m-p/704913#M54548</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't have it, don't use it, but I always recommending checking out versions and version history&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pypi.python.org/pypi/psutil/1.2.1" title="https://pypi.python.org/pypi/psutil/1.2.1"&gt;psutil 1.2.1 : Python Package Index&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pythonhosted.org/psutil/" title="https://pythonhosted.org/psutil/"&gt;https://pythonhosted.org/psutil/&lt;/A&gt;&amp;nbsp; and 'issues' usually can be found on github too&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://github.com/giampaolo/psutil/blob/master/INSTALL.rst" title="https://github.com/giampaolo/psutil/blob/master/INSTALL.rst"&gt;psutil/INSTALL.rst at master · giampaolo/psutil · GitHub&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;good luck&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 21 Oct 2016 02:42:53 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2016-10-21T02:42:53Z</dc:date>
    <item>
      <title>Python: how can I run a system command as administrator and capture the command output?  Not answered, but provided summary.</title>
      <link>https://community.esri.com/t5/python-questions/python-how-can-i-run-a-system-command-as/m-p/704912#M54547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Just to summarize what I need right away....&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Bottom line:&amp;nbsp; I need help running the "wmic" OS command or the "psutil.Process(&amp;lt;number&amp;gt;).cmdline()" with administrator credentials, in my script, capturing the output to a variable.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In what seems like an endless pursuit of discovering and dealing with .lock file preventing replacement of a full gdb, I've now narrowed it down to trying to discover the .lock files that are being created by an &lt;A href="https://community.esri.com/space/2100"&gt;ArcGIS for Server&lt;/A&gt;‌ gp service.&amp;nbsp; My script gives me a list of these .lock files named in this manner&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Servicename.SEERVERNAME.16716.11140.sr.lock&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;parcing this, I'm able to get the PID (process ID) 11256, in this case. With tech support help, using the Windows Task Manager "Processes" tab, and turning on the PID and "Command Line" columns (thru View-&amp;gt;Select Columns), I can see the service for the PID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tested a number of commands to try to capture this "Command Line" information so I can parse out the service I need to stop.&amp;nbsp; Some of these commands include "net file", "tasklist", "wcim", "psutil" (a python mod), fsmgmt.msc, and compmgmt.msc.&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The most promising of the OS commands is the wcim, but only if I can run it "As Administrator".&amp;nbsp; Testing it manually, in a cmd.exe window started as administrator, I get the fun "Command line" info.&amp;nbsp; Running in a non-admin cmd.exe window does not return the info (i.e. blank)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using psutil module also very promising, but returns an AccessDenied error when trying to return the cmdline info.&amp;nbsp; So I think that would work if I could pass-it or run-it with admin credentials.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="248909" alt="" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/248909_pastedImage_3.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what it should return is a long string that includes&amp;nbsp; "-Dservice=servicefolder.servicename.MapService"&amp;nbsp; (in this test case).&amp;nbsp; I want to grab the value for&amp;nbsp; -Dservice so I can stop it, therefore releasing the .lock files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm been researching and trying&amp;nbsp; subprocess (mainly...a few other found suggestions too), and have had no luck.&amp;nbsp; My script will have variables with valid user pass, but I do not know how to get this command to run properly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My preference would be getting the info using the psutil.cmdline()&amp;nbsp; for the PID.&amp;nbsp; But would also be happy if I could get&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;wmic process where "ProcessID = 11140" get CommandLine&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;with whichever saving the return string to a variable (then I can parse it myself).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Bottom line:&amp;nbsp; I need help running the "wmic" OS command or the "psutil.Process(&amp;lt;number&amp;gt;).cmdline()" with administrator credentials, in my script, capturing the output to a variable.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks to all you python gurus that want to take a shot at this.&amp;nbsp; If you have other suggestions for capturing the AGS service information base just on the .lock filename, within my script, I'm open to suggestions.&amp;nbsp;&amp;nbsp; I've already tagged the AGS group (near top), so maybe some ArcGIS Server administrators have a trick on where I can grab this info. (??)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BTW - Once I get my script running with all my .lock tests, I hope to summarize in a blog post or document.&amp;nbsp; not there yet.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Oct 2016 02:07:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-how-can-i-run-a-system-command-as/m-p/704912#M54547</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2016-10-21T02:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: Python: how can I run a system command as administrator and capture the command output?</title>
      <link>https://community.esri.com/t5/python-questions/python-how-can-i-run-a-system-command-as/m-p/704913#M54548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't have it, don't use it, but I always recommending checking out versions and version history&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pypi.python.org/pypi/psutil/1.2.1" title="https://pypi.python.org/pypi/psutil/1.2.1"&gt;psutil 1.2.1 : Python Package Index&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pythonhosted.org/psutil/" title="https://pythonhosted.org/psutil/"&gt;https://pythonhosted.org/psutil/&lt;/A&gt;&amp;nbsp; and 'issues' usually can be found on github too&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://github.com/giampaolo/psutil/blob/master/INSTALL.rst" title="https://github.com/giampaolo/psutil/blob/master/INSTALL.rst"&gt;psutil/INSTALL.rst at master · giampaolo/psutil · GitHub&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;good luck&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Oct 2016 02:42:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-how-can-i-run-a-system-command-as/m-p/704913#M54548</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-10-21T02:42:53Z</dc:date>
    </item>
    <item>
      <title>Re: Python: how can I run a system command as administrator and capture the command output?</title>
      <link>https://community.esri.com/t5/python-questions/python-how-can-i-run-a-system-command-as/m-p/704914#M54549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="text-decoration: line-through;"&gt;I assume you don't want to stop the GP service to clear the lock? &amp;nbsp;Are you able to delete the lock manually? &amp;nbsp;If not, then I doubt a script would be able to either.&lt;/SPAN&gt;&amp;nbsp; I see your other posts, seems like you're just finding that information to know which services to stop. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Googling, though, I came across this answer:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://windowsxp.mvps.org/listproc.htm" title="http://windowsxp.mvps.org/listproc.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;List all processes and their Command-line parameters&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WMIC PROCESS where 'caption="ArcSOC.exe"' get Caption,Commandline,Processid &amp;gt;&amp;nbsp;C:\arcsocprocesses.txt&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;returns all of them and&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WMIC PROCESS where 'ProcessID=39280' get Caption,Commandline,Processid &amp;gt; C:\pid39280.txt&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;returns the process with ID 39280. &amp;nbsp;I use subprocess for most Windows commands in Python, and by adding this in and parsing the results, you can pick out the service name:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="249258" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/249258_pastedImage_4.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; subprocess
result &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; subprocess&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;check_output&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"WMIC PROCESS where 'ProcessID=381960' get Caption,Commandline,Processid"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; line &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; result&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"\n"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
 &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"-Dservice="&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; line&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
 serviceName &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; line&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"-Dservice="&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;" \""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
 &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;serviceName&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:37:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-how-can-i-run-a-system-command-as/m-p/704914#M54549</guid>
      <dc:creator>JonathanQuinn</dc:creator>
      <dc:date>2021-12-12T05:37:41Z</dc:date>
    </item>
    <item>
      <title>Re: Python: how can I run a system command as administrator and capture the command output?</title>
      <link>https://community.esri.com/t5/python-questions/python-how-can-i-run-a-system-command-as/m-p/704915#M54550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Easiest way is to just run the entire python script with Admin privileges. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Oct 2016 21:13:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-how-can-i-run-a-system-command-as/m-p/704915#M54550</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2016-10-21T21:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: Python: how can I run a system command as administrator and capture the command output?</title>
      <link>https://community.esri.com/t5/python-questions/python-how-can-i-run-a-system-command-as/m-p/704916#M54551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, I was out with the flu for a while, and this got lost in my emails.&amp;nbsp; Just looking back at this now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I like where you where heading with this &lt;A href="https://community.esri.com/migrated-users/16548"&gt;Jonathan Quinn&lt;/A&gt; , but unfortunately, it still drops the critical infomartion from the WMIC if I am not running it as an administrator.&amp;nbsp; I'm not sure how well this will look, but running is in the command window....&lt;/P&gt;&lt;P&gt;first showing the Run-As-Administrator window, ..... I've removed a bunch of paths to .jar files to clean it up a little (otherwise very long)....&amp;nbsp; Trying to sort it out, I've added colors&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800080;"&gt;the headers&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #000000;"&gt;most of the values&amp;nbsp;&amp;nbsp; &lt;SPAN style="text-decoration: underline; font-size: 22px;"&gt;&lt;STRONG style="color: #ff0000; text-decoration: underline;"&gt;and the part I need&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &lt;/STRONG&gt;&lt;SPAN style="color: #808080;"&gt;C:\Windows\system32&amp;gt;&lt;/SPAN&gt;&lt;STRONG&gt;wmic PROCESS where 'ProcessID=892'&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN style="color: #800080;"&gt;Caption&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CommandLine&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800080;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CreationClassName&amp;nbsp; CreationDate&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CSCreationClassName&amp;nbsp;&amp;nbsp; CSName&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #800080;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Description&amp;nbsp; ExecutablePath&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ExecutionSt&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #800080;"&gt;ate&amp;nbsp; Handle&amp;nbsp; HandleCount&amp;nbsp; InstallDate&amp;nbsp; KernelModeTime&amp;nbsp; MaximumWorkingSetSize&amp;nbsp; Mi&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #800080;"&gt;nimumWorkingSetSize&amp;nbsp; Name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OSCreationClassName&amp;nbsp;&amp;nbsp;&amp;nbsp; OSName&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #800080;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OtherOperationCoun&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #800080;"&gt;t&amp;nbsp; OtherTransferCount&amp;nbsp; PageFaults&amp;nbsp; PageFileUsage&amp;nbsp; ParentProcessId&amp;nbsp; PeakPageFileU&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #800080;"&gt;sage&amp;nbsp; PeakVirtualSize&amp;nbsp; PeakWorkingSetSize&amp;nbsp; Priority&amp;nbsp; PrivatePageCount&amp;nbsp; ProcessId&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #800080;"&gt;&amp;nbsp; QuotaNonPagedPoolUsage&amp;nbsp; QuotaPagedPoolUsage&amp;nbsp; QuotaPeakNonPagedPoolUsage&amp;nbsp; Quota&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #800080;"&gt;PeakPagedPoolUsage&amp;nbsp; ReadOperationCount&amp;nbsp; ReadTransferCount&amp;nbsp; SessionId&amp;nbsp; Status&amp;nbsp; Te&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #800080;"&gt;rminationDate&amp;nbsp; ThreadCount&amp;nbsp; UserModeTime&amp;nbsp; VirtualSize&amp;nbsp; WindowsVersion&amp;nbsp; WorkingSe&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #800080;"&gt;tSize&amp;nbsp; WriteOperationCount&amp;nbsp; WriteTransferCount&lt;/SPAN&gt;&lt;BR /&gt;ArcSOC.exe&amp;nbsp; "C:\Program Files\ArcGIS\Server\bin\ArcSOC.exe" -XX:-CreateMinidumpOnCrash -Xmx64M &lt;SPAN style="text-decoration: underline; font-size: 22px;"&gt;&lt;STRONG&gt;&lt;SPAN style="color: #ff0000; text-decoration: underline;"&gt;-Dservice=wc_public.GMUSubunits.MapServer&lt;/SPAN&gt; &lt;/STRONG&gt;&lt;/SPAN&gt;"-Djava.class.path=C:\Program Files\ArcGIS\Server\framework\lib\server\arcgis-admin.jar; &lt;STRONG&gt;.......bunch of stuff here&lt;/STRONG&gt;" -Djava.security.policy=file:/C:/Program%20Files/ArcGIS/Server/framework/etc/arcsoc.policy "-Djava.rmi.server.codebase=file:/C:/Program%20Files/ArcGIS/&lt;BR /&gt;Server/framework/lib/server/arcgis-servicelib.jar file:/C:/Program%20Files/ArcGIS/Server/framework/lib/server/arcgis-common.jar " sun.rmi.server.ActivationGroupInit&amp;nbsp; Win32_Process&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20161122000020.890422-540&amp;nbsp; Win32_ComputerSystem&amp;nbsp; DFGANCGISDEV3&amp;nbsp; ArcSOC.exe&amp;nbsp;&amp;nbsp; C:\Program Files\ArcGIS\Server\bin\ArcSOC.exe&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 892&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 962&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 28750000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1380&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 200&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ArcSOC.exe&amp;nbsp; Win32_OperatingSystem&amp;nbsp; Microsoft Windows Server 2008 R2 Enterprise |C:\Windows|\Device\Harddisk0\Partition2&amp;nbsp; 115308&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;....bunch of numbers at the end...&lt;/STRONG&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then as a regular command window...&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;H:\&amp;gt;&lt;STRONG&gt;wmic PROCESS where 'ProcessID=892'&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN style="color: #800080;"&gt;Caption CommandLine CreationClassName CreationDate CSCreatio&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #800080;"&gt;nClassName CSName Description ExecutablePath ExecutionState Handle&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #800080;"&gt; HandleCount InstallDate KernelModeTime MaximumWorkingSetSize MinimumWorking&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #800080;"&gt;SetSize Name OSCreationClassName OSName&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #800080;"&gt; OtherOperationCount OtherTran&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #800080;"&gt;sferCount PageFaults PageFileUsage ParentProcessId PeakPageFileUsage PeakVi&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #800080;"&gt;rtualSize PeakWorkingSetSize Priority PrivatePageCount ProcessId QuotaNonPa&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #800080;"&gt;gedPoolUsage QuotaPagedPoolUsage QuotaPeakNonPagedPoolUsage QuotaPeakPagedPoo&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #800080;"&gt;lUsage ReadOperationCount ReadTransferCount SessionId Status TerminationDat&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #800080;"&gt;e ThreadCount UserModeTime VirtualSize WindowsVersion WorkingSetSize Write&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #800080;"&gt;OperationCount WriteTransferCount&lt;/SPAN&gt;&lt;BR /&gt;ArcSOC.exe Win32_Process 20161122000020.890422-540 Win32_Com&lt;BR /&gt;puterSystem DFGANCGISDEV3 ArcSOC.exe 892&lt;BR /&gt; 962 28750000&lt;BR /&gt; ArcSOC.exe Win32_OperatingSystem Microsoft Windows Server 2008 R2 Ent&lt;BR /&gt;erprise |C:\Windows|\Device\Harddisk0\Partition2 115309 3747715&lt;BR /&gt; 56240 186456 1500 194816 615538&lt;BR /&gt;688 141268 8 190930944 892 72&lt;BR /&gt; 530 82 531&lt;BR /&gt; 13273 45997341 0&lt;BR /&gt; 31 88750000 608038912 6.1.7601 140316672 5&lt;BR /&gt; 5017&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;H:\&amp;gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;As you should be able to see, the information I need is not give at all.&lt;/P&gt;&lt;P&gt;If I look at creating the result in the way you show, as you can see, the "result" is basically empty&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt;import psutil&lt;BR /&gt;&amp;gt;&amp;gt;result = subprocess.check_output("WMIC PROCESS where 'ProcessID=892' get&amp;nbsp; Caption,Commandline,Processid")&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;print(result)&lt;BR /&gt;Caption&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CommandLine&amp;nbsp; ProcessId &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ArcSOC.exe&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 892&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;result&lt;BR /&gt;'Caption&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CommandLine&amp;nbsp; ProcessId&amp;nbsp; \r\r\nArcSOC.exe&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 892&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; \r\r\n\r\r\n'&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;(blank lines left there on purpose).&lt;/P&gt;&lt;P&gt;So, I'm still at the problem that I need to run the subprocess as "RunAs Administrator", and I can't figure out how to do that in a script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll leave this thread open until next week in case anyone has a solution, then I think I'm going to mark it as "Assumed answered" .....even though it may be "no&amp;nbsp; answer".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Nov 2016 02:48:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-how-can-i-run-a-system-command-as/m-p/704916#M54551</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2016-11-23T02:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: Python: how can I run a system command as administrator and capture the command output?</title>
      <link>https://community.esri.com/t5/python-questions/python-how-can-i-run-a-system-command-as/m-p/704917#M54552</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The win32 module has a shell.ShellExecute method which can accept the '&lt;A href="https://technet.microsoft.com/en-us/library/cc771525(v=ws.11).aspx" rel="nofollow noopener noreferrer" target="_blank"&gt;runas&lt;/A&gt;' verb. You can use a snippet like below to relaunch the current script as admin:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; os
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; sys
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; win32com&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;shell&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;shell &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; shell
ASADMIN &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'asadmin'&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; sys&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;argv&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;!=&lt;/SPAN&gt; ASADMIN&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; script &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;abspath&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;sys&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;argv&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; params &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;' '&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;script&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; sys&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;argv&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;ASADMIN&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; shell&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ShellExecuteEx&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lpVerb&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'runas'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; lpFile&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;sys&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;executable&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; lpParameters&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;params&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; sys&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;exit&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit: &amp;nbsp;Just wanted to add that this will prompt for UAC at this point so unless you have set your system to automatically accept UAC requests, there will need to be someone present to click accept. Also, since you're launching the process in a second shell, you won't get the StdOut piped to your current shell - so if you need to see the output, write it to a file instead of relying on print statements.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:37:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-how-can-i-run-a-system-command-as/m-p/704917#M54552</guid>
      <dc:creator>ClintonDow1</dc:creator>
      <dc:date>2021-12-12T05:37:44Z</dc:date>
    </item>
    <item>
      <title>Re: Python: how can I run a system command as administrator and capture the command output?</title>
      <link>https://community.esri.com/t5/python-questions/python-how-can-i-run-a-system-command-as/m-p/704918#M54553</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Clinton.&amp;nbsp; It took me a while to figure out how to download and install the win32com package, but I have that now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've been reading thru documents trying to figure out the rest of what you have in the sample, but not getting very far.&amp;nbsp; IF I run your sample in a python window (I use WingPro), I'm getting an error...&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;&amp;nbsp; Python Shell, prompt 17, line 5&lt;BR /&gt;SystemExit: 0&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;but I admit, I'm not sure what your sample is trying to do, or how I would insert my command.&amp;nbsp; &lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;theCommand = "wmic process where \"ProcessID = 4132\" get CommandLine"&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;If I could get the information from this that I ge only if run "asadmin" and then I could try to parse out Dservice.&amp;nbsp; I'm not really wanting to run the rest of the tool "as admin", or at least not wanting to have the person have to be prompted for a password (for the OS admin rights)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My mind is starting to get fuzzy on how I was going to use this &lt;EM&gt;in&lt;/EM&gt; my script anyway.&amp;nbsp; The rabbit hole I was starting to go down was trying to do is find every which way the fgdb could be locked, and then trying to resolve it within the tool, but I'm beginning to think that something &lt;EM&gt;may&lt;/EM&gt; have to be manual checks.&amp;nbsp; The reason for finding locks, is if you try to rename or delete a FGDB and their are lock on any of it, i will be corrupted (i.e.enough files may be deleted so it's just a folder instead of a fgdb....and I do have a lot of try...except... blocks).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Nov 2016 21:41:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-how-can-i-run-a-system-command-as/m-p/704918#M54553</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2016-11-23T21:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: Python: how can I run a system command as administrator and capture the command output?</title>
      <link>https://community.esri.com/t5/python-questions/python-how-can-i-run-a-system-command-as/m-p/704919#M54554</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rebecca,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Win32 is a bit of a frustrating install with multiple Python versions installed, glad you were able to get it. I'll admit this is an old code snippet and I haven't used it for anything complex so it may be of limited usefulness in your situation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Essentially all that snippet is doing is re-launching a python script with the UAC dialog, if it doesn't have admin rights on the first attempt. I misunderstood that it was only part of your&amp;nbsp;script to run as admin and not the whole thing. There's no easy solution to launching an admin-level sub-process from a user-level program without prompting for UAC - even using a Microsoft language like C#.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My best advice in that situation is to see if you can break the workflow up into multiple tools and then chain them together in a .bat file perhaps?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Nov 2016 17:17:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-how-can-i-run-a-system-command-as/m-p/704919#M54554</guid>
      <dc:creator>ClintonDow1</dc:creator>
      <dc:date>2016-11-28T17:17:38Z</dc:date>
    </item>
    <item>
      <title>Re: Python: how can I run a system command as administrator and capture the command output?</title>
      <link>https://community.esri.com/t5/python-questions/python-how-can-i-run-a-system-command-as/m-p/704920#M54555</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the follow-up Clinton.&amp;nbsp; My attempt was to make this tool cover, in theory, all possible tests available (via ArcGIS and OS options) for locked FGDB files, but at this point I think these last couple tests are not worth the effort. I may do as you mentioned and maybe make them separate tools, but better yet, I just may need to put the info in a readme file for possible solutions if the tool crashes.&amp;nbsp; I've been the only one running this process for years, and just trying to make it more foolproof for others.&amp;nbsp; But with newer network security restrictions, we have to learn to live with the newer, tighter rules I guess. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, &lt;STRONG&gt;in summary.&lt;/STRONG&gt;...this is not possible in the way I had hoped.&amp;nbsp; Work around would be as Luke and Clinton pointed out, although neither is 100% practical in my case. Best I will be able to do is attempt to use try..except to exit out of the tool before it corrupts anything, then have a separate tool or instructions (to do it manually) to get past the last hurdle.&amp;nbsp; Of course, simplest and most reliable fix in this case would be to just shut down ArcGIS Server and/or reboot...but, the original thought was to only deal with the services that need to be stopped (and not touch those that don't).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks all for your suggestions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Nov 2016 17:38:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-how-can-i-run-a-system-command-as/m-p/704920#M54555</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2016-11-28T17:38:21Z</dc:date>
    </item>
    <item>
      <title>Re: Python: how can I run a system command as administrator and capture the command output?  Not answered, but provided summary.</title>
      <link>https://community.esri.com/t5/python-questions/python-how-can-i-run-a-system-command-as/m-p/704921#M54556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Rebecca, so I was playing around and found that by creating a shortcut to a .bat file, setting the shortcut to run as an admin, I can call on the shortcut in a command prompt that isn't launched as an administrator and it opens a new command prompt as an admin to run the script. &amp;nbsp;In the screenshots below, the first command in the first command prompt isn't run as an admin, and I can't return the name of the service. &amp;nbsp;The second command I call on the shortcut, which launches a new command prompt as an admin and runs the script and prints the service name. &amp;nbsp;Not sure if you're already beyond this now or if this will work for you, but I figured I'd pass it along.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/277415_pastedImage_2.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Dec 2016 19:42:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-how-can-i-run-a-system-command-as/m-p/704921#M54556</guid>
      <dc:creator>JonathanQuinn</dc:creator>
      <dc:date>2016-12-06T19:42:16Z</dc:date>
    </item>
  </channel>
</rss>

