Jump to content

Batch File Needed??- Profile Problem


Recommended Posts

Posted

HI

 

Can any one tell me what commands to use to run a bat file to delete C:\Documents and Settings in XP, if poss not delete all users and administrator and so on. Iv tried a few i found on the net bout they dont work.

 

Some times students cant log back into the same computers and comes up with this;

 

Windows cannot copy file \\DOMAIN NAME\NETLOGON\PROFILE NAME\Local Settings\Temporary Internet Files\Content.IE5\CXSEFUAE\afe%253Dactive%2526sa%253DX%2526gbv%253D2%2526tbs%253Disch%3A1;ce=1;je=1;sr=1440x900x32;dg=E10094-W-MS-8;dst=1;et=1267108058677;tzo=0;a=p-36POJYHTosuxU[1].gif to location C:\Documents and Settings\USERNAME\Local Settings\Temporary Internet Files\Content.IE5\CXSEFUAE\afe%253Dactive%2526sa%253DX%2526gbv%253D2%2526tbs%253Disch%3A1;ce=1;je=1;sr=1440x900x32;dg=E10094-W-MS-8;dst=1;et=1267108058677;tzo=0;a=p-36POJYHTosuxU[1].gif. Possible causes of this error include network problems or insufficient security rights. If this problem persists, contact your network administrator.

 

DETAIL - The filename or extension is too long.

 

 

Iv hit a dead end on this any help,

 

If i could run a bat file to just delete all profiles on log off that would be good.

Posted

use a combination of delprof and the user hive profile clean tool from microsoft

 

delprof is well documented on here

 

Overview

The User Profile Hive Cleanup service helps to ensure user sessions are completely terminated when a user logs off. System processes and applications occasionally maintain connections to registry keys in the user profile after a user logs off. In those cases the user session is prevented from completely ending. This can result in problems when using Roaming User Profiles in a server environment or when using locked profiles as implemented through the Shared Computer Toolkit for Windows XP.

 

On Windows 2000 you can benefit from this service if the application event log shows event id 1000 where the message text indicates that the profile is not unloading and that the error is "Access is denied". On Windows XP and Windows Server 2003 either event ids 1517 and 1524 indicate the same profile unload problem.

 

To accomplish this the service monitors for logged off users that still have registry hives loaded. When that happens the service determines which application have handles opened to the hives and releases them. It logs the application name and what registry keys were left open. After this the system finishes unloading the profile.

Guest TheLibrarian
Posted

You could use a batch file, however the delprof command is exactly what you want already.

 

Indeed just run it with the /i /q switches.

 

Seriously that is all you need.

Posted (edited)

:eek: Why try to re-write something that is already there and works perfectly well, probably better than anything you will be able to make using batch anyway, what have you got to prove, that you can script in cmd? :bored:

 

Just use delprof!

 

EDIT: I've got one for you....

 

 

@ECHO OFF

:START

ECHO YOUR DAFT...STOP TRYING TO CREATE WORK FOR YOURSELF BY RE-WRITING DELPROF!

GOTO START

 

No seriously though, you do know that you want to be deleting the folders inside Docs and Setts not the Docs and Setts folder itself.

 

D

Edited by danrhodes
Posted

LOL!!.

 

Ok with delprof, could you go through it how to set it up to suto delete, without going round each pc please.

I ran it on one PC and it comes up with delete all INACTIVE profiles?? I want it to delete every single one

Posted

Are you running mandatory profiles - it looks like it from the server location and the fact that this is a logon message.

 

Assuming that is the case, the problem isn't that you've got old profiles on the workstation but you've got rubbish in your server copy of the profile.

 

On the server, go to the profile folder (c:\windows\sysvol etc) and delete the "local settings" folder completely

 

What it looks like is happening is that you've set up a profile at some point in the past, copied it to the server so that your users can use it but you've included all the stuff that's not intended to be on the server (that's kind of why it's called "local settings")

Posted

As stated above delprof should work, we ended up using this ages ago I can't even remember why now :) but it works very well. We set it to run at start up, simply add users that you DON'T want deleting to the 'Call DeleteFolders' line. Save it as a .vbs file and put it in netlogon.

 

' Deletes local profiles from hard disk at MACHINE STARTUP this prevents logon problems when the profile is copied from the 'server

