Set mailroot directories for IIS SMTP - iis

Using IIS 7.5 on Windows Server 2008 R2
I need to change the default location for ALL SMTP directories (default locations shown below):
C:\inetpub\mailroot\Badmail
C:\inetpub\mailroot\Drop
C:\inetpub\mailroot\Pickup
C:\inetpub\mailroot\Queue
to the following:
D:\smtp\badmail
D:\smtp\drop
D:\smtp\pickup
D:\smtp\queue
The ONLY directory which is configurable via Start -> Administrative Tools -> Internet Information Services IIS (6.0) Manager is the "Badmail" directory -- a new directory can be entered directly using the IIS (6.0) Manager.
No other option is available for the other 3 directories.
Is there any way to change these directories WITHOUT:
a) Having to install adsutil.vbs?
Is it possible to change these via Powershell?
Did I miss something or some other utility that can do this?
Any help/advice would be appreciated.
Thanks in advance

I going to try to answer my own question... Can anyone (Microsoft) verify if this is correct before I try this little plan?
Start -> Administrative Tools -> Internet Information Services IIS (6.0) Manager
Right-click on sever name and select "Properties"
Check box labeled "Enable Direct Metabase Edit" -> Click OK
Stop the SMTP site.
Using NotePad, open the MetBase file located at C:\Windows\System32\inetsrv\MetaBase.xml
Update the locations for the "Badmail", "Drop", "Pickup" and "Queue" directories. Save file.
Start the SMTP site.
From this point forward, the new directories should be used -- correct?

I didn't find that the accepted answer worked for me in IIS 8.5 Windows Server 2012 R2, but I did find a solution that worked. It requires using the adsutil.vbs that gets installed if you add the feature under the add roles or features wizard - features - management tools - iis6 management compatibility - iis6 scripting tools:
ref. https://www.itnota.com/moving-default-smtp-folders-to-different-drive-windows-server/
Launch Command Prompt (Admin) and run these commands:
net stop smtpsvc
set util=C:\inetpub\AdminScripts\adsutil.vbs
set dst=D:\smtp\
robocopy c:\inetpub\mailroot %dst% /e /copyall /dcopy:T /move
cscript.exe %util% set smtpsvc/1/badmaildirectory %dst%Badmail
cscript.exe %util% set smtpsvc/1/dropdirectory %dst%Drop
cscript.exe %util% set smtpsvc/1/pickupdirectory %dst%Pickup
cscript.exe %util% set smtpsvc/1/queuedirectory %dst%Queue
net start smtpsvc
This only moves folders and sets paths for the first SMTP virtual server. For others, change "smtpsvc/1/" to "smtpsvc/2/", and possibly comment out the robocopy depending on how your paths were configured for the other smtp virtual servers.

Related

Is there a way to reset IIS 7.5 to factory settings?

