Wednesday, March 19, 2008

How can I back up IIS settings?

There are a number of ways to do this. The properties and values set in the Internet Information Services Manager console (the IIS snap-in) are stored in the Metabase.bin file located at C:\winnt\system32\inetsrv by default. In IIS 5.0, you can back up the metabase from inside the IIS snap-in. To do this, select the computer icon and right-click. Then select Backup/Restore configuration. You can then choose to back up your current metabase settings or restore a previous version. This same option is also available in MetaEdit 2.2.
When you save the metabase in this way, your backup is stored in the C:\winnt\system32\instrv\metaback folder as an .md0 file. The file will have the name you assigned when you made the backup, such as Pre-Lockdown.md0. If you create multiple backups with the same name, they will have incremental extensions such as Backup.md0, Backup.md1, and so forth.
In the event that your metabase is seriously corrupted, you may be unable to start IIS. In that case, you will not be able to do a restore from the IIS snap-in or metaedit. Should this occur, you can restore by replacing Metabase.bin with the most appropriate .md0 (.md1, etc.) metabase backup file from the metaback folder. Assuming that your backups are good, IIS will start right up.
There are two other means to make a backup of the metabase. You can simply copy Metabase.bin using xcopy, scopy, or any other copy routine. You should stop the Internet services first so that your metabase is up to date and not in use.
Finally, there are two scripts provided—metaback.vbs and metarest.vbs—which are located in Inetpub\IISSamples\sdk\admin (if you installed the IIS SDK on IIS 5.0) or in the IIS Resource Kit\Utility\ADSI Admin Scripts folder (if you installed the IIS 4.0 Resource Kit). These .vbs scripts use an ADSI command specifically provided to make metabase backups.

How can I change the welcome banner that users see when they FTP into their web site on my Windows server?

  • Open Internet Information Services (IIS) Manager
  • Expand FTP sites
  • Right-click the respective FTP site, select Properties.
  • Click on the Messages tab

How can I create a file of a certain size in Windows?

If you need to create a file of a certain size and the file contents don't matter, you can use the Fsutil command as follows:
fsutil file createnew
For example,
fsutil file createnew d:\temp\1mbfile.txt 1000000
creates a 1MB file named 1mbfile.txt in the d:\temp folder.

How can I copy files and keep their security and permissions?

By default when you copy files from one NTFS partition to another, the files inherit their protections from the parent directory. It is possible to copy the files and keep their settings using the SCOPY program that comes with the NT resource kit. SCOPY can copy owner and security audit information:

SCOPY c:\savilltech\secure.dat d:\temp\ /o /a

would copy the owner and auditing information. You can also use /s to copy information in subdirectories.

The restriction for this command is that both the origin and target drives must be NTFS or the command will fail.

How can I change access permissions from the command line?

A utility called CACLS.EXE comes as standard with Windows, and can be used from the command prompt. Read the help with the CACLS.EXE program (cacls /?).

To give user "john" Read access to a directory called "files" enter:

CACLS files /e /p john:r

/e is used to edit the ACL instead of replacing it, therefore other permissions on the directory will be kept.

/p sets permission for user:

How can I change the port that Terminal Services is running on?

Run Regedt32 and go to this key:
HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp

Find the \"PortNumber\" subkey and notice the value of 00000D3D, hex for (3389). Modify the port number in Hex and save the new value. (You can select decimal in regedit and type in the port in normal digits)

NOTE: Because the use of alternate ports has not been fully implemented for Terminal Server 4.0, support will be provided as \"reasonable effort\" only, and Microsoft may require you to set the port back to 3389, if any problems occur.

you can select decimal in regedit and type in the port in normal digits

How can I disable Windows Update?

Disable the Automatic Updates service by opening the Services control panel (Start -> Settings -> Control Panel -> Administrative Tools -> Services)
Right-click on Automatic Updates, select Properties.
Click the Stop button
Change the Startup Type to \"Disabled\".

To disable Windows Update on a per user basis:

Start regedit.exe on the machine where you want to disable Windows Update.

Start regedit.exe on the machine where you want to disable Windows Update.
  • Go to HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer.
  • From the Edit menu, select New, DWORD value.
  • Enter a name of NoWindowsUpdate, and press Enter.
  • Double-click NoWindowsUpdate, and set it to 1.
  • Close regedit.

You don\'t need to reboot. If the user tries to start Windows Update, the system will display the following error message:

Windows Update was disabled by your system Administrator.