Friday, June 15, 2007

Prepare web server for Intranet

Prepare web server for Intranet

1. Configure Website

Starting IIS manager, create a new web site ‘Intranet’.

Select ‘Web site’ -->'New’-->'Web site…’, System show ‘Web Site Creation Wizard’


Click ‘Next’.


Click ‘Next’


Click ‘Next’


Click ‘Next’


Click ‘Next’


Click ‘Finish’




Setting access right for site as below



Install java


  1. download java SDK from http://java.sun.com/javase/downloads/index.jsp

  2. Followed the screen instruction to install downloaded exe file.

  3. Edit environment variables ‘Path’, add ‘C:Program FilesJavajre1.6.0_01bin’.



Install Tomcat

  1. Download Tomcat from http://tomcat.apache.org/download-60.cgi

  2. Followed the on screen instructions to install downloaded exe file.

  3. Launch http://localhost:8080/ in explorer to confirm Tomcat installed successfully.



Install Tomcat & IIS connector


  1. Download Tomcat connector ‘isapi_redirect.msi’ from http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.15/.

  2. Run download msi file.

  3. Download last ‘isapi_redirect.dll’ and replace the one created in step 2.

  4. Add two environment variables ‘TOMCAT_HOME’ and ‘JAVA_HOME’.










Tuesday, May 15, 2007

Setup Java Web Start

When I request to start java program by request the jnlp file, the web server return the contains of the file, intead the program.

I look to the document in Sun's web site and found the reason that I need set the MIME type for JNLP.

Following is the document I read.

http://java.sun.com/developer/technicalArticles/WebServices/JWS_2/JWS_White_Paper.pdf

Friday, May 11, 2007

Link Apache 2.2 and Tomcat 5.5 on Windows

1. Download & install Apache 2.2
2. Download & install Tomcat 5.5
3. Download Tomcat connector, my file is 'mod_jk-apache-2.2.4.so', rename it to 'mod_jk.so' and save in 'modules' directory under Apache installation directory.
4. create a file called 'workers.properties', Below is the contents.

# workers.properties.minimal -
#
# This file provides minimal jk configuration properties needed to
# connect to Tomcat.
#
# The workers that jk should create and work with
#
worker.list=ajp13w
#

# Defining a worker named ajp13w and of type ajp13
# Note that the name and the type do not have to match.
#
worker.ajp13w.type=ajp13
worker.ajp13w.host=localhost
worker.ajp13w.port=8009
#

# Defining a load balancer
#
worker.wlb.type=lb

worker.wlb.balance_workers=ajp13w
#

# Define status worker
#
worker.jkstatus.type=status


5. add following text at the bottom of httpd.conf file

