| ← Previous | ↑ Home | → Next |
dkwt _command_ [_options_]
The dkwt / dkwtadm program has the following functionality
For classroom PCs the programs can perform cleanup operations on machine boot and user login.
The dkwtadm.exe program is the same as dkwt.exe except it has a built-in manifest to ask for administrator permissions at startup.
| Command | Option | Purpose |
|---|---|---|
| users | Show users. | |
| -l | Long (detailed) output. | |
| -s | Short output. Options -l and -s are mutually exclusive. | |
| groups | Show groups. | |
| -l | Long (detailed) output. | |
| -s | Short output. Options -l and -s are mutually exclusive. | |
| printers | Show print queues. | |
| -l | Long (detailed) output. | |
| env | Modify environment. | |
| -s | Modify system environment. The default is to modify the current users environment. Administrative privileges are required to modify the system environment. |
|
| -e | Use REG_EXPAND_SZ type when creating new registry values. This option is ignored when modifying existing registry values. | |
| -u name | Unset variable by deleting the registry value specified by name. | |
| -i name value | Insert, make sure the named variable contains file/directory value. Insert at start of registry value if the path is not yet listed. | |
| -a name value | Append, make sure the named variable contains file/directory value. Append at end of registry value if the path is not yet listed. | |
| -d name value | Delete the file/directory specified as value from the variable. If the variable is empty after removal, remove the registry entry. | |
| boot | Cleanup up during machine boot process, requires dkwt.conf configuration file. | |
| -t | Test mode, do not perform cleanup actions, just show what to do. | |
| login | Cleanup and preparations on user login, requires dkwt.conf configuration file. | |
| -t | Test mode, do not perform cleanup actions, just show what to do. | |
| logout | Cleanup on user logout, requires dkwt.conf configuration file. | |
| -t | Test mode, do not perform cleanup actions, just show what to do. | |
| shutdown | Cleanup on machine shutdown process, requires dkwt.conf configuration file. | |
| -t | Test mode, do not perform cleanup actions, just show what to do. | |
| cleanup‑profiles clp |
Manually clean up profile directories. | |
| keep | Temporarily disable cleanup until after next user login. | |
| unkeep | Resume normal cleanup operation. |
For PCs in a classroom we can make the following assumptions:
We do not want to store user profiles on the server for the following reasons:
So we decide to use the following policies for data storage:
The account running the boot, logon, logoff and shutdown scripts on Windows Vista and above does not have sufficient privileges to delete user profile directories. That's technical progress.
Additionally the directory structure in user profiles is … There are symbolic links to parent and/or child directories, even programs shipped with Windows have problems to handle that. I.e. when using icacls.exe on a user profile there are problems with "infinite" loops finished by buffer size restrictions or invalid handle conditions.
So we do not apply any changes to user profiles from boot, logon, logoff or shutdown scripts, we just clean up the public directories.
In regular intervals someone needs to log in as administrator and run
dkwtadm cleanup-profiles
During user logout we use the logoff script to change permissions to public directories and the user profile: Full access is granted to the System user and to the Everyone role.
The dkwt.exe program runs icacls.exe or cacls.exe to do so.
Now we attempt to remove the user profile and the contents of the public directories. Typically this will fail for some files which are still in use, i.e. the file containing the HKCU registry hive.
The dkwt.exe program first attempts to delete files/directories using internal routines. If these routines fail the
RD /S /Q "directory"
DEL /Q /F "file"
commands are run.
To remove artefacts which were not deleted during logout we attempt again on system shutdown, on boot and on each user login.
In the system boot script there is the best chance to delete artefacts.
On a user login the profile directory of the user currently logging in is excluded from the attempts to remove user profiles.
Be carefully, cleaning up means deleting data! Configuration errors might result in loss of data!
Create a dkwt.conf file (see below).
Test the dkwt.conf file!
Create a system startup script containing the
dkwt boot
command.
Create a user logon script containing the
dkwt login
command.
Create a user logoff script containing the
dkwt logout
command.
Create a system shutdown script containing the
dkwt shutdown
command.
Special situation: system programming lectures:
If you teach system programming — i.e. building drivers for hardware — the system might crash or hang so you need a reset/reboot.
You should take the following precautions against loss of data when testing self-made drivers:
Create a registry key HKEY_LOCAL_MACHINE\Software\DKrause\Shared\dkwt and grant the Everyone or INTERACTIVE user or role full access to that key.
Teach your students to use
dkwt keep
before running any test.
Before logging out normally they should run:
dkwt unkeep
The "dkwt keep" command sets a DWORD named "keep" in the above registry key. If this DWORD is set to a not-0 value no cleanup is done by dkwt. So if there is any problem the user can reboot the machine (either normally or using the reset button) and login again without loosing data.
The DWORD is removed at the end of the next "dkwt"login", so at next "dkwt logout" normal cleanup will happen.
0 on success, all other status codes indicate an error.
If the dkwt.exe file resides in "C:\Program Files\Krause\bin" the recommended directory for dkwt.conf is "C:\Program Files\Krause\etc\dktools-site". Create the directory if it does not yet exist.
Example file:
[options]
system user = System
everyone user = Jeder
print jobs = local lp@printserver
[public]
c:\temp
[profiles C:\Users]
All Users
Default User
Public
Administrator
SophosSAUL-XY0
sshd_server
| Section | Option | Value | Purpose |
|---|---|---|---|
| [options] | General setup. | ||
| system user | Username | User name of the "System" user, optional, default: detect automatically. | |
| everyone user | Username | User name of the "Everyone" user, optional, default: detect automatically. | |
| print jobs | List of print queues to cleanup, LPRng print queues specified by queue@host, "local" for all local print queues. | ||
| [public] | Section containing public writeable directories, one per line. Each of these directories is cleaned up automatically. | ||
| [profiles] | Full path name | Parent directories where all user profile directories are placed. Each line in the section contains one subdirectory name not subject to automatic cleanup by:All directories you don't want to be deleted during must be listed here. Make sure to include the profile directories of all systems accounts in the list. |
After creating or modifying the file, run
dkwt boot -t
dkwt login -t
dkwt logout -t
dkwt shutdown -t
to see the files/directories to delete.
The program is only available on Windows platforms.
This program uses DK libraries version 3.
dkwt users -l
dkwt groups
dkwt printers -l
dkwt print x.prn
dkwt env -a PATH C:\MyDirectory
dkwt env -d PATH C:\MyDirectory
dkwtadm env -s -a PATH C:\MyDirectory
dkwtadm env -s -d PATH C:\MyDirectory
Make sure your dkwt.conf file is up to date, the [profiles] section must list the name of all profile directories to keep.
Run
dkwtadm cleanup-profiles
| ← Previous | ↑ Home | → Next |