Skip to main content

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.

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


@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


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


Can we use AA variable inside PowerShell script in v11


Reply