Skip to main content
Cadet | Tier 2
February 8, 2023
Solved

Running PowerShell Script through AA V11

  • February 8, 2023
  • 4 replies
  • 2195 views

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.

4 replies

rbkadiyam
Premier Pathfinder | Tier 7
rbkadiyamAnswer
Premier Pathfinder | Tier 7
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.

Ramesh B Kadiyam
Raul Jaimes
Navigator | Tier 3
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

Cadet | Tier 2
March 1, 2023

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

Cadet | Tier 2
July 5, 2023

Can we use AA variable inside PowerShell script in v11