﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Programming / Powershell  / Powershell execution error / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Tue, 21 May 2013 02:24:29 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Powershell execution error</title><link>http://www.sqlservercentral.com/Forums/Topic1398741-1351-1.aspx</link><description>Chances are the path "%systemroot%\System32\WindowsPowerShell\v1.0\" was removed from the [u][url=http://en.wikipedia.org/wiki/PATH_(variable)]PATH system environment variable[/url][/u]. Removing the path to powershell.exe from the PATH variable made it impossible for you to refer to powershell.exe from any random command line location without fully qualifying it.As a side note the explicit path you decided to prefix your command with, "C:\Windows\SysWOW64\WindowsPowerShell\v1.0\", is the path to the 32-bit version of powershell.exe on 64-bit OS'es. Prior to the upgrade it is likely you were executing your script using the 64-bit version. Chances are it is not making a difference since you said the script is working but I thought it was worth pointing out.</description><pubDate>Mon, 24 Dec 2012 13:47:37 GMT</pubDate><dc:creator>opc.three</dc:creator></item><item><title>Powershell execution error</title><link>http://www.sqlservercentral.com/Forums/Topic1398741-1351-1.aspx</link><description>Greetings,I  have a script that was executing a powershell script from within a batch file with the following syntax:"“powershell.exe -NoLogo -Noninteractive -Command "&amp; \"%~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 "&amp; \"%~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.Thanks!Kim</description><pubDate>Wed, 19 Dec 2012 19:59:44 GMT</pubDate><dc:creator>kstjacques</dc:creator></item></channel></rss>