i need to create user accounts in windows 7 OS , so that when the user logout from the system all the session files such as desktop , temp files and cookies are get deleted.

Dani AI

Generated

For a public/session Windows 7 workstation the goal is the same stated: make each session ephemeral so Desktop, Temp and browser data don’t persist. Choose one of two reliable patterns depending on whether machines are standalone or domain‑managed, and test thoroughly before rolling out.

Mandatory (read‑only) profile: build a single “template” account, configure the desktop and lock down settings, copy that profile as the default/mandatory profile and rename NTUSER.DAT to NTUSER.MAN. Users get the configured desktop but changes are not saved between sessions — an ideal kiosk solution. Microsoft documents the mandatory‑profile approach and how to customize the default profile. (learn.microsoft.com)

Domain / lab scenario: use a roaming/managed approach instead of per‑machine local profiles. Turn on the Group Policy that removes cached copies of roaming profiles at logoff, or use the “delete profiles older than X days on restart” policy for periodic cleanup; both are GPO settings under System → User Profiles. For environments that need immediate removal with scripting, delete local profiles from the system context (not Explorer) using WMI/CIM — e.g.:

# PowerShell (run elevated / as SYSTEM on startup)
Get-CimInstance Win32_UserProfile | Where-Object { $_.Special -eq $false -and $_.Loaded -eq $false } |
    Where-Object { [Management.ManagementDateTimeConverter]::ToDateTime($_.LastUseTime) -lt (Get-Date).AddDays(-1) } |
    Remove-CimInstance

or the WMIC form shown in Microsoft guidance. (learn.microsoft.com)

Troubleshooting & cautions: file locks can prevent full deletion (leftover empty folders or Event ID 1533/1511). If deletions fail, run cleanup at machine startup under SYSTEM (so files aren’t locked by the user), exclude system/default profiles, and test browser behavior — some browsers keep files locked or store data outside the profile. Microsoft documents these failure modes and the need to run deletions from system context. (support.microsoft.com)

Summary recommendation: for one‑off public PCs use a mandatory profile; for labs use roaming + “delete cached copies” or a startup cleanup script that removes Win32_UserProfile entries. As implied, the exact steps depend on whether the machine is domain‑joined; and as pointed toward automation, prefer a well‑tested automated cleanup (GPO or system startup task) rather than manual deletion.

Recommended Answers

All 2 Replies

Are you using any kind of server? Which flavour of Windows 7 (Home, Pro, etc)? It would help to know the intention (is this for a public access machine for non-repeated users? do you want any information retained that was generated?).

you can create a policy and/or logout script to perform that function.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.