The Temple of Fu

code, systems and games

Archive for the ‘Windows’ Category

Move IIS Data Directory script

leave a comment »

I can’t remember how I got this script or from where but I have used it twice now so I am posting it here for others. If you are the original script author please let me know and i would be glad to tag it as such!

'------------------------------------------------------- '
' FILE: moveIISDataDirectory.vbs
' Used to migrate Web Data (FTP, WWW, SMTP) from drive C:\INETPUB to drive D:\INETPUB.
' This script can be modified to meet the need of any customers.
' Please do not remove this header info though.
'--------------------------------------------------------

'Stop IIS services before continuing

Set WSHShell = Wscript.CreateObject("Wscript.Shell")
WSHShell.PopUp "Stopping all Internet Services..."
ret = WshShell.Run ("net stop iisadmin /y", 1, TRUE)

If ret = 0 then
WSHShell.PopUp "IISADMIN service was stopped successfully, continuing"
'restart()
else
WSHShell.PopUp "IISADMIN failed to stop successfully. The error code is " & ret Wscript.Quit 1
end if

' Modify IIS Metabase Properties for new data location
Dim params(7)
Dim x, ret
Dim params2(3) Params(0) = "w3svc/1/root/path d:\inetpub\wwwroot"
Params(1) = "w3svc/1/root/scripts/path d:\inetpub\scripts "
Params(2) = "w3svc/1/root/iissamples/path d:\inetpub\iissamples"
Params(3) = "msftpsvc/1/root/path d:\inetpub\ftproot"
Params(4) = "smtpsvc/1/BadMailDirectory d:\inetpub\mailroot\BadMail"
Params(5) = "smtpsvc/1/PickupDirectory d:\inetpub\mailroot\Pickup"
Params(6) = "smtpsvc/1/QueueDirectory d:\inetpub\mailroot\Queue"
Params(7) = "smtpsvc/1/DropDirectory d:\inetpub\mailroot\Drop"

Set WshSysEnv = WshShell.Environment("PROCESS")

For Each x In Params
ret = WSHShell.Run ("cscript.exe " & "c:\inetpub\adminscripts\adsutil.vbs SET " & x, 1, TRUE)
Next

' Verify Settings were successfully applied
If ret = 0 then
WSHShell.PopUp "The new metabase settings have been successfully updated. The new Web Data path is D:\inetpub"
else
WSHShell.PopUp "The Configuration changes failed. The error code is " & ret Wscript.Quit 1
end if

wscript.Sleep 5000

' Move Data to new location (D:\inetpub) using xcopy.exe (this can be changed from xcopy to move so the data is actually moved from current locale)
ret = WSHShell.Run ("xcopy c:\inetpub d:\inetpub\ /s /e /q" , 1, TRUE)

If ret = 0 then
WSHShell.PopUp "The data has been successfully moved to d:\inetpub"
else
WSHShell.PopUp "The data move failed. The error code is " & ret Wscript.Quit 1
end if

' Update Web Catalog to be for d:\inetpub 'Stop Content Index Service
Set WSHShell = Wscript.CreateObject("Wscript.Shell")
WSHShell.PopUp "Stopping Index Service..."
ret = WshShell.Run ("net stop cisvc", 1, TRUE)

If ret = 0 then
chgeCat()
else
WSHShell.PopUp "Content Index service failed to stop successfully. The error code is " & ret Wscript.Quit 1
end if

Function chgeCat()
Set WshShell = WScript.CreateObject("WScript.Shell")

'Delete Catalogs '
WshShell.RegDelete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ContentIndex\Catalogs\Web\"

' Delete Web Catalog. '
WshShell.RegDelete "HKLM\SYSTEM\CurrentControlSet\Control\ContentIndex\Catalogs\System\"

' Delete System Catalog. 'Modify existing Web catalog entry
WshShell.RegWrite "HKLM\SYSTEM\CurrentControlSet\Control\ContentIndex\Catalogs\Web\Location", "d:\inetpub"
WshShell.RegWrite "HKLM\SYSTEM\CurrentControlSet\Control\ContentIndex\Catalogs\Web\IsIndexingW3Svc", 1, "REG_DWORD"
end function

'Start Services (WWW, FTP, SMTP, CISVC)
Set WSHShell = Wscript.CreateObject("Wscript.Shell")
WSHShell.PopUp "Attempting to restart stopped Services..."
Params2(0) = "w3svc"
Params2(1) = "msftpsvc"
Params2(2) = "cisvc"
Params2(3) = "smtpsvc"

For Each x In Params2
ret = WshShell.Run ("net start " & x, 1, TRUE)
wscript.Sleep 5000
Next

If ret = 0 then
WSHShell.PopUp "Services were started successfully, modifications complete"
else
WSHShell.PopUp "One or more services fail to start successfully. The error code is " & ret Wscript.Quit 1
end if

Written by lordfu

March 25, 2010 at 3:54 pm

Unable To Start Debugging on the Web Server because Integrated Windows Authentication is not enabled

leave a comment »

You ever received the error above?

To fix it open Start->Administrative Tools->Internet Information Services

