cf. http://stackoverflow.com/questions/10260597/invoking-powershell-script-with-arguments-from-c-sharp
cf. http://stackoverflow.com/questions/10260597/invoking-powershell-script-with-arguments-from-c-sharp
Never mind.. I thought this was problematic, but it turns out I was using Write-Host in my script which was the cause of an error rather than being able to set the execution policy.
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\ExtensionPack\4.0\MSBuild.ExtensionPack.tasks"/>
<Target Name="Default">
<!-- Execute SQL and return the result in an Item. Each column is available as metadata -->
<MSBuild.ExtensionPack.SqlServer.SqlExecute TaskAction="ExecuteReader" Sql="SELECT TOP 10 [name], [category_id] FROM [msdb].[dbo].[syscategories]" ConnectionString="Data Source=.;Initial Catalog=;Integrated Security=True">
<Output ItemName="RResult" TaskParameter="ReaderResult"/>
</MSBuild.ExtensionPack.SqlServer.SqlExecute>
<Message Text="%(RResult.Identity) - %(RResult.category_id)"/>
<PropertyGroup>
<MyPropForLogShipping Condition="%(RResult.Identity) == 'Log Shipping'">%(RResult.category_id)</MyPropForLogShipping>
</PropertyGroup>
<Message Text="MyPropForLogShipping == $(MyPropForLogShipping)" Importance="High"/>
</Target>
</Project>
This project is now maintained on Github. Please log an issue there to discuss further. Thanks!Thanks Mike, that’s a perfect example. Really really appreciate it. Again thanks.
Regards
Nicholas Tullett | Consultant
Insurance Information Services | CGI
150 Commerce Valley Dr. West, Markham, Ontario, L3T 7Z3
T: 905-762-2800 ext. 1215107[email removed]
CGI IIS
Insurance Information Services
CONFIDENTIALITY NOTICE: Proprietary/Confidential Information belonging to CGI Group Inc. and its affiliates may be contained in this message. If you are not a recipient indicated or intended in this message (or responsible for delivery of this message to such person), or you think for any reason that this message may have been addressed to you in error, you may not use or copy or deliver this message to anyone else. In such case, you should destroy this message and are asked to notify the sender by reply e-mail.