Jump to content
Welcome to our new Citrix community!
  • 0

"Delete locally cached profiles on logoff" Citrix policy does not work with local profiles?


Dawid Bbn

Question

Hi guys,

 

1. 
I am strying to use Citrix Policy and Citrix Profile Management to automatically delete users' profiles after they log off. I want ot avoid any log off scripts.

 

I would expect that if ONLY "Enable profile management" and "Delete locally cached profiles on logoff" policies are enabled, it would be enough to get profiles deleted on after logoff.

However, this works fine ONLY when users are using a TEMPLATE profile Citrix policy (i.e. "Path to the template profile") but if LOCAL profiles are used on servers, then the "Delete locally cached profiles on logoff" is not working.

Is it normal behavior or I am missing something?
 


2.
Another question, when a user in Active Directory have a Homedrive enabled (Profile->Home Folder->Connect), Citrix PM caches the profile there. Is there any way of disabling this behavior WITHOUT disabling Citrix Profile Management in Citrix Policy? I don't want users to use template profiles and use local profiles only.
 

Thanks!

 

 

CVAD Service

WS 2019

VDA 2012

 

 

 

image.thumb.png.af52d22c868baaf4f31bf70baca2f275.png

image.png

Link to comment

2 answers to this question

Recommended Posts

  • 0

Hi There, 

 

Not a direct answer but sharing what we do to accomplish the same. We use a PS script that kicks of every 15 mins via schedule task and deletes all unloaded user profiles skipping certain accounts.

 

Original code from Rob-Simmers - https://powershell.org/forums/topic/delete-user-profiles-except-stafflocal-accounts/#post-24891

 

Our PS Code

function Delete-Profile {
    [CmdletBinding(SupportsShouldProcess=$True,ConfirmImpact='Low')]
    param(
        [string[]]$Exclude
    )
    $Exclude | Sort-Object | foreach{ Add-Log -Path $logPath -Message ("Excluding:  {0}" -f $_) }
    $profiles = Get-WMIObject -Class Win32_UserProfile
    Add-Log -Path $logPath -Message ("Found {0} profiles..." -f $profiles.Count)
    foreach ( $profile in $profiles ) {
        $Loaded = $false
        $Excluded = $false
        Add-Log -Path $logPath -Message ("Processing profile {0}..." -f $profile.LocalPath)
        if ( $profile.Loaded ) {
            Add-Log -Path $logPath -Message ("{0} profile is loaded. Deletion will be skipped." -f $profile.LocalPath)
            $Loaded = $true
        }
        
        if ( $Exclude -contains $profile.LocalPath.Substring($profile.LocalPath.lastindexofany("\") + 1, $profile.LocalPath.Length - ($profile.LocalPath.lastindexofany("\") + 1)) ) {
            Add-Log -Path $logPath -Message ("{0} profile has been excluded. Deletion will be skipped." -f $profile.LocalPath)
            $Excluded = $true
        }
        
        If ($Loaded -eq $false -And $Excluded -eq $false) {
            Add-Log -Path $logPath -Message ("Attempting to delete {0} profile..." -f $profile.LocalPath)
            try {
                if ($pscmdlet.ShouldProcess($profile.LocalPath, "Delete")) {
                    $profile.delete()
                    Add-Log -Path $logPath -Message ("{0} profile has been deleted successfully." -f $profile.LocalPath)
                }
                
            }
            catch {
                Add-Log -Path $logPath -Message ("{0} profile could not be deleted. Error: {1}" -f $profile.LocalPath, $_.Exception.Message) -Level Error
            }
        }
    }
}
$scriptPath = split-path -parent 
$MyInvocation.MyCommand.Definition
$logName = $MyInvocation.MyCommand.Name.ToLower().Replace("ps1","log")
$logPath = "{0}\{1}" -f $scriptPath, $logName

Add-Log -Path $logPath -Message ("Initiating {0}..." -f $MyInvocation.MyCommand)
Write-Verbose ("Logging Path: {0}" -f $logPath)
Add-Log -Path $logPath -Message ("Loading static exclusions...")
$exclusions = "Administrator","all users","default user","default", "localservice","networkservice","public","myserviceaccount"


Add-Log -Path $logPath -Message ("Beginning profile removal...")
Delete-Profile -Exclude $exclusions @PSBoundParameters
Add-Log -Path $logPath -Message ("Completed profile removal.  Script execution complete.")

 

19 hours ago, Dawid Beben said:

Hi guys,

 

1. 
I am strying to use Citrix Policy and Citrix Profile Management to automatically delete users' profiles after they log off. I want ot avoid any log off scripts.

 

I would expect that if ONLY "Enable profile management" and "Delete locally cached profiles on logoff" policies are enabled, it would be enough to get profiles deleted on after logoff.

However, this works fine ONLY when users are using a TEMPLATE profile Citrix policy (i.e. "Path to the template profile") but if LOCAL profiles are used on servers, then the "Delete locally cached profiles on logoff" is not working.

Is it normal behavior or I am missing something?
 


2.
Another question, when a user in Active Directory have a Homedrive enabled (Profile->Home Folder->Connect), Citrix PM caches the profile there. Is there any way of disabling this behavior WITHOUT disabling Citrix Profile Management in Citrix Policy? I don't want users to use template profiles and use local profiles only.
 

Thanks!

 

 

CVAD Service

WS 2019

VDA 2012

 

 

 

image.thumb.png.af52d22c868baaf4f31bf70baca2f275.png

image.png

 

Link to comment

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