401 Not Authorized For MSDEPLOY‏ (msdeployAgentService)

When you get this error from msdeploy:

“Error: The remote server returned an error: (401) Unauthorized.”

you need to give the remote user elevated rights to get authorization.

http://support.microsoft.com/kb/951016

http://blogs.msdn.com/b/vistacompatteam/archive/2006/09/22/766945.aspx

To disable UAC remote restrictions, follow these steps:

    1. Click Start, click Run, type regedit, and then press ENTER.
    2. Locate and then click the following registry subkey:HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionPoliciesSystem
    3. If the LocalAccountTokenFilterPolicy registry entry does not exist, follow these steps:
      1. On the Edit menu, point to New, and then click DWORD Value.
      2. Type LocalAccountTokenFilterPolicy, and then press ENTER.
    4. Right-click LocalAccountTokenFilterPolicy, and then click Modify.
    5. In the Value data box, type 1, and then click OK.
    6. Exit Registry Editor.