Reset Receiver Client

Version: 2.2.6
Creator Name: David Ott
Date Created: 2016-08-11
Date Modified: 2017-02-26
Scripting language: PS
Download Count: 139

Resets Citrix Receiver in VDA session. Requires cleanup.exe and selfservice.exe. It can take a little over a minute to run. * Resetting will delete all apps, desktops, accounts, and configurations, and return Receiver to default settings. It will also close all active sessions. Only reset Citrix Receiver to resolve serious problems.
Tags: Citrix, Receiver

The Script

<#####
Script looks for cleanup.exe and selfservice.exe in the default Receiver install directory.  If they are both found it will
perform a receiver reset, wait for it to finish, and then poll storefront.  If storefront is not configured by policy or from 
Studio it will not be able to poll.
#####>

If (Test-Path 'C:\Program Files (x86)') {
    $cleanup = Get-ChildItem 'C:\Program Files (x86)\Citrix' -Recurse | Where {$_.name -eq "cleanup.exe"} | select -ExpandProperty fullname
    $selfservice = Get-ChildItem 'C:\Program Files (x86)\Citrix' -Recurse | Where {$_.name -eq "selfservice.exe"} | select -ExpandProperty fullname
} Else {
    $cleanup = Get-ChildItem 'C:\Program Files\Citrix' -Recurse | Where {$_.name -eq "cleanup.exe"} | select -ExpandProperty fullname
    $selfservice = Get-ChildItem 'C:\Program Files\Citrix' -Recurse | Where {$_.name -eq "selfservice.exe"} | select -ExpandProperty fullname
}

if ($cleanup -eq $null -or $selfservice -eq $null) {
    Write-Host "The required executables are not found in the default path."
    Write-Host "Please check that cleanup.exe and selfservice.exe are installed properly."
    Exit 1
}

$app = Start-Process $cleanup -ArgumentList "-cleanUser -silent" -PassThru
Wait-Process $app.id

if ($app.exitcode -ne "1") {
    write-host "Receiver reset successfully."
    $app1 = Start-Process $selfservice -ArgumentList "-poll -logon" -PassThru
    Wait-Process $app1.Id
} else {
    write-host "Receiver reset failed!"
    Exit 1
}
if ($app1.exitcode -ne "1") {
    write-host "StoreFront Polled successfully"
} else {
    write-host "Polling StoreFront Failed"
    Exit 1
}