# add by wangzj for tomcat
# Load mod_jk module
LoadModule jk_module modules/mod_jk.so
# Where to find workers.properties
JkWorkersFile "C:\Program Files\Apache Software Foundation\Jakarta Isapi Redirector\conf\workers.properties"
# Where to put jk shared memory
JkShmFile "C:\Program Files\Apache Software Foundation\Jakarta Isapi Redirector\log\mod_jk.shm"
# Where to put jk logs
JkLogFile "C:\Program Files\Apache Software Foundation\Jakarta Isapi Redirector\log\mod_jk.log"
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the timestamp log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# Send servlet for context /examples to worker named worker1 JkMount /examples/servlet/* worker1
# Send JSPs for context /examples to worker named worker1
JkMount /examples/*.jsp worker1
# send context /THG to worker named ajp13w

JkMount /THG/* ajp13w


6. that is all.

Tuesday, January 23, 2007

Using Eclipse

for last release Ganymede

1. Download Eclipse IDE for Java EE Developers (163 MB) .


1. Download Eclipse 3.21. from http://www.eclipse.org/downloads/.
The download file is eclipse-SDK-3.2.1-win32.zip.

2. Extract to C:\Eclipse by winzip

3. Run Eclipse.exe, and create workplace at 'C:\Documents and Settings\wangzj\My Documents\My Eclipse Workplace'

4. install plugin
goto 'Help', then select 'Software Updates',
then select ' Find and Install',
then choice 'Search for new features to install' and click 'Next' button,
then choice 'Callisto Discovery Site' and click 'Finish' button,
after a while, choice plugins, then followed the instruction on screen to download and install plugins. for develop gwt, need wtp.

5.

Thursday, November 23, 2006

Windows NT/XP command line

An A-Z Index of the Windows NT/XP command lineADDUSERS Add or list users to/from a CSV file
ARP Address Resolution Protocol
ASSOC Change file extension associations
ASSOCIAT One step file association
AT Schedule a command to run at a later time
ATTRIB Change file attributes
BOOTCFG Edit Windows boot settings
BROWSTAT Get domain, browser and PDC info
CACLS Change file permissions
CALL Call one batch program from another
CD Change Directory - move to a specific Folder
CHANGE Change Terminal Server Session properties
CHKDSK Check Disk - check and repair disk problems
CHKNTFS Check the NTFS file system
CHOICE Accept keyboard input to a batch file
CIPHER Encrypt or Decrypt files/folders
CleanMgr Automated cleanup of Temp files, recycle bin
CLEARMEM Clear memory leaks
CLIP Copy STDIN to the Windows clipboard.
CLS Clear the screen
CLUSTER Windows Clustering
CMD Start a new CMD shell
COLOR Change colours of the CMD window
COMP Compare the contents of two files or sets of files
COMPACT Compress files or folders on an NTFS partition
COMPRESS Compress individual files on an NTFS partition
CON2PRT Connect or disconnect a Printer
CONVERT Convert a FAT drive to NTFS.
COPY Copy one or more files to another location
CSVDE Import or Export Active Directory data
DATE Display or set the date
Dcomcnfg DCOM Configuration Utility
DEFRAG Defragment hard drive
DEL Delete one or more files
DELPROF Delete NT user profiles
DELTREE Delete a folder and all subfolders
DevCon Device Manager Command Line Utility
DIR Display a list of files and folders
DIRUSE Display disk usage
DISKCOMP Compare the contents of two floppy disks
DISKCOPY Copy the contents of one floppy disk to another
DNSSTAT DNS Statistics
DOSKEY Edit command line, recall commands, and create macros
DSADD Add user (computer, group..) to active directoryDSQUERY List items in active directory
DSMOD Modify user (computer, group..) in active directory
ECHO Display message on screen
ENDLOCAL End localisation of environment changes in a batch file
ERASE Delete one or more files
EXIT Quit the CMD shell
EXPAND Uncompress files
EXTRACT Uncompress CAB files
FC Compare two files
FDISK Disk Format and partition
FIND Search for a text string in a file
FINDSTR Search for strings in files
FOR Conditionally perform a command several times
FORFILES Batch process multiple files
FORMAT Format a disk
FREEDISK Check free disk space (in bytes)
FSUTIL File and Volume utilities
FTP File Transfer Protocol
FTYPE Display or modify file types used in file extension associations
GLOBAL Display membership of global groups
GOTO Direct a batch program to jump to a labelled line
HELP Online Help
HFNETCHK Network Security Hotfix Checker
IF Conditionally perform a command
IFMEMBER Is the current user in an NT Workgroup
IPCONFIG Configure IP
KILL Remove a program from memory
LABEL Edit a disk label
LOCAL Display membership of local groups
LOGEVENT Write text to the NT event viewer.
LOGOFF Log a user off
LOGTIME Log the date and time in a file
MAPISEND Send email from the command line
MEM Display memory usage
MD Create new folders
MODE Configure a system device
MORE Display output, one screen at a time
MOUNTVOL Manage a volume mount point
MOVE Move files from one folder to another
MOVEUSER Move a user from one domain to another
MSG Send a message
MSIEXEC Microsoft Windows Installer
MSINFO Windows NT diagnostics
MSTSC Terminal Server Connection (Remote Desktop Protocol)
MUNGE Find and Replace text within file(s)
MV Copy in-use files
NET
Manage network resources
NETDOM Domain Manager
NETSH Configure network protocols
NETSVC Command-line Service Controller
NBTSTAT Display networking statistics (NetBIOS over TCP/IP)
NETSTAT Display networking statistics (TCP/IP)
NOW Display the current Date and Time
NSLOOKUP Name server lookup
NTBACKUP Backup folders to tape
NTRIGHTS Edit user account rights
PATH Display or set a search path for executable files
PATHPING Trace route plus network latency and packet loss
PAUSE Suspend processing of a batch file and display a message
PERMS Show permissions for a user
PERFMON Performance Monitor
PING Test a network connection
POPD Restore the previous value of the current directory saved by PUSHD
PORTQRY Display the status of ports and services
PRINT Print a text file
PRNCNFG Display, configure or rename a printer
PRNMNGR Add, delete, list printers set the default printer
PROMPT Change the command prompt
PUSHD Save and then change the current directory
QGREP Search file(s) for lines that match a given pattern.
RASDIAL Manage RAS connections
RASPHONE Manage RAS connections
RECOVER Recover a damaged file from a defective disk.
REG Read, Set or Delete registry keys and values
REGEDIT Import or export registry settings
REGSVR32 Register or unregister a DLL
REGINI Change Registry Permissions
REM Record comments (remarks) in a batch file
REN Rename a file or files.
REPLACE Replace or update one file with another
RD Delete folder(s)
RDISK Create a Recovery Disk
RMTSHARE Share a folder or a printer
ROBOCOPY Robust File and Folder Copy
ROUTE Manipulate network routing tables
RUNAS Execute a program under a different user account
RUNDLL32 Run a DLL command (add/remove print connections)
SC Service Control
SCHTASKS Create or Edit Scheduled Tasks
SCLIST Display NT Services
ScriptIt Control GUI applications
SET Display, set, or remove environment variables
SETLOCAL Begin localisation of environment changes in a batch file
SETX Set environment variables permanently
SHARE List or edit a file share or print share
SHIFT Shift the position of replaceable parameters in a batch file
SHORTCUT Create a windows shortcut (.LNK file)
SHOWGRPS List the NT Workgroups a user has joined
SHOWMBRS List the Users who are members of a Workgroup
SHUTDOWN Shutdown the computer
SLEEP Wait for x seconds
SOON Schedule a command to run in the near future
SORT Sort input
START Start a separate window to run a specified program or command
SU Switch User
SUBINACL Edit file and folder Permissions, Ownership and Domain
SUBST Associate a path with a drive letter
SYSTEMINFO List system configuration
TASKLIST List running applications and services
TIME Display or set the system time
TIMEOUT Delay processing of a batch file
TITLE Set the window title for a CMD.EXE session
TOUCH Change file timestamps
TRACERT Trace route to a remote host
TREE Graphical display of folder structure
TYPE Display the contents of a text file
USRSTAT List domain usernames and last login
VER Display version information
VERIFY Verify that files have been saved
VOL Display a disk label
WHERE Locate and display files in a directory tree
WHOAMI Output the current UserName and domain
WINDIFF Compare the contents of two files or sets of files
WINMSD Windows system diagnostics
WINMSDP Windows system diagnostics IIWMIC WMI Commands
XCACLS Change file permissions
XCOPY Copy files and folders

Wednesday, May 10, 2006

Create Digitally Signed for JAVA

1. Using keytool to create a key and assign it an alias and password:

keytool -genkey -alias wangzjkey -keypass wangzjpw
the -genkey argument generates a new key, which is 'wangzjkey' and password 'wangzjpw'.

if this is the first time keytool has been used, you'll be promopted for a password that protects access to the key database, which is called a keystore.

2. After a key is placed in the keystore, it can be used with the jarsigner tool to sign an archive file. This tool requires the keystore and key passwords and alias of the key. for example

jarsigner -storepass wangzjpw -keypass wangzjpw xxx.jar wangzjkey

the keystore password in this example is wangzjpw.

Thursday, February 16, 2006

AS400 SQL command

for sorting field ascending or descending, use key word ASC or DESC.

Tuesday, February 07, 2006

Adding a Border to an Image in photoshop elements 2.0

Step 1: Getting Started
Open an image you'd like to apply the border to
If the image is on the backgroud layer, double click the layer, name it and click OK

Step 2: Creating the Selection
Hold down the Command/Control key and click on the layer. This creates an active selection around the image.

Go to Edit > Stroke... to bring open the Stroke dialog window
Enter a value for the Width
Click the Color picker to select a color
Location indicates where the Stroke will be placed.

Thursday, November 10, 2005

upload file using Apache commons fileupload

I write servlet to process upload file recently, I found the apache commons fileupload is a suitable package for this kind of programming, following is the help message found in package.

Package org.apache.commons.fileupload Description
Component for handling html file uploads as given by rfc 1867 RFC 1867.
Normal usage of the package involves DiskFileUpload parsing the HttpServletRequest and returning a list of FileItem's. These FileItem's provide easy access to the data given in the upload. There is also a low level api for manipulating the upload data encapsulated in the MultipartStream class.
Normal usage example: public void doPost(HttpServletRequest req, HttpServletResponse res)
{
DiskFileUpload fu = new DiskFileUpload();
// maximum size before a FileUploadException will be thrown
fu.setSizeMax(1000000);
// maximum size that will be stored in memory
fu.setSizeThreshold(4096);
// the location for saving data that is larger than getSizeThreshold()
fu.setRepositoryPath("/tmp");
List fileItems = fu.parseRequest(req);
// assume we know there are two files. The first file is a small
// text file, the second is unknown and is written to a file on
// the server
Iterator i = fileItems.iterator();
String comment = ((FileItem)i.next()).getString();
FileItem fi = (FileItem)i.next();
// filename on the client
String fileName = fi.getName();
// save comment and filename to database
...
// write the file
fi.write("/www/uploads/" + fileName);
}
In the example above the first file is loaded into memory as a String. Before calling the getString method, the data may have been in memory or on disk depending on its size. The second file we assume it will be large and therefore never explicitly load it into memory, though if it is less than 4096 bytes it will be in memory before it is written to its final location. When writing to the final location, if the data is larger than the threshold, an attempt is made to rename the temporary file to the given location. If it cannot be renamed, it is streamed to the new location.

Monday, August 15, 2005

Some useful site

1. A good guide to port usage is available on the web at
http://www.sockets.com/services.htm

2. A detailed database of file extensions and programs that use them at
http://filext.com/index.php

3. A detailed list of MIME type
http://www.w3schools.com/media/media_mimeref.asp

Wednesday, August 03, 2005

List all queries in AS400

I recently need list all queries in AS400 and get the definistion of the query.

To do that,
First, run following command,

DSPOBJD OBJ(*ALLUSR/*ALL) OBJTYPE(*QRYDFN) OUTPUT(*OUTFILE)
OUTFILE(WZJLIB/QRYLIST)

Second, for each query in the file, run following command to retrive the definition,

RTVQMQRY QMQRY(&ODLBNM/&ODOBNM) SRCFILE(WZJLIB/QUERIES) ALWQRYDFN(*YES)

the full CL program is named as LISTQUERY.

Thursday, July 28, 2005

a Good JavaScript

Today, I found a good JavaScript, which include following function,

1. preventing user use 'right click', which can block user see the source of your page.

2. have a popup menu to allow user select date.

I copy the source as file name 'commonJS.txt' in my documents.

Monday, July 25, 2005

Solve problem on using Jbuilder 9.0 create Mail program

Recently, I create a program for data synchronization, when the synchronization is done, the program will send a email to inform me.

it is run perfectly in jbuilder, but when run the program created by using jBuilder 9 developer, it show following message:

javax.mail.SendFailedException: Sending failed;
nested exception is:
class javax.mail.MessagingException: IOException while sending message;
nested exception is:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;
boundary="----=_Part_0_31149935.1122348209343"
at javax.mail.Transport.send0(Transport.java:218)
at javax.mail.Transport.send(Transport.java:80)
at movex.sendMailClass.sendMail(sendMailClass.java:226)
at movex.SynTest.main(SynTest.java:80)

after search the internet, I found the solutio for it that we need manually exclude the files of SUN_MICR.RSA and SUN_MICR.SF from the META-INF folder in mail.jar.

To do it, following below steps.

From the jar's folder which on my Pc is 'C:\jBuilder9\lib':

0. copy mail.jar mailbackup.jar
1. mkdir jartemp
2. cd jartemp
3. C:\JBuilder9\jdk1.4\bin\jar -xvf ../mail.jar
4. cd META-INF
5. del SUN_MICR.*
6. cd..
7. C:\JBuilder9\jdk1.4\bin\jar cvf ../mail.jar *

you can delete jartemp now or later.

Then using new generated mail.jar in your jbuilder project.

Thursday, May 19, 2005

Some Useful Tip for EXCEL Visual Basic

1. Suppress alerts and Screen updating
It can be annoying to have to respond to system alerts or see the screen change and flicker while a macro is running. To suppress alerts and screen updating, add following two lines at the beginning of the macro,
Application.DisplayAlerts=False
Application.ScreenUpdating=False

don't forget to add following two lines at the end of the macro,
Application.DisplayAlerts=True
Application.ScreenUpdating=True


2. Error Handling
To trap error, using following statement at the beginning of code that you anticipate error will occur, On Error GoTo errorhandling


put your code here.....
On Error GoTo 0 ' resume
errorhandling:
put your error handling code here......
3. loop statements
  • Do While (condition) ... Loop
  • Do Until (condition) ... Loop
  • For i=Startvalue TO Endvalue Step Stepvalue ... Next
  • For Each ... Next
Example of 'For Each ... Next', To get the shape name which stored in one cell.
For Each Shape In Sheets("data").Shapes
With Shape
pt = .Top
pl = .Left
If (pt >= t) And (pt <= t + h) And (pl >= l) And (pl <= l + w) Then rtnstr = Shape.Name Exit For End If End With Next Shape

4. Convert between String and Numeric
Val(String) , Convert string to numeric.
Str(Number), Convert number to string.
format(number,"format "), Convert number to string
For other type conversion functions, search 'Type Conversion Functions' in Microsoft Visual Basic Help.
5. Get Workbook's name and path
name=ActiveWorkbook.Name
path= ActiveWorkbook.Path

6. Open other excel file
Workbooks.Open (ExcelFileName)
7. Insert picture fit in a Range
' inserts a picture and resizes it to fit the TargetCells range
Sub InsertPictureInRange(PictureFileName As String, TargetCells As Range)

Dim p As Object
Dim t As Double, l As Double, w As Double, h As Double
Dim ot As Double, ol As Double, ow As Double, oh As Double
If TypeName(ActiveSheet) <> "Worksheet" Then Exit Sub
If Dir(PictureFileName) = "" Then Exit Sub
' import pictureSet p = ActiveSheet.Pictures.Insert(PictureFileName)' determine positions
With TargetCells
t = .Top + 1
l = .Left + 1
w = .Offset(0, .Columns.Count).Left - .Left - 2
h = .Offset(.Rows.Count, 0).Top - .Top - 2
End With
' position picture
With p
oh = .Height
ow = .Width
.Top = t
.Left = l
.Width = ow * h / oh
.Height = h
.Placement = xlMoveAndSize
.PrintObject = True
End With
Set p = Nothing
End Sub

8. Wait untill called program finished
Some time in Excel VBA program, we use shell command to call other program, but by By default, the Shell function runs other programs asynchronously. This means that a program started with Shell might not finish executing before the statements following the Shell function are executed. to wait the called program finish, use following code.
first, define the calling for microsoft API
Private Declare Function OpenProcess Lib "kernel32" ( _ByVal dwDesiredAccess As Long, _ByVal bInheritHandle As Long, _ByVal dwProcessID As Long) As Long
Private Declare Function GetExitCodeProcess Lib "kernel32" ( _ByVal hProcess As Long, _IPExitCode As Long) As Long
then, write your VBA's sub or function procedure as below
Public Sub yoursub()
ACCESS_TYPE = &H400
STILL_ACTIVE = &H103
taskid = Shell(cmdline, vbHide)
hproc = OpenProcess(ACCESS_TYPE, False, taskid)
Do
Application.Wait (Now + TimeValue("0:00:01"))
GetExitCodeProcess hproc, lExitCode
Loop While lExitCode = STILL_ACTIVE
do other things....
end sub

9.Convert between string and date
dim A1 as string, outdate as date
dim ctyear as Integer, ctmonth as Integer, ctday as Integer
A1 = "20050701"
ctyear=CInt(Left(A1,4))
ctmonth=CInt(mid(a1,5,2))
ctday=CInt(right(a1,2))
outdate=DateSerial(ctyear,ctmonth,ctday)
'outdate = DateValue(Mid(A1, 5, 2) & "/" &amp;amp;amp; Right(A1, 2) & "/" & Left(A1, 4))
A1 = Format(outdate, "yyyymmdd")

10.Delete rows from title to the last row
Suppose the first tow lines are title, to delete the rows that is not title,
Dim tolcol As Integer, tolrow As Integer

Sheets("Result").Select
Selection.SpecialCells(xlCellTypeLastCell).Select
tolcol = ActiveCell.Column
tolrow = ActiveCell.Row
If (tolrow > 2) Then
Range(Cells(2, 1), Cells(tolrow, tolcol)).Select
Selection.EntireRow.Delete
End If
Range("A2").Select


11.Get last row and column of a sheet
Sheets(ssn).Select
 Selection.SpecialCells(xlCellTypeLastCell).Select
    tolcol = ActiveCell.Column
    tolrow = ActiveCell.Row


12.Find line break in cell
The line break in excel is alt+enter, is char(10). 
=FIND(CHAR(10),C439,1)
 


Tuesday, May 17, 2005

Link Tomcat 5.0 with IIS 6

Update on 05 July 2007 for tomcat 6.0:

1. when installing isapi-redirector, actually not need create entries in registry, just create a text file named ' isapi_redirect.properties' and put it in the same directory of 'isapi_redirect.dll'.
the contains of the file may be like below:

# Configuration file for the Jakarta ISAPI Redirector
# The path to the ISAPI Redirector Extension, relative to the website

# This must be in a virtual directory with execute privileges
extension_uri=/jakarta/isapi_redirect.dll

# Full path to the log file for the ISAPI Redirector
log_file=C:\Program Files\Apache Software Foundation\Jakarta Isapi Redirector\log\isapi_redirect.log

# Log level (debug, info, warn, error or trace)
log_level=info

# Full path to the workers.properties file
worker_file=C:\Program Files\Apache Software Foundation\Jakarta Isapi director\conf\workers.properties

# Full path to the uriworkermap.properties file
worker_mount_file=C:\Program Files\Apache Software Foundation\Jakarta Isapi Redirector\conf\uriworkermap.properties

2. after create virtual directory 'jakarta' in IIS6 or IIS7, need create web service extensions in order to allow jakarta to run,

for IIS6, click 'Add a new web service extension', then key in 'Extension name:" as 'jakarta'; 'Required files:' as 'isapi_redirect.dll' and check 'Set extension status to Allow'.

for IIS7, click 'Handler Mappings', then click 'Add Script Map...', then key in 'Request path:' as '.dll'; key in 'Executable' as ''isapi_redirect.dll' ; key in 'Name' as 'jakarta'.





Recently, I set up a intranet for our company, which running on Windows Server 2003, and web server is IIS 6. We use Apache Tomcat to serve the dynamic request from user, like sales report. There is a good link about how to link Tomcat 5.0 with IIS 6 on windows server 2003, which at http://tjworld.net/help/kb/0001_iis6-Tomcat5-JK2.html .

basically, the step is:
1. install JDK5.0

2. install tomcat

3. install isapi-redirector

4. on IIS, add a new extensions in web service extension.

5. restart server


to install admin service:
Files Needed:
jakarta-tomcat-5.5.9.exe
jakarta-tomcat-5.5.9-admin.zip
1. Install tomcat

2. Unzip the admin package (we'll call it context)

3. Copy the entire directory /server/webapps/adminto/server/webapps

4. Copy the file /conf/Catalina/localhost/admin.xml to /conf/Catalina/localhost

5. Restart your server.

Install jndi mail session

context.xml file:


web.xml file:

Resource reference to a factory for javax.mail.Session instances that may be used for sending electronic mail messages, preconfigured to connect to the appropriate SMTP server.
mail/Session
javax.mail.Session
Container


Finally, Your code should look like this...

Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
Session session = (Session) envCtx.lookup("mail/Session");
MimeMessage message = new MimeMessage( session );

FTP Service's DefaultLogonDomain Not Available in MMC

The FTP Service's DefaultLogonDomain is not available in the Microsoft Management Console (MMC), To work around this problem, we need manually add DefaultLogonDomain to the FTP Service in the MMC.

For NT4
you can use either of the following:
• The Metaedit.exe utility, included with the IIS 4.0 Resource Kit.
• The Adsutil.vbs utility that is included with IIS 4.0.

NOTE: By default, Adsutil.vbs is located in the \System32\Inetsrv\Adminsamples folder. Also, you must first install the Windows Script Host before using Adsutil.vbs.

Run Adsutil.vbs from a command prompt, using the appropriate syntax below (depending on whether you want to set DefaultLogonDomain for all FTP sites, just the default FTP site, or other sites):

•To set DefaultLogonDomain for all FTP sites, run the following command:
adsutil set msftpsvc/DefaultLogonDomain "DomainName"

•To set DefaultLogonDomain for only the default FTP site, run the following command:
adsutil set msftpsvc/1/DefaultLogonDomain "DomainName"

•if command listed above fails, you can use the following command instead, which uses the Mdutil utility from the Windows NT Option Pack compact disc:
mdutil.exe set /msftpsvc/1/DefaultLogonDomain "DomainName"

To set DefaultLogonDomain for any other site, use the same syntax as the default FTP site above, but change the "1" parameter to the appropriate service number.

for Windows Server 2000
You can use same method as for NT.

ADSUTIL.VBS runs under Windows 2000 and requires the installation of IIS. The file is usually located in the C:\Inetpub\AdminScripts directory.
MDUTIL.EXE file utility is included on the Windows 2000 CD-ROM as a zipped file. In order to install it on your computer, simply insert the Windows 2000 installation CD and execute a simple command:
expand -r d:\i386\mdutil.ex_ c:\winnt

For Windows Server 2003

In Windows Server 2003, stop IIS service, then add
DefaultLogonDomain="DomainName" in metabase.xml file at the section of
IIsFtpService.

the file is stored in directory: "C:\WINDOWS\system32\inetsrv".

Useful Link

http://www.windowsecurity.com/pages/article_p.asp?id=1297

http://support.microsoft.com/kb/184319