Message from discussion
Delete everything except command - for profile deletion?
Date: Fri, 04 Feb 2005 21:45:25 +0100
From: "Torgeir Bakken \(MVP\)" <Torgeir.Bakken-s...@hydro.com>
Organization: Gjett to ganger
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040113
X-Accept-Language: en-us
MIME-Version: 1.0
Subject: Re: Delete everything except command - for profile deletion?
References: <57441BDF-BA56-4D8E-A5B7-382413E59318@microsoft.com>
In-Reply-To: <57441BDF-BA56-4D8E-A5B7-382413E59318@microsoft.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <erMVprvCFHA.2572@tk2msftngp13.phx.gbl>
Newsgroups: microsoft.public.windowsxp.general
NNTP-Posting-Host: 44-49-164-136.hydro.com 136.164.49.44
Path: g2news1.google.com!news4.google.com!newshub.sdsu.edu!msrtrans!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
Lines: 1
Jason Ryon wrote:
> Is there a way to run a command or script which will delete
> everything in a folder, except a few exception folders?
>
> The reason I ask is that I would like users profiles to be deleted
> from the local computer when they log out. I was thinking I would
> just put this as a logout script to remove all folders in the
> C:\Documents and Settings except Administrator, Default User, and
> All Users folder.
Hi
You can use Delprof.exe, as long as it is ok that the Administrator
profile is deleted (no big deal really, it will be recreated
automatically when you log on with the Administrator account, getting
the settings from the Default User profile").
If you run the command "Delprof.exe /Q", it will delete all existing
profiles on a computer (but not the profile of the user that runs
Delprof).
It will not touch any other folders in the "C:\Documents and Settings"
folders, such as "All Users", "Default User, "LocalService" and
"NetworkService", it will only delete "real" user profiles.
Delprof.exe is in the free Windows Server 2003 Resource Kit:
http://www.microsoft.com/downloads/details.aspx?FamilyID=9d467a69-57ff-4ae7-96ee-b18c4790cffd&DisplayLang=en
(The kit will install on WinXP or later, the individual files can
then be copied to other computers if needed)
--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx