Jump to content

Recommended Posts

Posted

My HT has a problem on his Windows 7 64 Bit workstation. Most of his file and programme associations have suddenly changed to Adobe Reader.

 

Logging him off and logging on myself my Associations are normal. How do I change his so they are as well? Anyone come across this before?

Posted (edited)

What I have tried - so far!

 

In Users Created a New Folder where I copied his Desktop and Download Folders.

 

Renamed his User Folder.

 

Got him to log on - twice so far but Windows came up with a message both times saying it had provisioned a temporary desktop and despite Roaming Profile had not given direct access to his documents either. They were available through his mapped drives though.

 

Created links on his current desktop to the old Desktop and Download folders and from there his documents and folders have the right associations again.

 

I hope that after he logs off and logs on again the correct profile gets picked up again. Odd one isn't it. He did have an item of Malware on his PC which MalwareBytes has seen off.

Edited by speckytecky
Posted

If cant just do that with profile in Windows 7 so you have stuffed it. copy the favourites, desktop and other stuff to a folde rin the c drive.

 

reboot login as a local admin and run this batch file. It will delete all existing profiles and reset the registry. Get the HT to log in again and then copy the stuff back manaully. It will resolve the temporary desktop issue.

 

@ECHO OFF

:: --------------------------------------
::
:: Windows 7 User Profile Cleaning Script
:: Version 3.1
::
:: Written by Mike Stone
:: [email protected]
:: http://mstoneblog.wordpress.com
::
:: --------------------------------------
::
:: Welcome!  This script is designed to automate the process of flushing
:: user profiles within Windows 7, while at the same time preserving
:: profiles of your choosing, including domain users.
::
:: This script is written as an example of wanting all domain users wiped
:: except for the one called "pctest".
::
:: Portions of the script that will require manual edits will be preceded
:: by instructions with these "double colon" comment marks.
::
:: Please let me know how well (or not well) this works for you or any
:: features you can think of that could be added.
::
:: --------------------------------------

title Windows 7 User Profile Cleaning

:: ----------
:: Add any users you wish to exclude from the wipe to the "userpreserve"
:: line below and separate them by commas.  Be careful - these are
:: case-sensitive.
:: ----------

:USERPRESERVE
set userpreserve="Administrator,All Users,UpdatusUser,Default,Default User,Public,pctest,netadmin,flemingz,rodakz,wadsworthh,suddephatts,shutdown,profile"

FOR /f "tokens=*" %%a IN ('reg query "hklm\software\microsoft\windows nt\currentversion\profilelist"^|find /i "s-1-5-21"') DO CALL :REGCHECK "%%a"
GOTO VERIFY

:REGCHECK
set SPACECHECK=
FOR /f "tokens=3,4" %%b in ('reg query %1 /v ProfileImagePath') DO SET USERREGPATH=%%b %%c
FOR /f "tokens=2" %%d in ('echo %USERREGPATH%') DO SET SPACECHECK=%%d
IF ["%SPACECHECK%"]==[""] GOTO REGCHECK2
GOTO USERCHECK

:REGCHECK2
FOR /f "tokens=3" %%g in ('reg query %1 /v ProfileImagePath') DO SET USERREGPATH=%%g
GOTO USERCHECK

:USERCHECK
FOR /f "tokens=3 delims=\" %%e in ('echo %USERREGPATH%') DO SET USERREG=%%e
FOR /f "tokens=1 delims=." %%f IN ('echo %USERREG%') DO SET USERREGPARSE=%%f
ECHO %USERPRESERVE%|find /I "%USERREGPARSE%" > NUL
IF ERRORLEVEL=1 GOTO CLEAN
IF ERRORLEVEL=0 GOTO SKIP

:SKIP
ECHO Skipping user clean for %USERREG%
GOTO :EOF

:CLEAN
ECHO Cleaning user profile for %USERREG%
rmdir "C:\Users\%USERREG%" /s /q > NUL
ECHO Cleaning user registry for %USERREG%
reg delete %1 /f
IF EXIST "C:\Users\%USERREG%" GOTO RETRYCLEAN1
GOTO :EOF

:RETRYCLEAN1
ECHO Retrying clean of user profile %USERREG%
rmdir "C:\Users\%USERREG%" /s /q > NUL
IF EXIST "C:\Users\%USERREG%" GOTO RETRYCLEAN2
GOTO :EOF

:RETRYCLEAN2
ECHO Retrying clean of user profile %USERREG%
rmdir "C:\Users\%USERREG%" /s /q > NUL
GOTO :EOF

