<?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 Alteryx Gallery/Server - Powershell &amp;quot;Excel - ComObject issue&amp;quot; in Alteryx Server Discussions</title>
    <link>https://community.alteryx.com/t5/Alteryx-Server-Discussions/Alteryx-Gallery-Server-Powershell-quot-Excel-ComObject-issue/m-p/603273#M6774</link>
    <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We created a powershell script in order to open/refresh/save/close an Excel file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The script is called via the "Run command" tool in Alteryx as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="run command.png" style="width: 400px;"&gt;&lt;img src="https://community.alteryx.com/t5/image/serverpage/image-id/123171iBF069ECB3FC758D9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="run command.png" alt="run command.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Powershell code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Param ([string]$pfad_target)

$a = New-Object -ComObject "Excel.Application"

$a.Visible = $false
$a.displayAlerts = $false

$b = $a.Workbooks.Open($pfad_target)  #line triggering the error
$b.RefreshAll()
$b.Save()
$b.Close()

$a.Quit()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Problem:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The workflow runs well while being executed in the local Alteryx Designer and via Remote on the Alteryx Server Designer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, if the workflow was uploaded to the Alteryx Gallery (Private Studio) the script shows the following misbehaviour:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The user has to specify its credentials to run the workflow --&amp;gt; while logging $env:USERNAME we can see, that the username has the same credentials as defined in the Alteryx Gallery&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;The script stops at the command "&lt;EM&gt;$b = $a.Workbooks.Open($pfad_target)&lt;/EM&gt;"&amp;nbsp; &amp;nbsp;--&amp;gt; showing the error message "Microsoft Excel cannot access the file ..."&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Curious:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;When executing the workflow in the local Designer and via Remote on the Alteryx Server Designer --&amp;gt; The Microsoft Excel process appears in the Task Manager being executed with the correct Windows user credentials&lt;/LI&gt;&lt;LI&gt;When starting the workflow via the Alteryx Gallery --&amp;gt; The Microsoft Excel process appears in the Task Manager of Windows Server being executed with the "SYSTEM" user (Please note, while logging the powershell script the $env:USERNAME still shows the correct Windows credentials)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="task manager.png" style="width: 400px;"&gt;&lt;img src="https://community.alteryx.com/t5/image/serverpage/image-id/123178iB76686795CC2913E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="task manager.png" alt="task manager.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Server version:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Client: 2019.3.17947&lt;/LI&gt;&lt;LI&gt;Server: 2019.3.5.17947&lt;/LI&gt;&lt;LI&gt;Server Binaries: 2019.3.5.17947&lt;/LI&gt;&lt;LI&gt;Service Layer&lt;UL&gt;&lt;LI&gt;Master: 2019.3.5.17947&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Designer version:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;2019.3.5.17947&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please advise what is going wrong here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you &amp;amp; best regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 14 Jul 2020 10:27:42 GMT</pubDate>
    <dc:creator>badboy66</dc:creator>
    <dc:date>2020-07-14T10:27:42Z</dc:date>
    <item>
      <title>Alteryx Gallery/Server - Powershell "Excel - ComObject issue"</title>
      <link>https://community.alteryx.com/t5/Alteryx-Server-Discussions/Alteryx-Gallery-Server-Powershell-quot-Excel-ComObject-issue/m-p/603273#M6774</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We created a powershell script in order to open/refresh/save/close an Excel file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The script is called via the "Run command" tool in Alteryx as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="run command.png" style="width: 400px;"&gt;&lt;img src="https://community.alteryx.com/t5/image/serverpage/image-id/123171iBF069ECB3FC758D9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="run command.png" alt="run command.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Powershell code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Param ([string]$pfad_target)

$a = New-Object -ComObject "Excel.Application"

$a.Visible = $false
$a.displayAlerts = $false

$b = $a.Workbooks.Open($pfad_target)  #line triggering the error
$b.RefreshAll()
$b.Save()
$b.Close()

