<?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>question Unable to execute  powershell script using MiNiFi  ExecuteStreamCommand Processor in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Unable-to-execute-powershell-script-using-MiNiFi/m-p/400880#M250984</link>
    <description>&lt;P&gt;I am trying to execute a PowerShell script in java windows minifi workflow using the ExecuteStreamCommand Processor (&lt;A href="https://community.cloudera.com/t5/Support-Questions/How-to-execute-a-shell-script-while-using-NiFi-in-Windows/td-p/153638" target="_blank" rel="noopener"&gt;https://community.cloudera.com/t5/Support-Questions/How-to-execute-a-shell-script-while-using-NiFi-in-Windows/td-p/153638&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;The script is working when executed manually in the PC but does not work in the workflow.&amp;nbsp;&lt;BR /&gt;The powershell script checks the current user and if the workflow user is an admin and writes the output to a file.&lt;BR /&gt;&lt;BR /&gt;The properties of the ExecuteStreamCommand Processor are as follows :&lt;BR /&gt;&lt;BR /&gt;Command Path :&amp;nbsp;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe&lt;BR /&gt;Command Arguments :&amp;nbsp;-File C:\\scripts\\AdminCheck.ps1 -OutputFile C:\\Path\\adminOutput.txt&lt;BR /&gt;&lt;BR /&gt;The command that works when executed on the PC :-&lt;BR /&gt;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe&amp;nbsp;File C:\\scripts\\AdminCheck.ps1 -OutputFile C:\\Path\\adminOutput.txt&lt;BR /&gt;&lt;BR /&gt;This is the powershell script :-&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;param (&lt;BR /&gt;[string]$OutputFile = "C:\Path\adminOutput.txt"&amp;nbsp;&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;# Get the current user&lt;BR /&gt;$CurrentUser = whoami&lt;/P&gt;&lt;P&gt;# Check if running as administrator&lt;BR /&gt;if (([System.Security.Principal.WindowsPrincipal] [System.Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)) {&lt;BR /&gt;$AdminCheck = "Run as admin - SUCCESSFUL"&lt;BR /&gt;} else {&lt;BR /&gt;$AdminCheck = "Run as admin - FAILED"&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;# Prepare the output&lt;BR /&gt;$output = @(&lt;BR /&gt;"Current user: $CurrentUser"&lt;BR /&gt;$AdminCheck&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;# Write the output to the file&lt;BR /&gt;$output | Out-File -FilePath $OutputFile -Encoding UTF8 -Force&lt;/P&gt;&lt;P&gt;# Wait for 10 seconds&lt;BR /&gt;Start-Sleep -Seconds 10&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Is there any other way I can run PowerShell scripts in Minifi . What changes can i made to my present property settings for the processor to execute the script.&lt;BR /&gt;&lt;BR /&gt;Thanks all.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 23 Jan 2025 02:07:51 GMT</pubDate>
    <dc:creator>Shw123</dc:creator>
    <dc:date>2025-01-23T02:07:51Z</dc:date>
    <item>
      <title>Unable to execute  powershell script using MiNiFi  ExecuteStreamCommand Processor</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Unable-to-execute-powershell-script-using-MiNiFi/m-p/400880#M250984</link>
      <description>&lt;P&gt;I am trying to execute a PowerShell script in java windows minifi workflow using the ExecuteStreamCommand Processor (&lt;A href="https://community.cloudera.com/t5/Support-Questions/How-to-execute-a-shell-script-while-using-NiFi-in-Windows/td-p/153638" target="_blank" rel="noopener"&gt;https://community.cloudera.com/t5/Support-Questions/How-to-execute-a-shell-script-while-using-NiFi-in-Windows/td-p/153638&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;The script is working when executed manually in the PC but does not work in the workflow.&amp;nbsp;&lt;BR /&gt;The powershell script checks the current user and if the workflow user is an admin and writes the output to a file.&lt;BR /&gt;&lt;BR /&gt;The properties of the ExecuteStreamCommand Processor are as follows :&lt;BR /&gt;&lt;BR /&gt;Command Path :&amp;nbsp;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe&lt;BR /&gt;Command Arguments :&amp;nbsp;-File C:\\scripts\\AdminCheck.ps1 -OutputFile C:\\Path\\adminOutput.txt&lt;BR /&gt;&lt;BR /&gt;The command that works when executed on the PC :-&lt;BR /&gt;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe&amp;nbsp;File C:\\scripts\\AdminCheck.ps1 -OutputFile C:\\Path\\adminOutput.txt&lt;BR /&gt;&lt;BR /&gt;This is the powershell script :-&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;param (&lt;BR /&gt;[string]$OutputFile = "C:\Path\adminOutput.txt"&amp;nbsp;&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;# Get the current user&lt;BR /&gt;$CurrentUser = whoami&lt;/P&gt;&lt;P&gt;# Check if running as administrator&lt;BR /&gt;if (([System.Security.Principal.WindowsPrincipal] [System.Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)) {&lt;BR /&gt;$AdminCheck = "Run as admin - SUCCESSFUL"&lt;BR /&gt;} else {&lt;BR /&gt;$AdminCheck = "Run as admin - FAILED"&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;# Prepare the output&lt;BR /&gt;$output = @(&lt;BR /&gt;"Current user: $CurrentUser"&lt;BR /&gt;$AdminCheck&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;# Write the output to the file&lt;BR /&gt;$output | Out-File -FilePath $OutputFile -Encoding UTF8 -Force&lt;/P&gt;&lt;P&gt;# Wait for 10 seconds&lt;BR /&gt;Start-Sleep -Seconds 10&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Is there any other way I can run PowerShell scripts in Minifi . What changes can i made to my present property settings for the processor to execute the script.&lt;BR /&gt;&lt;BR /&gt;Thanks all.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2025 02:07:51 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Unable-to-execute-powershell-script-using-MiNiFi/m-p/400880#M250984</guid>
      <dc:creator>Shw123</dc:creator>
      <dc:date>2025-01-23T02:07:51Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to execute  powershell script using MiNiFi  ExecuteStreamCommand Processor</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Unable-to-execute-powershell-script-using-MiNiFi/m-p/400897#M250987</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/123545"&gt;@Shw123&lt;/a&gt;,&amp;nbsp;Welcome to our community! To help you get the best possible answer, I have tagged our NiFi experts&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454"&gt;@MattWho&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381"&gt;@SAMSAL&lt;/a&gt;&amp;nbsp; who may be able to assist you further.&lt;BR /&gt;&lt;BR /&gt;Please feel free to provide any additional information or details about your query, and we hope that you will find a satisfactory solution to your question.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2025 10:05:52 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Unable-to-execute-powershell-script-using-MiNiFi/m-p/400897#M250987</guid>
      <dc:creator>VidyaSargur</dc:creator>
      <dc:date>2025-01-23T10:05:52Z</dc:date>
    </item>
  </channel>
</rss>

