Solved

Running PowerShell Script through AA V11

  • 8 February 2023
  • 4 replies
  • 726 views

Badge +1

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.

icon

Best answer by rbkadiyam 8 February 2023, 17:37

View original

4 replies

Userlevel 5
Badge +10

@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.

Userlevel 5
Badge +9

@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

Badge +1

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

Badge

Can we use AA variable inside PowerShell script in v11

Reply