-1

I am running powershell from batch script. Here is sample code.

   powershell.exe Set-ExecutionPolicy Bypass -Force
   set logDir=C:\testfolder\
   mkdir %logDir%
   powershell.exe C:\<folder>\test.ps1 >> "%logDir%test.log"

Getting error: "test.ps1" is not recognized as the name of a cmdlet This issue occurred only on particular VM. The same script execution completes on other windows machines. Need solution for this issue.

1 Answers1

0

whenever I want powershell.exe to execute a ps1 file I use the following syntax:

powershell.exe -f "C:\<folder>\test.ps1"

telling the exe to execute a file not a Cmdlet.

Guenther Schmitz
  • 1,955
  • 1
  • 9
  • 23