I have a script that was executing a powershell script from within a batch file with the following syntax:
"“powershell.exe -NoLogo -Noninteractive -Command "& \"%~dp0ScriptName.ps1\" %1; exit "
Everything was working fine until the OS team patched the server and upgraded Powershell to version 3 (it had version 2). After Powershell was upgraded the script failed with the error:
"powershell.exe' is not recognized as an internal or external command, operable program or batch file"
For the time being I have "fixed" the issue by executing powershell with an explicit path:
"C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Noninteractive -Command "& \"%~dp0ScriptName.ps1\" %1; exit"
Now, this change may make my script functional again, but I don't understand what exactly is going on. What changed when Powershell was upgraded that made the way I was calling the script invalid?
Any information or good links to information would be greatly appreciated.