title: Deploying Remotely to .NET Box
body: <p>For years, I've been able to do a build using a continuous build system like <a href="http://jenkins-ci.org" rel="nofollow noreferrer">Jenkins</a> and then remotely deploying my apps to various <strong>Unix</strong> servers. I can use the <code>ssh</code> and <code>scp</code> commands to do my bidding.</p>
  <p>Now, I have a .NET build I'm doing. I've done the build using Jenkins and would now like to deploy to a remote .NET server. I need to shutdown the application, copy the files over, and then restart the application. I need to be able to do this remotely and via command line tools (no GUI tools). I am on a series of machines that are locked down, and cannot deploy stuff willy-nilly -- especially to the production machines.</p>
  <p>Is there a mechanism that will allow me to <em>remotely</em> shutdown the server, deploy a new set of files, and restart the application?</p>
  <h2>BONUS QUESTION</h2>
  <p>I understand that a <code>*.cab</code> file is somewhat similar to a Java <code>*.jar</code> file. That is, you can deploy a single <code>*.cab</code> file to a server, and the server will treat it as if it's a bunch of files in a directory.</p>
  <ul>
  <li>Is this correct? If so, I'd like to deploy things using the cab file.</li>
  <li>There is a <code>webapp.config</code> file that's part of my build that's different for each and every server. I'd prefer to create a cab file that does not contain the <code>webapp.config</code> file, that way, the cab file I have can be deployed to every machine without changing it (only the webapp.config file has to be changed).</li>
  </ul>
  <p>Thanks</p>
  <hr />
  <h1>Addendum</h1>
  <p>I just can't win...</p>
  <p>I have a build on machine02 and I need to deploy to machine06. Machine06 is in a DMZ, so I can't add a domain user on it. I can only create local accounts.</p>
  <p>With <code>sc</code>, I can access remote systems, but the account I'm running <code>sc</code> from also needs to exist on the remote system. Since I can't create a domain account on machine06, and I can't add a computer local account to another Windows system (i.e., make machine06\user an administrator on machine02 too)., I can't use <code>sc</code>.</p>
  <p>I tried the lp commands from Sysinternals. These allow me to specify a user name and password (which I assume is for the other system. However, I get the following error:</p>
  <pre><code>C:\Windows\system32&gt;pslist \\machine02 -user remuser02 -password Swordfish
  
  pslist v1.29 - Sysinternals PsList
  Copyright (C) 2000-2009 Mark Russinovich
  Sysinternals
  
  Cannot connect to remote registry on MACHINE02:
  Access is denied.
  Failed to take process snapshot on MACHINE02.
  Make sure that the Remote Registry service is running on the remote system, 
  that you havefirewall ports allow RPC access, and your account has read
  access the following key on the remote system:
      HKLM\Software\Microsoft\Windows NT\CurrentVersion\Perflib
  
  
  C:\Windows\system32&gt;
  </code></pre>
  <p>Since that user is an admin on machine02, I am sure that user has read access to the Windows registry key, and I verified that Remote Registry Access is on. I suspect that the router is blocking RPC calls.</p>
  <p>So, <code>sc</code> is out since I can't specify an account to use. The Sysinternals PS tools are out. I can't add the <code>sshd</code> on the server.</p>