Modifying NTFS Properties
Microsoft® Windows® 2000 Scripting Guide
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 Referenceon the Windows 2000 Server Resource Kit companion CD or at https://www.microsoft.com/reskit.
Table 10.9 Registry Entries for NTFS Properties
Registry Entry/Data Type |
Description |
---|---|
NtfsDisable8dot3NameCreation REG_DWORD |
Do one of the following:
You must restart the computer before this change takes effect. |
NtfsAllowExtendedCharacterIn8Dot3Name REG_DWORD |
Do one of the following:
|
NtfsMftZoneReservation REG_DWORD |
Do one of the following:
|
NtfsDisableLastAccessUpdate REG_DWORD |
Do one of the following:
|
Win31FileSystem REG_DWORD |
Do one of the following:
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:
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.)
Create a variable to specify the computer name.
Use a GetObject call to connect to the WMI namespace root\default:StdRegProv on the computer, and set the impersonation level to "impersonate."
Set the variable strValueName to the path within the HKEY_LOCAL_MACHINE portion of the registry (System\CurrentControlSet\Control\FileSystem).
Set the variable strValueName to the name of the entry being modified (Win31FileSystem).
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 |
|