$a.Quit()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Problem:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The workflow runs well while being executed in the local Alteryx Designer and via Remote on the Alteryx Server Designer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, if the workflow was uploaded to the Alteryx Gallery (Private Studio) the script shows the following misbehaviour:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The user has to specify its credentials to run the workflow --&amp;gt; while logging $env:USERNAME we can see, that the username has the same credentials as defined in the Alteryx Gallery&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;The script stops at the command "&lt;EM&gt;$b = $a.Workbooks.Open($pfad_target)&lt;/EM&gt;"&amp;nbsp; &amp;nbsp;--&amp;gt; showing the error message "Microsoft Excel cannot access the file ..."&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Curious:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;When executing the workflow in the local Designer and via Remote on the Alteryx Server Designer --&amp;gt; The Microsoft Excel process appears in the Task Manager being executed with the correct Windows user credentials&lt;/LI&gt;&lt;LI&gt;When starting the workflow via the Alteryx Gallery --&amp;gt; The Microsoft Excel process appears in the Task Manager of Windows Server being executed with the "SYSTEM" user (Please note, while logging the powershell script the $env:USERNAME still shows the correct Windows credentials)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="task manager.png" style="width: 400px;"&gt;&lt;img src="https://community.alteryx.com/t5/image/serverpage/image-id/123178iB76686795CC2913E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="task manager.png" alt="task manager.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Server version:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Client: 2019.3.17947&lt;/LI&gt;&lt;LI&gt;Server: 2019.3.5.17947&lt;/LI&gt;&lt;LI&gt;Server Binaries: 2019.3.5.17947&lt;/LI&gt;&lt;LI&gt;Service Layer&lt;UL&gt;&lt;LI&gt;Master: 2019.3.5.17947&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Designer version:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;2019.3.5.17947&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please advise what is going wrong here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you &amp;amp; best regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2020 10:27:42 GMT</pubDate>
      <guid>https://community.alteryx.com/t5/Alteryx-Server-Discussions/Alteryx-Gallery-Server-Powershell-quot-Excel-ComObject-issue/m-p/603273#M6774</guid>
      <dc:creator>badboy66</dc:creator>
      <dc:date>2020-07-14T10:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: Alteryx Gallery/Server - Powershell "Excel - ComObject issue"</title>
      <link>https://community.alteryx.com/t5/Alteryx-Server-Discussions/Alteryx-Gallery-Server-Powershell-quot-Excel-ComObject-issue/m-p/605676#M6839</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.alteryx.com/t5/user/viewprofilepage/user-id/117389"&gt;@badboy66&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If Server does have access to the file and you want to run as a particular user to execute the script them you could specify that on the ps1 script&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/28989750/running-powershell-as-another-user-and-launching-a-script" target="_blank" rel="noopener"&gt;https://stackoverflow.com/questions/28989750/running-powershell-as-another-user-and-launching-a-script&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another thing to try is specify credentials of the workflow when uploading it to server&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="c-lopez_0-1595011812052.png" style="width: 400px;"&gt;&lt;img src="https://community.alteryx.com/t5/image/serverpage/image-id/124019i55ABF6BEA49117CA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="c-lopez_0-1595011812052.png" alt="c-lopez_0-1595011812052.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jul 2020 18:50:19 GMT</pubDate>
      <guid>https://community.alteryx.com/t5/Alteryx-Server-Discussions/Alteryx-Gallery-Server-Powershell-quot-Excel-ComObject-issue/m-p/605676#M6839</guid>
      <dc:creator>c-lopez</dc:creator>
      <dc:date>2020-07-17T18:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: Alteryx Gallery/Server - Powershell "Excel - ComObject issue"</title>
      <link>https://community.alteryx.com/t5/Alteryx-Server-Discussions/Alteryx-Gallery-Server-Powershell-quot-Excel-ComObject-issue/m-p/840283#M9750</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi, I'm facing the same issue - while trying to modify Excel file using PowerShell script. Could you please tell if you found the solution to this problem. Thank you!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Oct 2021 19:56:53 GMT</pubDate>
      <guid>https://community.alteryx.com/t5/Alteryx-Server-Discussions/Alteryx-Gallery-Server-Powershell-quot-Excel-ComObject-issue/m-p/840283#M9750</guid>
      <dc:creator>SowmyaNagaraju</dc:creator>
      <dc:date>2021-10-28T19:56:53Z</dc:date>
    </item>
  </channel>
</rss>

