I can not find what is actually the problem from my limited knowledge everything looks correct
Here is the code I am using:
<html>
<head>
<title>Application Executer</title>
<HTA:APPLICATION ID="oMyApp"
APPLICATIONNAME="Application Executer"
BORDER="yes"
CAPTION="no"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
SYSMENU="yes"
SCROLL="yes"
WINDOWSTATE="normal">
<script type="text/javascript" language="javascript">
function RunFile() {
WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run("C:Users\User\OneDrive\Desktop\Apps\Clean_Teams.ps1", 1, false);
}
</script>
</head>
<body>
<br>
<br>
<center>
<input type="button" value="Clean Teams" onclick="RunFile();"/>
<br>
<br>
<input type="button" value="Clean Chrome" onclick="RunFile();"/>
<br>
<br>
<input type="button" value="Clean Edge" onclick="RunFile();"/>
</center>
</body>
</html>
As mentioned in the comments, you need to run powershell.exe with the appropriate parameters. Below is an example HTA for launching PowerShell scripts that demonstrates one way to set up the correct command line. Also note that X-UA-Compatible is set to IE=9. Without any declaration, the HTA will default to IE=5 mode.
<!DOCTYPE html>
<html>
<head>
<title>Script Selector</title>
<meta charset="UTF-8" http-equiv="X-UA-Compatible" content="IE=9">
<hta:application
id=oHTA
icon=Powershell.exe
>
<script>
Visible=1;
NoWait = false;
w = 640;
h = 480;
oWSH = new ActiveXObject("WScript.shell");
window.resizeTo(w, h);
window.moveTo((screen.availWidth - w)/2, (screen.availHeight - h)/2);
function RunScript(ScriptName) {
if (db.checked) { x = "-NoExit"} else {x = ""}
CmdLine = 'Powershell.exe ' + x + ' -ExecutionPolicy Bypass -File "' + ScriptName + '"';
oWSH.Run(CmdLine,Visible,NoWait);
}
</script>
<style>
body {background-color:LemonChiffon; font-family:Segoe UI; font-size:11pt}
br {font-size: 16pt}
</style>
</head>
<body>
<input id=db type=checkbox>Debug (check to keep PowerShell console open)<br>
<input id=b1 type=button value="PowerShell Script 1.ps1" onclick=RunScript(b1.value)><br>
<input id=b2 type=button value="PowerShell Script 2.ps1" onclick=RunScript(b2.value)><br>
<input id=b3 type=button value="PowerShell Script 3.ps1" onclick=RunScript(b3.value)><br>
</body>
</html>