Solved

Logoff Script To Wipe Cache Data Not Working In Citrix PvD

Posted on 2016-10-19
8
50 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 53

Expert Comment

by:McKnife
Comment Utility
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 3

Author Comment

by:Paul Wagner
Comment Utility
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 53

Assisted Solution

by:McKnife
McKnife earned 100 total points
Comment Utility
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
 
LVL 16

Accepted Solution

by:
Spike99 earned 400 total points
Comment Utility
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 3

Author Comment

by:Paul Wagner
Comment Utility
@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 53

Expert Comment

by:McKnife
Comment Utility
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 16

Expert Comment

by:Spike99
Comment Utility
Did that revised script work as you would like it to?
0
 
LVL 3

Author Closing Comment

by:Paul Wagner
Comment Utility
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

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

When we have a dead host and we lose all connections to the ESXi, and we need to find a way to move all VMs from that dead ESXi host.
Veeam Backup & Replication has added a new integration – Veeam Backup for Microsoft Office 365.  In this blog, we will discuss how you can benefit from Office 365 email backup with the Veeam’s new product and try to shed some light on the needs and …
This tutorial will walk an individual through the process of configuring basic necessities in order to use the 2010 version of Data Protection Manager. These include storage, agents, and protection jobs. Launch Data Protection Manager from the deskt…
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.

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now