'How to pass a parameter to commandToExecute in Azure Custom Script Extension

I have a Azure Vm extension in which i want to run a PowerShell script which takes a parameter -Install:

PS C:\Users\abc\Downloads\InstallPackage-2022\InstallPackage> .\Install_Package.ps1 -Install

How can i use this in the commandToExecute?

So far I have:

Custom Script Extension commandToExecute:

$settings = @{"fileUris" = $fileUri;"commandToExecute" ="powershell -ExecutionPolicy Unrestricted -File Install_Package.ps1"};


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source