VMware Cloud Community
smittycsi2
Contributor
Contributor

Run powercli script from desktop shortcut

I am trying to create a desktop shortcut that launches a small .ps1 script how do i modify the default desktop shortcut so it launches the script?

Thanks in advance

0 Kudos
1 Reply
LucD
Leadership
Leadership

As a security measure you can't run a PowerShell script by double-clicking a .ps1 file.

But you can create a desktop shortcut.

Call powershell.exe and on the -File parameter point to your .ps1 file.

Don't forget to load the PowerCLI modules and connect to a vSphere server in the .ps1 file.

%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -File "C:\Scripts\MyFile.ps1"


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos