/build/static/layout/Breadcrumb_cap_w.png

Removing Data from the Appdata\Roaming folder

Hi All,

We are currently upgrading from workshare 5.2 to Workshare 8. I can uninstall workshare and I have a script that deletes both any remaining folders on the C drive and any HKLM reg keys. However we use roaming profiles so I need a way to delete both the %username%\appdata\roaming\Workshare and %username%\appdata\roaming\Workshare Upgrade folder or if thats not possible could you please advise if I could move the workshare appdata to the appdata\local folder thanks

4 Comments   [ + ] Show comments
  • You are already using a script, aren't you able to use the same script to serve this purpose. - 786_ak 10 years ago
    • There's another problem, he first needs to know the names of the profiles in C:\Users, because %username% uses the current logged in user in variable. - vos 10 years ago
  • Actually, he'll just use the variable for: %APPDATA%, this should take care of it. - 786_ak 10 years ago
  • But as he said, they are using ROAMING PROFILES, so user has to be logged on a machine to get his current profile loaded to C:\User\<username> folder.
    In my opinion you could use some script in ActiveSetup which will delete files from %APPDATA% at first logon. - rad33k 10 years ago
  • That's another approach. - 786_ak 10 years ago

Answers (4)

Posted by: Partridge2k 10 years ago
White Belt
1
if you wanted to use PowerShell then you could try something like this. There are shorter versions i'm sure but his has worked for me in the past.

#This gets the current username
$User = get-content env:username

#This sets the $Location to the Users Roaming folder
$Location = Set-Location -Path ("C:\users\" + $User + "\AppData\Roaming")

#This deletes the folders and its contents
Remove-Item ($Location + "Workshare") -Recurse
Remove-Item ($Location + "Workshare Upgrade") -Recurse
Posted by: Badger 10 years ago
Red Belt
1

If using an MSI route...
create the appropriate remove file tables, (yes this will only remove files for the person uninstalling), you  could add the script as a customaction, to do recursive check.

But do you need to??

If the app is uninstalled, the files in the user profile will remain, being 'orphaned', that's not such a big problem.

If there is a newer version of the app, and it doesn't get on well with the older version of the files, create the newer MSI to do a nice self repair to put down 'correct files' for the newer app.

OR, you could create a component to remove the old files, HKCU key path, when the repair happens it will remove the older files from the users profile. When the app launches, it should then create the files it needs.

Hopefully that will work and you wont have to set the correct orders for it to delete files, then copy new files.

good luck

 

Posted by: vos 10 years ago
White Belt
0
In batch it shoul be something like that:

dir /b C:\Users > dir.txt
FOR /F %%g IN (dir.txt) DO rmdir C:\%%G\AppData\Roaming\Workshare



Posted by: rock_star 10 years ago
4th Degree Black Belt
0
http://scriptingcenter.blogspot.in/2011/10/copy-file-to-appdata-based-on-operating.html

This script needs some modification but should help in anyway..

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