Powershell script execution on Windows Modern Device

Powershell script execution on Windows Modern Device

I created a simple package that includes a simple powershell script.

I set the property on the file (in the package) as auto execute.

The script is installed ok, but the script is simply "opened" with notepad.

I even tried changing the app associate with the script file type from notepad to powershell but that made no difference.

Any suggestions?

A.

3 Answers

Order By:   Standard | Newest | Votes
JSMOD@SOTI | posted this 21 January 2021

Hi Andy,

 

Thank you for posting on SOTI Central.

 

After adding the Powershell script file to the Package, add a Post-Install Script to the package and put in the full path to the Powershell Executable, as well as parameters to bypass execution policy and the noexit parameter (if you want the console window to persist after execution) and then add the path to the script.

 

Example:

c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -noexit -executionpolicy Bypass & "c:\temp\TestScript.ps1"

 

Kind regards,

 

Technical Support | SOTI Inc. | 1.905.624.9828 | support@soti.net | www.soti.net |

  • 1
  • 0
Jorge Hussni - SAFIRA Telecom | posted this 24 January 2021

This will work I think! Nice command with bypass and it is need to work!

Jorge Hussni Innovation Manager Soluções & Tecnologia Gestão de Mobilidade Corporativa, Telecom & TI Rua Alvorada, 1289 conj. 404 - Vila Olímpia São Paulo - SP - CEP: 04550-004 T: (11) 4328-7378 C: (11) 975 721 349 E: jhussni@safirast.com Novo Email! www.safirast.com Novo Site!

  • 0
  • 0
Andy Murdock | posted this 25 January 2021

Hi,

Thanks for that.

 

c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy Bypass "c:\temp\EASFileShare.ps1" -exit

 

Worked as we needed - many thanks

 

Andy

 

  • 0
  • 0

Give us your feedback
Give us your feedback
Feedback