Link to home
Start Free TrialLog in
Avatar of Paul Wagner
Paul WagnerFlag for United States of America

asked on

Logoff Script To Wipe Cache Data Not Working In Citrix PvD

We have a XenDesktop 7.5 environment that uses PvD and UPM.

We are trying to conserve space on each person's PvD so we don't have to manually reset it as often. Currently, the PvDs are getting full too often. Our current attempt is to wipe Google Earth cache data on logoff since that uses up quite a bit of space.

Here is our current script:
@echo off
if %os%==Windows_NT goto WINNT
goto NOCON

:WINNT
echo .Using a Windows NT based system
echo ..%computername%

echo Delete Google Earth Cache
del /q /f /s "%USERPROFILE%\AppData\LocalLow\Google\GoogleEarth\webdata
del /q /f /s "%USERPROFILE%\AppData\LocalLow\Google\GoogleEarth\unified_cache_leveldb_leveldb2
echo deleted!

goto END

:NOCON
echo Error...Invalid Operating System...
echo Error...No actions were made...
goto END

:END

Open in new window


The GPO is working, but we aren't seeing the cached data getting wiped, and I think I know why.
When going to the PvD of my test VM, I can see that Citrix is setting two profiles for the user.
User generated image
My understanding is that since the LocalLow folder (where Google Earth cache is stored) isn't handled by UPM, that the LocalLow will stay with the PvD on the local machine.

I think the script is looking in the "testuser.domain" folder and not in the "testuser" folder since the %USERPROFILE% that is logged in the "testuser.domain" account.

How can I get the script to wipe the webdata and unified_cache_leveldb_leveldb2 folders?
Avatar of McKnife
McKnife
Flag of Germany image

Why don't you run it manually, for a start? For example, you could use Chrome's "open file" menu to navigate to cmd.exe, and start a cmd where you can examine, what the deletion commands do/don't do.
Press CTRL-O in chrome, navigate to C:\Windows\System32\cmd.exe, right click it and select "open". Now launch your commands.

Also, make sure that your script runs at all by adding a line
md %userprofile%\test
to set a marker.

And close those " at the end of your del-commands (although it does not matter, here, since there are no blanks).
Avatar of Paul Wagner

ASKER

What's the difference in launching a cmd from the start menu vs. doing it in chrome? Just a different way of accessing the cmd?

Now launch your commands.
I assume you mean to launch them in the .bat file.
I launched it and it said the system could not find the path specified.

The test folder was created in the "testuser.domain" folder. It looks like the "testuser" folder is only there to store LocalLow information.

Oh! I didn't catch the quotes. Thanks for mentioning that.
SOLUTION
Avatar of McKnife
McKnife
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
@McKnife
your user has 2 profiles, an old one and a current one.
Not quite. The "testuser" folder only has the LocalLow folder and the "testuser.domain" folder has Local and Roaming. This is the case regardless of how many times I logon/logoff or delete the folders. After talking to a UPM engineer, I realize this behavior is because LocalLow is not handled by UPM, so it makes another folder.


@Spike99
If you log on as that user & type "%userprofile% in Window explorer, does it take you to the C: drive location or to the PvD location?
Going to %userprofile% will take me to the list of folders for the user (desktop, downloads, etc.) but they are all redirects linked to a file server.
With that said, going to "%userprofile%\appdata" will take me to the PvD.

I love the idea to your script, but there's a problem. The PvD isn't stored on a "\\FILESERVER". It is stored with the VM itself, so I used %computername%?

So, it would look this?:
del /q /f /s "\\%computername%\p$\Users\%USERNAME%\AppData\LocalLow\Google\GoogleEarth\webdata"

There's a problem with "%USERNAME%.DOMAIN". I can't navigate to it in explorer.
I found that to get to the testuser.domain profile, I actually need to use %USERPROFILE%.
... BUT, that doesn't really matter because LocalLow and Google Earth cache isn't stored in "testuser.domain", so we don't even need those entries. I made a modified entry for it in case it ever weirdly decided to show up there.

So, with all of that said, here's what I have:
@echo off
if %os%==Windows_NT goto WINNT
goto NOCON

:WINNT
echo .Using a Windows NT based system
echo ..%computername%

echo Delete Google Earth Cache
del /q /f /s "\\%computername%\p$\Users\%USERNAME%\AppData\LocalLow\Google\GoogleEarth\webdata"
del /q /f /s "\\%computername%\p$\Users\%USERNAME%\AppData\LocalLow\Google\GoogleEarth\unified_cache_leveldb_leveldb2"
del /q /f /s "\\%computername%\p$\Users\%USERPROFILE%\AppData\LocalLow\Google"
echo deleted!

goto END

:NOCON
echo Error...Invalid Operating System...
echo Error...No actions were made...
goto END

:END

Open in new window

Whatever you say. But if there is a folder
%USERPROFILE%\AppData\LocalLow\Google\GoogleEarth\webdata present, then a del command would work. The script does not work any different to just logging on as user and open a command shell and execute the del commands manually. If those fail (path not found), then there is no doubt: this user does not have that folder.
Did that revised script work as you would like it to?
Yes, the script is working, but I think the issue is that LocalLow is not redirected via UPM with Local and Roaming. Because of this fact, I believe the parameters are not ideal: the profile is splintered.

I am going to keep this script and find a way to redirect LocalLow into UPM so that the entire profile is in one folder. If that happens, I can then worry about one folder instead of two.

Thank you both for your help.