<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0" xml:base="http://www.red-gate.com/MessageBoard/" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>Red Gate forums: Deployment Manager PowerShell Scripts</title>
 <link>http://www.red-gate.com/MessageBoard/</link>
 <description>Product Support and Discussion</description>
 <language>en</language>
 <copyright>Copyright Red Gate Software Ltd</copyright>
 <managingEditor>internalsupport@red-gate.com</managingEditor>
 <webMaster>internalsupport@red-gate.com</webMaster>
 <docs>http://blogs.law.harvard.edu/tech/rss</docs>
 <ttl>60</ttl>
 <lastBuildDate>Sun, 19 May 2013 22:16:41 GMT</lastBuildDate>
 <pubDate>Sun, 19 May 2013 22:16:41 GMT</pubDate>
 <image>
  <url>http://www.red-gate.com/messageboard/templates/subRed/images/logo_phpBB.gif</url>
  <title>Red Gate forums: Deployment Manager PowerShell Scripts</title>
  <link>http://www.red-gate.com/MessageBoard/</link>
 </image>
 <item>
  <title>PowerShell script for shutting down a running exe</title>
  <link>http://www.red-gate.com/MessageBoard/viewtopic.php?p=59594#59594</link>
  <description>This is probably basic stuff for many of you guys, but I got some really helpful assistance from the &amp;quot;Red Gaters&amp;quot; at &lt;a href=&quot;http://www.red-gate.com/MessageBoard/viewtopic.php?p=59593#59593&quot; target=&quot;_blank&quot;&gt;http://www.red-gate.com/MessageBoard/viewtopic.php?p=59593#59593&lt;/a&gt; when I needed to shut down an exe on the target machine before deploying an application to it.</description>
  <category>Deployment Manager PowerShell Scripts</category>
  <comments>http://www.red-gate.com/MessageBoard/posting.php?mode=reply&amp;t=16302</comments>
  <dc:creator>swinghouse</dc:creator>
  <pubDate>Thu, 03 Jan 2013 10:02:58 GMT</pubDate>
  <guid isPermaLink="true">http://www.red-gate.com/MessageBoard/viewtopic.php?p=59594#59594</guid>
 </item>
 <item>
  <title>Share your PowerShell deployment scripts</title>
  <link>http://www.red-gate.com/MessageBoard/viewtopic.php?p=59443#59443</link>
  <description>You can use this forum to share any PowerShell deployment scripts that you make, that you think will be useful to others.</description>
  <category>Deployment Manager PowerShell Scripts</category>
  <comments>http://www.red-gate.com/MessageBoard/posting.php?mode=reply&amp;t=16246</comments>
  <dc:creator>justin.caldicott</dc:creator>
  <pubDate>Fri, 14 Dec 2012 15:33:33 GMT</pubDate>
  <guid isPermaLink="true">http://www.red-gate.com/MessageBoard/viewtopic.php?p=59443#59443</guid>
 </item>
 <item>
  <title>Windows Services</title>
  <link>http://www.red-gate.com/MessageBoard/viewtopic.php?p=59440#59440</link>
  <description>This script uses the Service Control tool (sc.exe) to create or update a Windows Service. It assumes some variables have been set in the Deployment Manager web interface:
&lt;br /&gt;

&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;
&lt;br /&gt;
# These variables should be set via the Deployment Manager web interface&amp;#58;
&lt;br /&gt;
#
&lt;br /&gt;
# ServiceName - Name of the Windows service
&lt;br /&gt;
# ServiceExecutable - Path to the .exe containing the service
&lt;br /&gt;
#
&lt;br /&gt;
# sc.exe is the Service Control utility in Windows
&lt;br /&gt;
$service = Get-Service $ServiceName -ErrorAction SilentlyContinue
&lt;br /&gt;
$fullPath = Resolve-Path $ServiceExecutable
&lt;br /&gt;
if &amp;#40;! $service&amp;#41;
&lt;br /&gt;
&amp;#123;
&lt;br /&gt;
&amp;nbsp; Write-Host &amp;quot;The service will be installed&amp;quot;
&lt;br /&gt;
&amp;nbsp; New-Service -Name $ServiceName -BinaryPathName $fullPath -StartupType Automatic
&lt;br /&gt;
&amp;#125;
&lt;br /&gt;
else
&lt;br /&gt;
&amp;#123;
&lt;br /&gt;
&amp;nbsp; Write-Host &amp;quot;The service will be stopped and reconfigured&amp;quot;
&lt;br /&gt;
&amp;nbsp; Stop-Service $ServiceName -Force
&lt;br /&gt;
&amp;nbsp; &amp;amp; &amp;quot;sc.exe&amp;quot; config $service.Name binPath= $fullPath start= auto | Write-Host
&lt;br /&gt;
&amp;#125;
&lt;br /&gt;
Write-Host &amp;quot;Starting the service&amp;quot;
&lt;br /&gt;
Start-Service $ServiceName
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;

&lt;br /&gt;
This script uses InstallUtil.exe to install custom Event Log sources and Windows Services:
&lt;br /&gt;

&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;
&lt;br /&gt;
$NetFrameworkDirectory = $&amp;#40;&amp;#91;System.Runtime.InteropServices.RuntimeEnvironment&amp;#93;&amp;#58;&amp;#58;GetRuntimeDirectory&amp;#40;&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;amp; &amp;#40;Join-Path $NetFrameworkDirectory &amp;quot;InstallUtil.exe&amp;quot;&amp;#41; &amp;quot;path\to\my.dll&amp;quot; | Write-Host
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;</description>
  <category>Deployment Manager PowerShell Scripts</category>
  <comments>http://www.red-gate.com/MessageBoard/posting.php?mode=reply&amp;t=16244</comments>
  <dc:creator>justin.caldicott</dc:creator>
  <pubDate>Fri, 14 Dec 2012 14:57:19 GMT</pubDate>
  <guid isPermaLink="true">http://www.red-gate.com/MessageBoard/viewtopic.php?p=59440#59440</guid>
 </item>
</channel>
</rss>
