Hello AppDeploy community!

Is there a way to delete the following file: C:\Documents and Settings\%PROFILE%\Local Settings\Application Data\Microsoft\Windows\UsrClass.dat

This file is in use as soon as the profile logs on.

I would like to delete it, if possible, right before the CTRL+ALT+DEL screen pops up? This is crucial since an application we use is down following an update, and Rebooting+Deleting this file by UNC Path fixes our problem.

Do you know of a way to do this?

I've tried HKLM\...\Run, which run too late.

Any help can be greatly appreciated.

Thanks a million!

0 Comments   [ - ] Hide Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity


Try creating a scheduled task on those machines to run at system startup. The command line will look something like this:

schtasks.exe /create /ru system /sc onstart /tn whatevername /tr "\"c:\whatevercommandyouwant\""

Keep in mind the escape characters if you do need to use quotation marks around the command path.
Answered 04/27/2010 by: Jsaylor
Second Degree Blue Belt

Please log in to comment

The old way to do it was with the wininit.ini - see here
My M.C.P. in Windows 95 still comes in useful, and it apparently still applies to Windows XP [:D]

But as your requirement is to remove a file out of each user profile then you just need a recursive search VB script - Here's the bones of something I've used in the past (grabbed from one of the vbs sites), you'll need to add your own error trapping etc. - there are plently of sites out there that will have other script samples.

You'll need to alter the file name and paths.

' Sample VB Script to remove a designated file (default is NORMAL.DOT) located in the profile folder for every user on the

' system. There is provision for exempting certain folders via the constant ProtectedUsers which is set to a comma separated

' list which can be altered according to your requirements


' You should alter constant DeleteProtectedUsers from FALSE to TRUE to delete *ALL* copies of the file regardless of profile


Const FileToDelete = "normal.dot"

Const AllUsers = "\All Users"

Const DeleteProtectedUsers = "FALSE"

Const TemplatesFolder = "Application Data\Microsoft\Word\STARTUP"

Const ProtectedUsers = "Default User,Administrator,All Users,NetworkService,LocalService"

Dim oFSO, oWSH

Dim sAllUsersProfile, oAllUsersFolder, sProfilesRoot, oFolder

Dim colFSOSubFolders

Dim protuserarray

Dim DeleteFlag

On Error Resume Next ' this is set because the designated file may be locked from deletion

protuserarray = Split(ProtectedUsers,",")

' Instantiate the objects

Set oFSO = CreateObject("Scripting.FileSystemObject")

set oWSH = CreateObject("WScript.Shell")

' Get the Allusers profile folder path first and from this determine profiles parent folder


sAllUsersProfile = oWSH.ExpandEnvironmentStrings("%ALLUSERSPROFILE%")

Set oAllUsersFolder = oFSO.GetFolder(sAllUsersProfile)

sProfilesRoot = oAllUsersFOlder.ParentFolder

' Now enumerate all existing user profile folders

Set oFolder = oFSO.GetFolder(sProfilesRoot)

Set colFSOSubfolders = oFolder.Subfolders

' Now go through each existing user profile folder looking for the designated file to delete

For Each objSubfolder in colFSOSubfolders

DeleteFlag = "TRUE"

if oFSO.FileExists(sProfilesRoot & "\" & objSubfolder.Name & "\" & TemplatesFolder & "\" & FileToDelete) then

' Found the file, now establish whether containing folder is on the exempt list

if NOT DeleteProtectedUsers then

For Each element in protuserarray

if ucase(element) = ucase(objSubfolder.Name) then

DeleteFlag = "FALSE" ' mark this occurrence of the designated file as exempt from deletion

exit for

end if


end if

If DeleteFlag then

' File was found in a folder that is not exempt, so go ahead and attempt to delete

oFSO.DeleteFile sProfilesRoot & "\" & objSubfolder.Name & "\" & TemplatesFolder & "\" & FileToDelete,TRUE

end if

end if


' Clean up before exiting

set oFSO = Nothing

set oWSH = Nothing

If you run it as a AD startup script then there won't be a logged on user to prevent the file being deleted.

Hope this points you in the right direction,

Answered 04/27/2010 by: dunnpy
Red Belt

Please log in to comment
Oh, something I forgot to mention that you'll want to pay attention to if you're going to use either dunnpy's or my suggestion. You'll have to include something that will stop the task from running every time the computer starts up. If you're using a scheduled task, your script to delete the file should also delete the task. If you're going to use a group policy startup script, make sure you include some sort of registry flag to query so that the script does not continue to delete those files on every system restart.
Answered 04/27/2010 by: Jsaylor
Second Degree Blue Belt

Please log in to comment