<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.iis.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:cs="http://blogs.iis.net/"><channel><title>IIS 7.0  - PowerShell</title><link>http://forums.iis.net/1151.aspx</link><description>All about IIS 7.0 PowerShell integration. Use this forum to ask PowerShell questions, discuss issues, request features and yell at IIS team members.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Returning Events with PowerShell</title><link>http://forums.iis.net/thread/1894346.aspx</link><pubDate>Mon, 23 Feb 2009 08:47:35 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:1894346</guid><dc:creator>sergeia</dc:creator><slash:comments>0</slash:comments><comments>http://forums.iis.net/thread/1894346.aspx</comments><wfw:commentRss>http://forums.iis.net/commentrss.aspx?SectionID=1151&amp;PostID=1894346</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;Hi, wulfmaer!&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;Your question is a little bit generic, so I will try to provide generic answer. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;To generate events you will need to wrap functionality of msiexec into your own code. If you want to use PowerShell, it probably will be easier to wrap it into managed code. There is a &lt;a class="" href="http://msdn.microsoft.com/en-us/library/aa372866.aspx"&gt;description&lt;/a&gt; of Microsoft Installer APIs on MSDN. You could then write or find somewhere interop for these APIs. After that you will launch installation from your code, which could be Powershell cmdlet or managed object, created in Powershell. You could run remote scripts and use events in Powershell v2.0, which is not released yet, but available as CTP. There is also &lt;a class="" href="http://www.codeplex.com/PSEventing"&gt;third party&lt;/a&gt; eventing support that supposed to work with released version.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;Otherwise, if you have managed code that controls installation, you could display result on the Web page.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;Hope this will help you,&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;--Sergei&lt;/font&gt;&lt;/p&gt;</description></item><item><title>Re: Returning Events with PowerShell</title><link>http://forums.iis.net/thread/1893900.aspx</link><pubDate>Wed, 18 Feb 2009 20:00:07 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:1893900</guid><dc:creator>wulfmaer</dc:creator><slash:comments>0</slash:comments><comments>http://forums.iis.net/thread/1893900.aspx</comments><wfw:commentRss>http://forums.iis.net/commentrss.aspx?SectionID=1151&amp;PostID=1893900</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Thanks. But I kinda lost you after &amp;quot;woot...&amp;quot;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Returning Events with PowerShell</title><link>http://forums.iis.net/thread/1893777.aspx</link><pubDate>Wed, 18 Feb 2009 02:58:45 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:1893777</guid><dc:creator>wulfmaer</dc:creator><slash:comments>0</slash:comments><comments>http://forums.iis.net/thread/1893777.aspx</comments><wfw:commentRss>http://forums.iis.net/commentrss.aspx?SectionID=1151&amp;PostID=1893777</wfw:commentRss><description>&lt;p&gt;Hello, Everyone.&lt;br /&gt;&lt;br /&gt;I&amp;#39;m trying to figure out how I can use
PowerShell to trigger scripts and then report events (like &amp;quot;install
succeeded&amp;quot; or &amp;quot;failed&amp;quot; or &amp;quot;task completed&amp;quot; or &amp;quot;did not complete&amp;quot; or
&amp;quot;current percentage of completion&amp;quot;)&amp;nbsp; to a C# web application which is
triggering the scripts on remote machines. &lt;br /&gt;&lt;br /&gt;Let me explain, I&amp;#39;m
an SDET in Seattle and I&amp;#39;ve just deployed a very nice batch and cmd
file driven lab teardown and deployment system which has really helped
cutdown the time it takes us to teardown our test environment and then
deploy a new build. Anyway, I wrote a C# web application to serve as a
master control for triggering all the teardown and deployment scripts
that we use and it works great, but I don&amp;#39;t have any status reporting.
My C# web application can&amp;#39;t tell when a remote process it triggered via
a script it launched completed successfully or not. Specifically, I&amp;#39;m
using a web application written in C# running on IIS7 to launch local
cmd files which use psexec.exe to call scripts on remote machines but
my C# application never gets notified what happened after the initial
scripts are launched. &lt;br /&gt;&lt;br /&gt;For example, I click a button on my web
application and it launches a local script which, in turn, calls a
remote cmd script containing the following instructions:&lt;br /&gt;&lt;br /&gt;&amp;quot;REM triggers all machines in ms_targets.txt to uninstall/teardown mymediaserver&lt;br /&gt;&lt;br /&gt;psexec \\192.168.42.239 -i -d -n 5 -u wulf -p xxx C:\setups\master_teardowns\mymediaserver\master_mediaserver_teardown.cmd&amp;quot;&lt;br /&gt;&lt;br /&gt;This
script (master_mediaserver_teardown.cmd) contains the following
instructions (quotations added for readability and are not in the
script):&lt;br /&gt;&lt;br /&gt;&amp;quot;REM silently uninstalls mymediaserver using the app&amp;#39;s product code&lt;br /&gt;&lt;br /&gt;net stop mymediaserver&lt;br /&gt;MsiExec.exe /uninstall {3FD3D21F-629F-4174-AF7B-29F4DA927B38} /quiet&amp;quot;&lt;br /&gt;&lt;br /&gt;Now,
when this script is launched on a remote machine a DOS command-window
opens up on that machine and you can see what the progress of the
uninstall process is if you&amp;#39;re sitting right there looking at its
monitor. But the C# web application which launched the script in the
first place knows nothing of the status/progress of this process as the
uninstallation is performed. And again, when the process completes, I
don&amp;#39;t currently have a method of communicating back to the C# website
which launched the process, via script, that the process has completed.&lt;br /&gt;&lt;br /&gt;I sure hope I&amp;#39;m making sense here...&lt;br /&gt;&amp;nbsp;&lt;br /&gt;Now,
I&amp;#39;m using installshield for all my install packages and psexec.exe,
triggered by my C# web application, is what is being used to launch
these installers. Can PowerShell be used in someway to create an object
which communicates events back to the C# web application? Or, perhaps,
is there something that I&amp;#39;m not doing correctly or am missing with my
windows scripting that would return status (not just error codes) to
the web application? &lt;br /&gt;&lt;br /&gt;Ideally, I&amp;#39;d like to show status bars on
my C# web application which increment as the various remote
installations and or teardowns are underway as well as show when tasks
have completed and whether or not any errors occurred.&lt;br /&gt;&lt;br /&gt;Any feedback would be most appreciated!&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;&lt;br /&gt;Wulf&lt;/p&gt;</description></item></channel></rss>