Right click on the website that you are trying to enable debugging on and click “Properties”.

Then click the “Directory Security” tab.

Then click edit on “Anonymous Authentication and Access” control.

Check the box that says “Integrated Windows Authentication”

That should be it.

Written by lordfu

March 20, 2010 at 2:44 pm

ClearType font rendering in XP for Firefox or any other application

leave a comment »

So I was comparing the output of a web application I am working on in Internet Explorer and Firefox when I noticed that the fonts looked bad in Firefox (fonts just look way better in IE).

Unfortunately this adjustment will do nothing for the end users of my application that use another web browser other than Internet Explorer or even if then run another operating system (since this is a Windows display feature) but this will help you my faithful blog reader.

If you want ClearType font rendering on any font that Windows XP displays (so all applications), all you have to do is enable ClearType through the display properties.

  • Right click on the desktop and choose Properties.
  • Click on the Appearance tab and then choose the Effects… button.
  • In the ‘Use the following method to smooth edges of screen fonts:’ choose ClearType.
  • Click OK
  • Click Apply
  • Check out your results!

I had Firefox open the entire time and noticed the results as soon as I clicked apply.

Hope that helps someone!

Written by lordfu

February 17, 2010 at 6:54 pm

Posted in Windows

HTTP 401.3 – Access denied by ACL on resource Internet Information Services – Metabase Acess Denied

leave a comment »

So you created a virtual directory for a website and get that error eh?

Right click the folder itself and under the security tab add the Everyone group read and execute permissions. Now you can see it.

Now if you get this error as well

Failed to access IIS metabase.
I did after installing IIS for the first time, and after updating .NET versions also.
Aspnet_regiis.exe is a command line utility that installs ASP.NET features to Internet Information Server (IIS). You find it in your c:\windows\microsoft.net\framework\v#.### directory. Installable components include such things as:

* An ISAPI Filter – used by IIS to direct incoming requests to the appropriate asp.net runtime engine based on the extension (e.g. .asp, .aspx)
* Script Maps – configuration settings in each IIS node that specify how various extensions are processed.
* Client Validation Scripts – /aspnet_client Javascripts that provide dynamic behavior to web form validation controls
* Options for encrypting asp.net configuration (*.config) files.
* etc
To uninstall and then reinstall using aspnet_regiis open a command prompt and descend into the directory for the version of .NET you are using (remember that 3.5 uses 2.0* as of this writing anyways) and unregister and then reregister the .NET Framework with IIS

aspnet_regiis.exe -u

aspnet_regiis.exe -i

Hope that helps.

Written by lordfu

February 4, 2010 at 3:44 am

Exchange 2003 RPC Over Http Setup – Outlook 2007 Outlook Anywhere Client Setup

with 4 comments

Wow, so this has been around 4 hours since I started this configuration but I finally got it! These notes are here for you in hopes that some piece of this will help you out.

So what is RPC over Http?

“RPC over HTTP/S is a cool method for connecting your Outlook 2003 client to the corporate Exchange Server 2003 from the Internet or WAN, without the need to establish a VPN session to the corporate LAN and/or needing to open many ports on your corporate firewall. The only ports you’ll need to open on your firewall are TCP 80 and, if using SSL, TCP 443.”

Note: This procedure is not required on SBS and that SBS fully configures Exchange for RPC over HTTPS and also provides instructions to connect an Outlook client on the ‘Configure Outlook over the internet’ link on RWW https://sbs/remote.

Another Note: The example provided here is for a Single server setup – In this scenario, you have only one server that is configured to function as a Domain Controller, a Global Catalog, an Exchange computer, and an RPC proxy server. This article discusses the single-server configuration in detail.

Install the RPC component on the Exchange server

   1. On the Exchange Server 2003 computer that is running Windows Server 2003, click Start, point to Control Panel, and then click Add or Remove Programs.
   2. Click Add Remove Windows Components, click Networking Services, and then click Details.
   3. Click to select the RPC over HTTP Proxy check box, click OK, and then click Next. Note that you must have either the Windows Server 2003 installation CD ready, or the i386 folder from that CD accessible while installing this component.
When Windows Component Wizard has completed configuring components, click Finish.

Configure the RPC virtual directory in Internet Information Services

After you configure the Exchange computer to use RPC over HTTP/S, you must configure the RPC virtual directory in Internet Information Services (IIS).

To do this, follow these steps:
   1. Click Start, point to Administrative Tools, and then click Internet Information Services (IIS) Manager.
   2. Expand servername (local computer), expand Web Sites, expand Default Web Site, right-click Rpc, and then click Properties.

Note: Windows Server 2003 Service Pack 1 (SP1) adds a new virtual directory called RpcWithCert. This virtual directory points to the same location as the Rpc virtual directory. You do NOT need to modify this virtual directory.

   1. Click the Directory Security tab, and then click Edit under Authentication and access control.
   2. Click to clear the Enable anonymous access check box.
   3. Click to select the Basic authentication (password is sent in clear text) check box.You will receive the following message:

