[wpkg-users] powershell install command
Dafydd Jones (techneg.it)
dafydd at techneg.it
Mon Nov 11 18:06:44 CET 2013
On 9 November 2013 10:32, Paul McGrath <J.P.McGrath at leeds.ac.uk> wrote:
>
>
> Is there an issue runningn powershell at System level?
>
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.
Here is an example that turns on Powershell remoting:
<?xml version="1.0" encoding="UTF-8"?>
<packages
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../xsd/packages.xsd" >
<package id="ps-remoting"
name="Enable Powershell Remoting"
revision="1"
reboot="false"
priority="10">
<check type="execute" path='powershell -NonInteractive -Command "if
(Invoke-Command localhost {1}) {exit 0} else {exit 1}"'
condition="exitcodeequalto" value="0"/>
<install cmd='powershell -NonInteractive -Command
"Enable-PSRemoting -Force"'/>
</package>
</packages>
You can run script files as follows, but I have found that exit codes
always report success despite the script commands failing.
<install cmd='powershell -NonInteractive -File "<path to .ps1>"'/>
You might find running powershell /? at the command prompt useful.
HTH,
Daf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wpkg.org/pipermail/wpkg-users/attachments/20131111/9b9783e7/attachment-0003.html>
More information about the wpkg-users
mailing list