<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 9 November 2013 10:32, Paul McGrath <span dir="ltr"><<a href="mailto:J.P.McGrath@leeds.ac.uk" target="_blank">J.P.McGrath@leeds.ac.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div lang="EN-GB" link="blue" vlink="purple"><p class="MsoNormal">
<span style="font-family:Consolas;font-size:10.5pt"> </span><br></p><p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas">Is there an issue runningn powershell at System level?</span></p></div></blockquote>
<div><br></div><div>Not that I have come across. I have started to use Powershell quite extensively in my Wpkg files with only minor issues, mainly to do with exit codes and quoting\escaping.</div><div><br></div><div>Here is an example that turns on Powershell remoting:</div>
<div><br></div><div><div><font face="courier new, monospace"><?xml version="1.0" encoding="UTF-8"?></font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace"><packages</font></div>
<div><font face="courier new, monospace"> xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>"</font></div><div><font face="courier new, monospace"> xsi:noNamespaceSchemaLocation="../xsd/packages.xsd" ></font></div>
<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace"> <package id="ps-remoting"</font></div><div><font face="courier new, monospace"> name="Enable Powershell Remoting"</font></div>
<div><font face="courier new, monospace"> revision="1"</font></div><div><font face="courier new, monospace"> reboot="false"</font></div><div><font face="courier new, monospace"> priority="10"></font></div>
<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace"> <check type="execute" path='powershell -NonInteractive -Command "if (Invoke-Command localhost {1}) {exit 0} else {exit 1}"' condition="exitcodeequalto" value="0"/></font></div>
<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace"> </font><span style="font-family:'courier new',monospace"><install cmd='powershell -NonInteractive -Command "Enable-PSRemoting -Force"'/></span></div>
<div><font face="courier new, monospace"> </package></font></div><div><font face="courier new, monospace"></packages></font></div></div><div><font face="courier new, monospace"><br></font></div><div><font face="arial, helvetica, sans-serif">You can run script files as follows, but I have found that exit codes always report success despite the script commands failing.</font></div>
<div><font face="arial, helvetica, sans-serif"><br></font></div><div><span style="font-family:'courier new',monospace"><install cmd='powershell -NonInteractive -File "<path to .ps1>"'/></span><font face="arial, helvetica, sans-serif"><br>
</font></div><div><span style="font-family:'courier new',monospace"><br></span></div><div><font face="arial, helvetica, sans-serif">You might find running powershell /? at the command prompt useful.</font></div><div>
<font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">HTH,</font></div><div><font face="arial, helvetica, sans-serif">Daf</font></div><div> </div></div></div></div>