On Error Resume Next

Sub DeleteFolders(strRoot, strExclude)

On Error Resume Next

	Dim fso, f, fc, folder, arrExcl, folderName, folderPath, i, isExcl

arrExcl = Split(strExclude, ",")

  	Set fso = CreateObject("Scripting.FileSystemObject")
  	Set f = fso.GetFolder(strRoot)
For Each folder in f.SubFolders

	folderName = LCase(folder.name)
	folderPath = LCase(folder.path)

	isExcl = False

	i = 0
	Do While i < UBound(arrExcl) + 1

		If Lcase(arrExcl(i)) = folderName Then 
			isExcl = True	
		End If

	i = i + 1
	Loop	

	If isExcl = False Then
		fso.DeleteFolder folderPath, True
	End If	
	
Next   
End Sub


Call DeleteFolders("c:\documents and settings\", "administrator,All Users,Default User,NetworkService,LocalService")

'Usage: DeleteFolders("full path to folder, ending in \", "list of folders to be excluded, separated by a comma, no slashes")

Posted
Is there no way of just making a BAT file to delete?? with some commands, I just dont know what ones.

 

we use

 

c:\> For /f %a in ('net view ^| find "" /i') do delprof /c:%a /q /i

Posted
I just have the logon script removing any temp and temp internet files at logon from both local PC and server profile area as well as stopping them syncing using group policies (although doesn't always seem to work on older domains).
Posted (edited)
we use

 

c:\> For /f %a in ('net view ^| find "" /i') do delprof /c:%a /q /i

 

 

 

Can you describe what it's doing there? I've read that there's a way to use a text file to list PC's that you want it to clear profiles on and exclude certain profiles. Is this the case?

 

Thanks.

 

EDIT

 

Think i've found a good link.

 

http://www.ozzu.com/mswindows-forum/delprof-tool-t83230.html

Edited by cookie_monster
Posted

a for loop allows you to perform an operation on each item in a list. how the list is created occurs inside the brackets. we search the network for specific name prefixes, or you could also echo a txt file with the type command.

 

the best reference site for dos comands is SS64.com Command line reference

 

I don't know anything about excluding certain profiles, however with find there's an exclusion switch ( /v) and you can repeat piped exclusions ( | find /v ... | find /v ... etc)

 

it seems plausible if you were to delete profiles with with just del or rd, that you could do

 

for "get a list a list of computers" do

-----for "get a list of profiles for that computer excluding ones you dont want" do

----------del the profiles in the resulting list.

Posted (edited)
Ok so does delprof leave certain profiles by default e.g. All Users, Administrator etc?

 

yes it does

 

It'll leave All Users, Default User and Administrator alone.

 

if i remember correctly

 

waiting to be flamed now............

 

just download the latest one from MS

Edited by round2it
Posted
yes it does

 

It'll leave All Users, Default User and Administrator alone.

 

if i remember correctly

 

waiting to be flamed now............

 

just download the latest one from MS

 

yeah basically - think there are one or two other ones it leaves alone as well ( default user and something else - cant remember as not used xp properly for a while )

Posted
yeah basically - think there are one or two other ones it leaves alone as well ( default user and something else - cant remember as not used xp properly for a while )

 

i can not remember what the other one was either :)

  • 2 months later...
Posted

Anyone found a proper solution to this problem?

 

Summary of problem:

The problem occurs when a user with a mandatory roaming profile logs onto a website that generates a really long file name (e.g. many of the BBC games). Even though that file does not exist on the server copy of the profile, windows thinks it's copying it to the local machine and this causes a Windows to throw a hissy fit because the file's too long.

 

Sort of solution

There are various workarounds (many of which don't work) basically involving delprof/script deleting the profile on shutdown. I've added my users to the Domain Guests group, which causes their profile to be deleted on logoff. This seems to work most of the time however, the problem still occurs. It's often enough still be annoying.

 

I think it might not work when the user visits a problem site and there is an ungraceful shutdown – so the profile is not getting deleted.

 

I could spend half a day faffing about with Delprof and startup scripts but if anyone’s got a combination that works, that’d be really appreciated.

 

Why the hell hasn’t Microsoft fixed this? It’s clearly a bug and I’ve never had it until IE8.

 

Eean is off to consider Firefox!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...