Thursday, June 05, 2008

Remotely Remove IIS via the Command Line Using PsExec and Sysocmgr.exe

IIS components can be manually removed the with the Add/Remove Programs>>Add/Remove Windows Components tool in Control Panel, or they can be uninstalled from the command line with a little script Kung-Fu. Several Windows components can be added/removed using this same technique by modifying the answer file.

Here's the syntax:

psexec \\TARGETMACHINENAME –u DOMAINNAME\%username% sysocmgr /i:%windir%\inf\sysoc.inf /u:"\\path\to\share\IIS_REMOVE-unattended.txt" /r /q
Here are the contents of the IIS_REMOVE-unattended.txt answer file - I've chosen to remove only 3 relevant components of IIS:
[Components]
iis_common = OFF
iis_www = OFF
iis_inetmgr = OFF

Here's what execution looks like:


Running
sysocmgr /?
from Start>>Run will display the available parameters for the tool.

No comments: