Sometimes it's inconvenient to use the Windows GUI to map a drive—this is a problem particularly in logon scripts. How do you use a batch file to tell the mouse pointer to move over to My Network Places? There's a better way. The net use command enables you to map any drive to any server on your network, and in some cases, outside networks, too. The syntax is:
net use drive \\server\share
To map drive H: to Lisa Johnson's home directory on server MERCURY:
net use H: \\mercury\users\lmjohnson
net use * \\mercury\users\lmjohnson
net use H: \\foreignmachine\sharename /user:foreigndomain\username
(If you need to use a password, you'll be prompted for it.)
net use \\mercury\users\lmjohnson /d
net use * /d
net use H: \\18.104.22.168\c$
net use H: \\22.214.171.124\c$ /user:hasselltech\hassell
And you can specify that this mapping is for the current session only and should not be restored upon logon. This is a feature that I call map persistency—keeping the same mappings across login sessions, a big timesaver for your users. To do so:
net use H: \\126.96.36.199\c$ /persistent:no
fsutil quota modify [VolumeOrDrive] [warninglevel] [hardquota] [username]
The drive letter or volume name of the disk on which you want to modify a quota. Volume names are tricky to specify because you must do so using the globally unique identifier (GUID), which can be a long string of seemingly random numbers.
The user to which this quota specification applies.
Using fsutil.exe, you can create scripts to automatically set quota entries upon new-user creation to work around the limitation of assigning quotas to groups, as described earlier in this chapter. fsutil.exe can help you access functionality more quickly and efficiently than you can by using the GUI interface. The following examples, designed to run from a command line, illustrate the quota functionality available through fsutil.exe.
fsutil quota disable C:
fsutil quota enforce E:
fsutil quota modify C: 250000000 lmjohnson
To list the current quotas set on drive D:
fsutil quota query D:
fsutil quota track F:
fsutil quota violations
Managing Offline Folders
net share nameofshare /CACHE:[manual | documents | programs | none]
/CACHE:manual enables manual client caching of programs and documents from this share. /CACHE: documents enables automatic caching of documents from this share. /CACHE:programs enables automatic caching of documents and programs (distinguished by their file extension) from this share. /CACHE:none disables caching from this share.
The GUI for managing shadow copies is somewhat complete; however, it lacks the ability to specify on which disk or volume shadow copies are stored. Also, an administrator cannot delete specific shadow copy files using the GUI. This might be needed if a user creates an incorrect version of a file, then leaves and another worker comes back the next day. An administrator might need to delete the previous version as soon as possible so that the new user doesn't inadvertently work from the incorrect version.
vssadmin Add ShadowStorage /For=C: /On=D: /MaxSize=150MB
This command specifies that storage for shadow copies (known as an association) of drive C: will be stored on drive D:. If a value is not specified, there is no limit to the amount of space shadow copies can use. Shadow copies require at least 100 MB of space, and you can specify the maximum amount in KB, MB, GB, TB, PB, and EB, although it's assumed if you don't use a suffix, the value is in bytes.
vssadmin Create Shadow /For=E: /AutoRetry=2
This command creates a new shadow copy of drive E:. The /AutoRetry switch dictates that if another process is attempting to make shadow copies at the same time vssadmin is attempting to make them, the utility will keep trying for two minutes.
vssadmin Delete Shadows /For=C: /Oldest
This command deletes the oldest shadow copy on drive C:. You can use the /all switch to instead delete all shadow copies that can be deleted. You also can specify a specific shadow copy to delete by using /Shadow=ID, where ID is the hexadecimal number you obtain through the List Shadows command, covered later in this section.
vssadmin Delete ShadowStorage /For=C: /On=D:
vssadmin Resize ShadowStorage /For=C: /On=D: /MaxSize=150MB
This command modifies the maximum size for a shadow copy storage association between drives C: and D:. Again, the maximum size has to be 100 MB or more. If you decrease the maximum size, older shadow copies can be deleted to make room for more recent shadow copies.
Other useful commands:
vssadmin List Providers
vssadmin List Shadows
vssadmin List ShadowStorage