Solved

Logoff Script To Wipe Cache Data Not Working In Citrix PvD

Posted on 2016-10-19
8
75 Views
Last Modified: 2016-11-01
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.
PvD makes two profiles for the user
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?
0
Comment
Question by:Paul Wagner
  • 3
  • 3
  • 2
8 Comments
 
LVL 54

Expert Comment

by:McKnife
ID: 41851587
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).
0
 
LVL 5

Author Comment

by:Paul Wagner
ID: 41852524
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.
0
 
LVL 54

Assisted Solution

by:McKnife
McKnife earned 100 total points
ID: 41852673
The difference: I thought, you would not even have a full session in front of you so that was the only way to access cmd - I was wrong, obviously. You know, some remote desktop solutions don't offer full sessions.

About your problem: I guess it is something easy: your user has 2 profiles, an old one and a current one. The current one is c:\users\testuser.domain. And in that folder, there is no such path that you are trying to delete files in. Or is there a folder c:\users\testuser.domain\AppData\LocalLow\Google\GoogleEarth\webdata ?

What you might not know: when we try to delete test user by removing his user object in local account management, his profile folder is not removed. So when we reinstate that username a 2nd time, the new profile folder won't be the same (c:\username), but instead c:\username.domain - I guess that is what has happened here. You have a new profile, the new profile has no google earth data yet - nothing to delete. You are looking at the wrong profile folder.
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 17

Accepted Solution

by:
Spike99 earned 400 total points
ID: 41852971
The variable %userprofile% generally points to the User's profile folder on the C: drive (%userprofile% points to C:\users\%USERNAME%, usually).

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?

If that takes you anywhere else other than the network location for the PvD in question, I would change the script to use the user name variable (%USERNAME%) instead of the user profile variable (%USERPROFILE%).

So, assuming the server location for the user's PvD is \\FILESERVER\PvD$\%username%, try changing those lines to this:
del /q /f /s \\FILESERVER\PvD$\%USERNAME%\AppData\LocalLow\Google\GoogleEarth\webdata
del /q /f /s \\FILESERVER\PvD$\%USERNAME%\AppData\LocalLow\Google\GoogleEarth\unified_cache_leveldb_le

del /q /f /s \\FILESERVER\PvD$\%USERNAME%.DOMAIN\AppData\LocalLow\Google\GoogleEarth\webdata
del /q /f /s \\FILESERVER\PvD$\%USERNAME%.DOMAIN\AppData\LocalLow\Google\GoogleEarth\unified_cache_leveldb_le

Open in new window

0
 
LVL 5

Author Comment

by:Paul Wagner
ID: 41861427
@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

0
 
LVL 54

Expert Comment

by:McKnife
ID: 41861734
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.
0
 
LVL 17

Expert Comment

by:Spike99
ID: 41862523
Did that revised script work as you would like it to?
0
 
LVL 5

Author Closing Comment

by:Paul Wagner
ID: 41869254
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.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If your vDisk VHD file gets deleted from the image store accidentally or on purpose, you won't be able to remove the vDisk from the PVS console. There is a known workaround that is solid.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
This Micro Tutorial will give you basic overview of the control panel section on Windows 7. It will depth in Network and Internet, Hardware and Sound, etc. This will be demonstrated using Windows 7 operating system.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

761 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question