Modifying NTFS Properties

Microsoft® Windows® 2000 Scripting Guide

microsoft windows 2000 scripting guide

« Previous | Next »   

NTFS is a more sophisticated file system than either FAT or FAT32. Because NTFS tracks additional attributes, such as quota information, reparse points, and file and folder permissions, NTFS typically provides slower access to files and folders on small volumes (less than 1 GB). On larger volumes, however, the superior search algorithms used in NTFS often make NTFS faster than either FAT or FAT32.

However, unlike FAT or FAT32, NTFS allows you to modify the way the file system works. In some cases, this enables NTFS to work faster and more efficiently, thus negating the performance advantage FAT or FAT32 might have on some volumes. The NTFS properties are not exposed directly. However, you can configure the properties by modifying the registry entries shown in Table 10.9.

Caution

  • Changing the registry with a script can easily propagate errors. The scripting tools bypass safeguards, allowing settings that can damage your system, or even require you to reinstall Windows. Before scripting changes to the registry, test your script thoroughly and back up the registry on every computer on which you will make changes. For more information about scripting changes to the registry, see the Registry Reference on the Windows 2000 Server Resource Kit companion CD or at http://www.microsoft.com/reskit.

Table 10.9   Registry Entries for NTFS Properties

Registry Entry/Data TypeDescription
NtfsDisable8dot3NameCreation

REG_DWORD

Do one of the following:
  • Set the value to 0 to enable the creation of 8.3 file names.
  • Set the value to 1 to disable the creation of 8.3 file names.

You must restart the computer before this change takes effect.

NtfsAllowExtendedCharacterIn8Dot3Name

REG_DWORD

Do one of the following:
  • Set the value to 0 to limit 8.3 file names to the ASCII character set.
  • Set the value to 1 to allow the use of extended characters in 8.3 file names.
NtfsMftZoneReservation

REG_DWORD

Do one of the following:
  • Set the value to 1 to reserve one-eighth of the volume for the MFT. This is recommended for volumes with relatively few files.
  • Set the value to 2 to reserve one-fourth of the volume for the MFT. This is recommended for a volume with a moderate number of files.
  • Set the value to 3 to reserve three-eighths of the volume for the MFT. This is recommended for a volume with a moderate number of files.
  • Set the value to 4 to reserve one-half of the volume for the MFT. This is recommended for volumes with a large number of files.
NtfsDisableLastAccessUpdate

REG_DWORD

Do one of the following:
  • Set the value to 0 to enable updating of the last access timestamp.
  • Set the value to 1 to disable updating of the last value timestamp. This is most effective for folders that contain 100,000 or more files.
Win31FileSystem

REG_DWORD

Do one of the following:
  • Set the value to 0 to enable the use of long file names and extended timestamps. MS-DOS and Windows 3.x computers can access the files but cannot update the timestamps.
  • Set the value to 1 to disable the use of long file names and extended timestamps. Only those features of the FAT file system that are available to Windows 3.1 and earlier are used.

You must restart the computer before this change takes effect.

Scripting Steps

Listing 10.18 contains a script that modifies the NTFS file system properties on a computer. To carry out this task, the script must perform the following steps:

  1. Create a constant named HKEY_LOCAL_MACHINE and set the value to &H80000002. The Standard Registry Provider requires this value when connecting to the HKEY_LOCAL_MACHINE portion of the registry. (For more information about using the WMI Standard Registry Provider, see the "Registry" chapter in this book.)
  2. Create a variable to specify the computer name.
  3. Use a GetObject call to connect to the WMI namespace root\default:StdRegProv on the computer, and set the impersonation level to "impersonate."
  4. Set the variable strValueName to the path within the HKEY_LOCAL_MACHINE portion of the registry (System\CurrentControlSet\Control\FileSystem).
  5. Set the variable strValueName to the name of the entry being modified (Win31FileSystem).
  6. Use the SetDWORDValue method to configure the new registry entry. This method requires the following parameters:
    • HKEY_LOCAL_MACHINE Constant required to access HKEY_LOCAL_MACHINE
    • strKeyPath Registry path within HKEY_LOCAL_MACHINE
    • strValueName Registry entry being modified
    • dwValue New value for Win31FileSystem

Listing 10.18   Modifying File System Properties

1 2 3 4 5 6 7 8 9 10 11 12 
const HKEY_LOCAL_MACHINE = &H80000002 strComputer = "." Set objRegistry = GetObject _     ("winmgmts:{impersonationLevel=impersonate}!\\" & _         strComputer & "\root\default:StdRegProv") strKeyPath = "System\CurrentControlSet\Control\FileSystem" strValueName = "Win31FileSystem" dwValue = 1 objRegistry.SetDWORDValue _     HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue

send us your feedback Send us your feedback « Previous | Next »   


Microsoft Windows 2000 Scripting Guide(c) Automating System Administration 2003
Microsoft Windows 2000 Scripting Guide(c) Automating System Administration 2003
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 635

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net