I want to install the SMTP service for IIS 6 on windows server 2003. The GUI process is explained here on technet. Then I want to configure the properties (e.g. first retry interval) and create new domains etc.
Can I script this using powershell (or any other scrpting for that matter). If yes can you point me to some resources or even give me some script samples to get me started.
Under new version of Windows such as Windows 2008 and Windows 2012 there is a built in cmdlet that directly handles this function called
Add-WindowsFeature
.Under Windows 2003 or Windows XP, the way to do it is through an answer file and calling
Sysocmgr.exe
which is responsible for adding an removing windows components. See http://support.microsoft.com/kb/222444So you would create an answer file like:
Then call this from the command line from PowerShell by: Invoke-Expression "$env:windir\system32\sysocmgr.exe /r /q /i:$env:windir\inf\sysoc.inf /u:c:\TEMP\answerfile.txt”
Note that IIS must already be installed. If it is not, add
iis_common=on
to answer file too.