I modified a lot of options in IIS, and would like to reset its settings to default.
I already tried installing/reinstalling it. After the reinstall, it still had the site I created. It was still breaking on the setting I made to the DefaultWebSite.
People suggested uninstalling Windows Process Activation Service first, but it seems like it wasn't installed anyway, so I can't really uninstall it.
How can I reset this installation of IIS back to an out-of-the-box state?
You need to uninstall IIS (Internet Information Services) but the key thing here is to make sure you uninstall the Windows Process Activation Service or otherwise your ApplicationHost.config will be still around. When you uninstall WAS then your configuration will be cleaned up and you will truly start with a fresh new IIS (and all data/configuration will be lost).
There are automatic backup under %systemdrive%\inetpub\history but it may not help much if you already made lots of changes.
http://blogs.iis.net/bills/archive/2008/03/24/how-to-backup-restore-iis7-configuration.aspx
You will have to regularly back up manually using appcmd.
If you try to reinstall IIS, please first uninstall IIS and WAS via Add/Remove Programs, and then delete all existing files under C:\inetpub and C:\Windows\system32\inetsrv directories. Then you can install again cleanly.
WARN: beginners on IIS are not recommended to execute the steps above without a full backup of the system. The steps should be executed with caution and good understanding of IIS. If you are not capable of or you have doubt, make sure you open a support case with Microsoft via http://support.microsoft.com and consult.
What worked for me was going to the article someone else had already mentioned, but keying on this piece:
application.config.backup is not created by automatic backup. The backup files are in %systemdrive%\inetpub\history directory. Automatic backup is also a Vista SP1 and above feature. More information can be found in this blog post, http://blogs.iis.net/bills/archive/2008/03/24/how-to-backup-restore-iis7-configuration.aspx
I was able to find backups of my settings from when I had first installed IIS, and just copy and replace the files in the inetsrv\config directory.
Source: http://forums.iis.net/t/1085990.aspx
There is one way that I have used my self. Go to Control Panel\Programs\Turn Windows features on or off then uninstall IIS and all of its components completely. I restart windows but I'm not sure if it's required or not. Then install it again from the same path.
This link has some useful suggestions:
http://forums.iis.net/t/1085990.aspx
It depends on where you have the config settings stored. By default
IIS7 will have all of it's configuration settings stored in a file
called "ApplicationHost.Config". If you have delegation configured
then you will see site/app related config settings getting written to
web.config file for the site/app. With IIS7 on vista there is an
automatica backup file for master configuration is created. This file
is called "application.config.backup" and it resides inside
"C:\Windows\System32\inetsrv\config" You could rename this file to
applicationHost.config and replace it with the applicationHost.config
inside the config folder. IIS7 on server release will have better
configuration back up story, but for now I recommend using APPCMD to
backup/restore your configuration on regualr basis. Example: APPCMD
ADD BACK "MYBACKUP" Another option (really the last option) is to
uninstall/reinstall IIS along with WPAS (Windows Process activation
service).
Resetting IIS
On the computer that is running Microsoft Dynamics NAV Web Server components, open a command prompt as an administrator as follows:
a. From the Start menu, choose All Programs, and then choose Accessories.
b. Right-click Command Prompt, and then choose Run as administrator.
At the command prompt, type the following command to change to the Microsoft.NET\Framework64\v4.0.30319 folder, and then press Enter.
cd\Windows\Microsoft.NET\Framework64\v4.0.30319
At the command prompt, type the following command, and then press Enter.
aspnet_regiis.exe -iru
At the command prompt, type the following command, and then press Enter.
iisreset

IIS 7.5 broken, cannot connect to localhost, error 404

Someone set up IIS 7.5 on my computer with a sample project. I created a new project and I wanted this new project to be accessible on the localhost (default port 80). I changed the Site (under Sites in the navigator) in the IIS Manager and now I can't do anything.
When I try to run the project from Visual Studio it opens successfully in the browser in "localhost/#somePort" but when I try to type in just "localhost" into the browser, I get a 404 Error.
Please, any ideas on how to fix this? I think maybe some default files for IIS were changed/corrupted.
Usually from Visual studio if it's an ASP.net project it will run from the Web Developer test engine (which is a mini iis that runs on a random port)... You need to publish the project to IIS or copy the compiled output to a folder that is within your IIS's site's directory path and change that folder to an application (from the iis mmc console, right clicking on the folder and selecting Change to Application, I believe...
I wasn't sure about the "localhost/#somePort" but i'm assuming I am getting what you meant ;)
I just ran into the same problem. Apparently changing the bindings changes only the default site / and not the child virtual applications.
I found this article - http://www.carryoverbit.com/running-iis-on-localhost-only/
Incase the link is broken...
After editing the bindings in IISManager ("Edit Bindings..."), you need to use netsh and add 127.0.0.1 as a listener for http traffic.
Open command prompt (as admin)
netsh
netsh> http
netsh http> show iplisten
(empty list is shown)
netsh http> add iplisten 127.0.0.1
IP address successfully added
Now use iisreset and everything should work.

virtual directory not being configured as an application in IIS