:VERIFY
FOR /f "tokens=*" %%g IN ('reg query "hklm\software\microsoft\windows nt\currentversion\profilelist"^|find /i "s-1-5-21"') DO CALL :REGCHECKV "%%g"
GOTO REPORT

:REGCHECKV
set SPACECHECKV=
FOR /f "tokens=3,4" %%h in ('reg query %1 /v ProfileImagePath') DO SET USERREGPATHV=%%h %%i
FOR /f "tokens=2" %%j in ('echo %USERREGPATHV%') DO SET SPACECHECKV=%%j
IF ["%SPACECHECKV%"]==[""] GOTO REGCHECKV2
GOTO USERCHECKV

:REGCHECKV2
FOR /f "tokens=3" %%k in ('reg query %1 /v ProfileImagePath') DO SET USERREGPATHV=%%k
GOTO USERCHECKV

:USERCHECKV
FOR /f "tokens=3 delims=\" %%l in ('echo %USERREGPATHV%') DO SET USERREGV=%%l
FOR /f "tokens=1 delims=." %%m IN ('echo %USERREGV%') DO SET USERREGPARSEV=%%m
ECHO %USERPRESERVE%|find /I "%USERREGPARSEV%" > NUL
IF ERRORLEVEL=1 GOTO VERIFYERROR
IF ERRORLEVEL=0 GOTO :EOF

:VERIFYERROR
SET USERERROR=YES
GOTO :EOF

:REPORT
IF [%USERERROR%]==[YES] (
	set RESULT=FAILURE
)		ELSE (
	set RESULT=SUCCESS
)

:EXIT
exit

:EOF

  • Thanks 1
Posted (edited)

It's to do with Windows keeping a record in the registry that it has the profile locally, when it tries to logon it looks at the reg key and goes after the profile location stored there, when it can't find it the temp profile is used.

 

You may not need to recreate the profile though, if you can restore the profile then delete this key:

If this only happens on one user profile open Regedit and remove this key

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts.lnk

A quick log out and log in and the user should be right as rain again.

registry - How to reset shortcuts (.lnk file) in Windows 7? - Super User

 

Had a simmilar issue at one point (with temp profiles) thanks to a rather nasty network issue and ended up using this Delprof2 – User Profile Deletion Tool | Helge Klein | Home of SetACL which I heard about on here as a startup and shutdown machine script. It does a clean up like the above script. With us it was cleaning out cached profiles though.

 

Edit: Oh and for good measure, try Foxit Reader instead instead, much less corrupty:)

Edited by SYNACK
  • Thanks 1
Posted

Thanks for the replies FN and Synack. I incorrectly said earlier that we have Roaming Profiles - looking at AD I see there is nothing in the profile path it's all done by a login.bat file.

 

I have got the HT to log on to another Win 7 64 Bit PC and the desktop hasn't pulled up on that one either - would that be because by renaming his local user file on his original PC that's locked it?

 

Looking at his folder on the Domain I see his Documents and Desktop folders are there and the content looks normal. Would I be right in thinking I'm going to need to release his locked profile on the original PC before trying any of the above?

Posted
If cant just do that with profile in Windows 7 so you have stuffed it. copy the favourites, desktop and other stuff to a folde rin the c drive.

 

reboot login as a local admin and run this batch file. It will delete all existing profiles and reset the registry. Get the HT to log in again and then copy the stuff back manaully. It will resolve the temporary desktop issue.

 

GIANT WALL OF CODE!!!

 

 

Damn, I need someone to teach me how to do that...

Posted

If there is no profile path it probably means that it is using local profiles and redirected folders through GPO. The policy path could also be set through GPO but this is rare and problematic.

 

It may even all be local so what I would do is take a copy of the profile on the original machine into a folder outside the users folder then rename the original back so that it was the way it was/unlocked. Log in as the user and kill the user reg key as above in my post then log off and back on which should reset all the file assosiations to default fixing both problems.

  • Thanks 1
Posted

SYNACK you are not just a Mod you are a God! - no blasphemy intended.

 

This worked a treat. thanks a huge heap mate.

 

 

If there is no profile path it probably means that it is using local profiles and redirected folders through GPO. The policy path could also be set through GPO but this is rare and problematic.

 

It may even all be local so what I would do is take a copy of the profile on the original machine into a folder outside the users folder then rename the original back so that it was the way it was/unlocked. Log in as the user and kill the user reg key as above in my post then log off and back on which should reset all the file assosiations to default fixing both problems.

  • Thanks 1

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...