“The authentication option you have selected results in passwords being transmitted over the network without data encryption. Someone attempting to compromise your system security could use a protocol analyzer to examine user passwords during the authentication process. For more detail on user authentication, consult the online help. This warning does not apply to HTTPS(orSSL) connections. Are you sure you want to continue?” Click Yes

   4. Enter the domain name in the Default Domain box (you can press Select to browse to the domain name).
   5. Click OK.
   6. Click Apply, and then click OK.
   7. Click the Directory Security tab, and then click Edit under Secure communications.
   8. Click to select the Require secure channel (SSL) check box and the Require 128-bit encryption check box.

Configure the RPC proxy server to use specific ports

After you configure the RPC over HTTP networking component for Internet Information Services, configure the RPC proxy server. Configure the RPC proxy server to use specific ports to communicate with the directory service and with the information store on the Exchange computer.

Download this tool RpcNoFrontEnd

Run the tool on your Exchange server, the defaults were fine for my situation.

Configure all your global catalogs to use specific ports for RPC over HTTP for directory services

Exchange Server 2003 Service Pack 1 note: Exchange Server 2003 Service Pack 1 has a new built-in RPC over HTTP/S GUI setting on the Exchange Server properties page in Exchange System Manager. If you configure the RPC over HTTP/S option from the GUI, there is NOT need to make any manual changes in the Registry.

To make the changes via the GUI follow these steps:

   1. Click Start, point to Microsoft Exchange, and then click System Manager.
   2. Expand your organization, expand Administrative Groups > First Administrative Group > Servers.
   3. Right-click on your server name and select Properties.
   4. Verify that a tab called RPC-HTTP is present.
   5. On the RPC-HTTP tab, click on RPC-HTTP Back-End Server.
You get an error:
Exchange System Manager There is no RPC-HTTP front-end in your Exchange organization. There must be at least one RPC-HTTP front-end server in the organization before the RPC-HTTP back-end server can be accessed.
Acknowledge the error.
   1. Click Ok all the way out.
   2. You need to reboot your server for the settings to take place.

Note: You can also use the Rpccfg tool to set and to troubleshoot port assignments. The Rpccfg tool is included in the Windows Server 2003 Resource Kit tools
To use the tool open a command prompt and enter
rpccfg /hd

Note: If you do not see output from the above ‘rpccfg /hd’ comman when you run it then you have a configuration issue, repeat the above steps untill you get output. Once you get the desired output then take note of it, you will use it when setting up the Outlook Anywhere client.

Congrats!!!, the Exchange server is now set up to use RPC-HTTP! :)

Outlook Anywhere Client Setup

After configuring RPC over HTTP/S you’ll need to configure your Outlook 2003 client to use the RPC over HTTP/S connection method instead of the regular TCP/IP method.

To set up a new Outlook profile that uses RPC over HTTP/S:

  1. Open Control Panel and run the Mail applet.
  2. In the Mail applet click on Show Profiles.
  3. In the Mail window click on Add.
  4. In the New Profile window type a descriptive name and click Ok.
  5. In the E-Mail Accounts window select Add a new e-mail account and click Next.
  6. In the E-Mail Accounts window, select Microsoft Exchange Server and click Next.
  7. In the E-Mail Accounts window, under the Microsoft Exchange Server box, type the Internal NetBIOS name of the Exchange server. Next, in the User Name box type the logon name of the test user account, the one you’ll be connecting with.
  8. In the Microsoft Exchange Server window, go to the Connection tab. Notice that you should have a section called “Exchange over the Internet” at the bottom of the tab. If this section does not appear, it means that you might not have met the requirements for setting up an RPC over HTTP/S connection. In the Exchange over the Internet section click to select the Connect to my Exchange mailbox using HTTP, and then click on the Exchange Proxy Settings button.
  9. In the Exchange Proxy Settings tab in the Connection Settings box, type the FQDN (Fully Qualified Domain Name) of the Exchange server.

Note: For LAN testing you CAN type the Internal FQDN i.e.(servername.domain.local)of the server. For WAN connections you MUST type the External FQDN of the server i.e.(servername.domain.com) See Testing RPC over HTTP/S Connection for more on this issue. The external FQDN of the server is the fully qualified domain name that is used by the Outlook clients to connect to the server from outside the LAN, and must be resolved to the IP address of the server, or in most cases, resolved to the IP address of your Firewall (or NAT device) that is configured to transfer the requests to the internal IP address of the Exchange 2003 server.When done, click Ok.
  10. Back in the Microsoft Exchange Server window click Ok.
  11. Back in the E-Mail Accounts window click Next.
  12.Back in the Mail window, click to select Prompt for a profile to be used (unless you only have one profile, duh…), then click Ok.

Now, open Outlook and try to connect to the server. If you have problems connecting it usually is a FQDN issue or user credentials issue.

Resources:
http://www.petri.co.il/how-can-i-configure-rpc-over-https-on-exchange-2003-single-server-scenario.htm#gc
http://www.petri.co.il/configure_outlook_2003_to_use_rpc_over_http.htm

Written by lordfu

January 24, 2010 at 4:26 pm

Posted in Exchange, Outlook, Windows

Follow

Get every new post delivered to your Inbox.