10

I need to remotely administrate IIS via command-line. Is there a way to make my local AppCmd.exe refer to a remote server? So that every command I pass to AppCmd.exe would be executed in another machine?

the
  • 468
  • 8
  • 23
andrerpena
  • 345
  • 2
  • 3
  • 11

3 Answers3

6

You can download PSEXEC and run the following command:

psexec \\servername c:\windows\system32\inetsrv\appcmd

For example

psexec \\servername c:\windows\system32\inetsrv\appcmd list wp
Sameer Alibhai
  • 163
  • 1
  • 6
  • Be aware that doing this could set off major alarms in your organization if you are in a company that watches for stuff like this. – ErikE Feb 23 '16 at 01:06
  • Please don't forget about [PsExec gets stuck on licence prompt when running non-interactively](https://serverfault.com/questions/274831/is-there-a-way-to-make-my-local-appcmd-exe-to-refer-to-a-remote-server/703881#703881) and use the `PsExec /accepteula` switch for your invocations. – it3xl Mar 13 '18 at 14:54
1

I don't think you can directly use appcmd for remote management. But IIS 7 has a PowerShell provider for remote management, check this article.

the
  • 468
  • 8
  • 23
sky100
  • 504
  • 2
  • 3
  • I've been banging my head against the walls for weeks on this thing, so a heads-up: the IIS Powershell providers for remote management are *awful* if you use UNC shares for anything. – Pxtl Jan 28 '20 at 17:35
0

Only if you're using Shared Configuration, but I don't think that's your intent.

Otherwise it's PSEXEC, remote Powershell, or similar.

TristanK
  • 8,953
  • 2
  • 27
  • 39