hi i am comletly new to iis and asp.net i am trying to setup bugNET on a godaddy server. i created a virtual directory and once i tried to launch the site i get this error:
Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
here is complete detail of what i did.
hosting: godaddy
created virtual directory (child folder of root) - named: devbunk with these settings (anonymous access, directory browsing)
that is all i can do to with iis on godaddy.
the error tells me that i need to turn the virtual directory as an application. godaddy doesnt let me do that... how do i do it? btw, i have iis7 setup.
You can configure this with Godaddy Hosting Control Center. log in to godaddy hosting center.
Go to Content >> IIS Management.
Click on the pencil icon to edit your selected directory.
you will get a popped up screen with three check boxes. You need to check the one that says "Set Application Root".
Click Ok and your directory will be configured as an application in IIS.
Hope this helps you and feel free to ping me if you need more info.
You need godaddy to do that, usually hosters do offer the ability to convert a regular folder as an application through their Control Panel, so if you have access to one search for that option. Other hosters give access through IIS Manager and Web Deploy to convert folders to applications as well, but it boils down to "you need your hoster to do that".
There are no ways for you to do that through Web.config or FTP or etc. I think Front Page Server Extensions did had a way as well. The best thing is contact your hoster and ask them what is the right way of doing this. Usually all hosters will allow you to create as many applications as you need as long as they run the same .net version.
Check the properties on Web.Config to ensure "Copy to Output Directory" is set to "Do not copy"

IIS7 Authentication problem

I have deployed a web site to a Win 2008 Web server with IIS7. The site works fine on a Win 2003 Standard server with IIS6. On the 2008 box, whenever I request a page (htm or aspx) from a folder named Reports, I get challenged with the Windows Authentication dialog box.
I have Anonymous Authentication and Forms Authentication enabled on the site. I applied Full Control permissions to the root of the site for both NETWORK SERVICE and IIS_IUSRS, but that hasn't make a difference.
Like a previous post already mentioned, here are the detailed steps to fix this:)
If there is a folder in the application named "Reports" and SQL Server Reporting Services are installedon the server, then Reporting Services Virtual Directory folder that is also named "Reports" will be in conflict with the application "Reports" folder.
To fix this open Reporting Services Configuration Manager (Start->All Programs->MS SQL Server->Configuraton Tools) and change the Virtual Directory under the "Report Manager URL" in the menu on the left.
Did you install MSSQL Reporting Services on your new machine? It'll use the Reports folder for the reporting toolkit (default setting) and under MSSQL 2008 you can't enable anonymous Access out of the box.
whats is the authentication mode in your web.config, verify that is not in Windows
<authentication mode="Windows" />
also be sure to disable integrated windows authentication in iis
You could try running FileMon from SysInternals to see if it is the file system that is sending back the "access denied".
Quote from another forum that solved this issue for me:
"SQL Server Reporting Services creates a folder called Reports by default if you install it on IIS. If you install SQL 2008 then Reporting Services doesn't need to use IIS and instead will try to reserve the URL with the HTTP.Sys service.
I believe this is the cause of the conflict you are seeing. What you could try is changing the URL that Reporting Services uses via the SQL Server Reporting Services Configuration Manager."
Well speaking on the same subject here, yesterday I was deploying my application on Windows Server 2008 running IIS7 w/MSSQL 2008 on there too. In my website's tree structure I had a folder named Reports that had a subfolder in it, and then the actual pages. It looked like this "Reports/SalaryReports/SalaryReport.aspx" The interesting thing was that when I clicked on a hyperlink to go to "Reports/SalaryReports/SalaryReport.aspx" I got a username/password prompt from my server. This did not happen on the VS development server when I ran the application on the development machine. So I was like hmm? I looked at the code-behind in SalaryReport.aspx and did not find anything unusual. So then I put a Default.aspx directly in the Reports folder (thinking maybe it was something wrong with the authentication going two nodes down from the root to get to SalaryReport.aspx) but the server still requested username/password even though there was no security settings applied to this new Default.aspx. So I figured it must be that the folder is named "Reports", so I renamed it to "Reports1" and bigno! Everything worked!....I will still look further in this issue today, but it seems that either an IIS 7 HttpModule (not one of mine) is trying to "reserve" the folder that is named "Reports" for itself or something else...I'll look into the SQL Server Reporting services as the above post mentioned...
Anyways, just wanted to share:)
I'm supposing you don't have a SQL Reporting Services running on the same server:
1 - Give rights to user "IUSR" and the user that's running your application pool.
2 - Overwrite child folder permissions and ownership.
2 - Check if there's a web.config file on that folder setting different access rules.

Recreate the default website in IIS

I've accidentally deleted the default website in IIS; It no longer shows up in the tree of IIS manager and browsing "localhost" returns a 404 error.
I've re-installed IIS, but the default website still doesn't exist... Is it possible to recreate the default website so I can create my folder inside?
Other answers are basically right, thanks to them I was able to restore my default web site, they're just missing some more or less important details.
This was the complete process to restore the Default Web Site in my case (IIS 7 on Windows 7 64bit):
open IIS Manager
right click Sites node under your machine in the Connections tree on the left side and click Add Website
enter "Default Web Site" as a Site name
set Application pool back to DefaultAppPool!
set Physical path to %SystemDrive%\inetpub\wwwroot
leave Binding and everything else as is
Possible issues:
If the newly created web site cannot be started with the following message:
Internet Information Services (IIS) Manager - The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)
...it's possible that port 80 is already assigned to another application (Skype in my case :). You can change the binding port to e.g. 8080 by right clicking Default Web Site and selecting Edit Bindings... and Edit.... See Error 0x80070020 when you try to start a Web site in IIS 7.0 for details. Or you can just close the application sitting on the port 80, of course.
Some applications require Default Web Site to have the ID 1. In my case, it got ID 1 after recreation automatically. If it's not your case, see Re-create “default Website” in IIS after accidentally deleting. It's different for IIS 6 and 7.
Note: I had to recreate the Default Web Site, because I wasn't able to even open a project configured to run under IIS in Visual Studio. I had a solution with a couple of projects inside. One of the projects failed to load with the following error message:
The Web Application Project is configured to use IIS. The Web server 'http://localhost:8080/' could not be found.
After I have recreated the Default Web Site in IIS Manager, I was able to reload and open that specific project.
Did the same thing. Wasn't able to recreate Default Web Site directly - it kept complaining that the file already existed...
I fixed as follows:
Create a new web site called something else, eg. "Default", pointing to "C:\inetpub\wwwroot"
It should be created with ID 1 (at least mine was)
Rename the web site to "Default Web Site"
I suppose you want to publish and access your applications/websites from LAN; probably as virtual directories under the default website.The steps could vary depending on your IIS version, but basically it comes down to these steps:
Restore your "Default Website" Website :
create a new website
set "Default Website" as its name
In the Binding section (bottom panel), enter your local IP address in the "IP Address" edit.
Keep the "Host" edit empty
that's it: now whenever you type your local ip address in your browser, you will get the website you just added.
Now if you want to access any of your other webapplications/websites from LAN, just add a virtual application under your default website pointing to the directory containing your published application/website. Now you can type : http://yourLocalIPAddress/theNameOfYourApplication to access it from your LAN.
You can try to restore your previous state by doing the following:
Go to IIS Manager
Right-click on your Local Computer.
Point to All Tasks
Point to Backup/Restore Configuration
Select the configuration you want to restore
Wait untill configuration applies
Check out this answer on SuperUser:
In short: Reinstall both IIS and WAS.
In details -
Step 1
Go to "Add remove programs"
"Turn windows features on or off"
Remove both IIS and WAS (Windows Process Activation Service)
Restart the PC
Step 2
Go to "Add remove programs"
"Turn windows features on or off"
Turn on both IIS and WAS (Windows Process Activation Service)
Note: Reinstalling IIS alone won't help. You have to reinstall both IIS and WAS
This approach fixed the problem for me.
Follow these Steps
Restore your "Default Website" Website :
create a new website
set "Default Website" as its name
In the Binding section (bottom panel), enter your local IP address in the "IP Address" edit.
Keep the "Host" edit empty
I deleted the C:\inetpub folder and reinstalled IIS which recreated the default website and settings.

Resources