Skip to main content
Solved

Running PowerShell Script through AA V11

  • February 8, 2023
  • 4 replies
  • 1820 views

Forum|alt.badge.img+2

Hi,

 

I am trying to run the PowerShell script through ‘open program/file’. The script is working properly through PowerShell Console, but same script is not running through AA. 

Command- Get-childItem -Path "C:\Users\$env:USERNAME\Downloads" -File | where-object {$_.CreationTime -gt(get-date).Date -and $_.Extension -eq ".zip"} | Remove-Item

 

I am trying to delete zip files for today’s date.

Best answer by rbkadiyam

@Akshay.M2 

It is required to point to 64-bit PowerShell while running the script in such cases.

Use "C:\Windows\sysnative\WindowsPowerShell\v1.0\powershell.exe" instead of "powershell.exe" in Open Program/File command to resolve this issue.

View original
Did this topic help answer your question?

4 replies

rbkadiyam
Premier Pathfinder | Tier 7
Forum|alt.badge.img+17
  • Premier Pathfinder | Tier 7
  • 590 replies
  • Answer
  • February 8, 2023

@Akshay.M2 

It is required to point to 64-bit PowerShell while running the script in such cases.

Use "C:\Windows\sysnative\WindowsPowerShell\v1.0\powershell.exe" instead of "powershell.exe" in Open Program/File command to resolve this issue.


Raul Jaimes
Forum|alt.badge.img+9
  • Navigator | Tier 3
  • 494 replies
  • February 9, 2023

@Akshay.M2 

Example:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File  "C:\Users\Admin\Desktop\test_script.ps1

 

It will look like:

 

 

HTH

Regards


Forum|alt.badge.img+2
  • Author
  • Cadet | Tier 2
  • 1 reply
  • March 1, 2023

Thank you guys for the reply. It has resolved now.


Forum|alt.badge.img
  • Cadet | Tier 2
  • 1 reply
  • July 5, 2023

Can we use AA variable inside PowerShell script in v11


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings