We use XenDesktop 7 and Atlantis ILIO Diskless for our VDI environment. ILIO functions as a storage device. The ILIO VM should occasionally be rebooted per the documentation, or the datastore can fill over time. The script below is what we use to reboot our VMs daily, and the ILIO devices every other day. Depending on utilization, you can go much longer so do test and follow your documentation.
$dateTime=get-date $ScriptName="VMReboot" $BrokerGroupName="YourBrokerGroupName" $vCenterAddress="YourvCenterServer" $oddHosts="Your hosts here" $evenHosts="Your hosts here" $VMNameWildcard="YourVDIVMName" # example: VDI* $ILIOvmName="Your ILIO VM name here" $citrixAdminAddress = "" #TODO: get all delivery controllers, select random active one Start-Transcript -path C:Scriptslogs$ScriptName$ScriptName_$($datetime.tostring("yyyy-MM-dd-hh_mm_ss")).log -Append -Confirm:$false Function check-even ($num) {[bool]!($num%2)} if($datetime.Hour -eq 2) { Add-PSSnapin Citrix* Add-PSSnapin VMware.VimAutomation.Core [bool]$disableMaintOnCompletion=$true write-host "Connecting to $vCenterAddress" Connect-VIServer -Server $vCenterAddress #-Credential $credential -ErrorAction Stop ## Running task as service account...don't need creds Get-BrokerDesktopGroup $BrokerGroupName -adminaddress $citrixAdminAddress | Set-BrokerDesktopGroup -InMaintenanceMode:$true $vmHosts=@() if(check-even $datetime.Day) { $evenHosts | %{ $vmhosts+=Get-VMHost -Name "$_*" } } else { $oddHosts | %{ $vmhosts+=Get-VMHost -Name "$_*" } } ## First lets loop through all the hosts and shutdown off all vms $vmHosts| % { $currentHost=$_ write-host "Working on $($currentHost.name)" $vmsOnHost=$currentHost | Get-VM -Name $VMNameWildcard | % { #Loop through each VM to shutdown $currentVM=$_ Write-Host "vSphereDesktop: $($currentVM.Name)" Write-Host "$(get-date -format "hh:mm:dd") Shutting down vSphereDesktop: $($currentVM.Name)" $currentVM | where{$_.PowerState -eq "PoweredOn"} | shutdown-VMguest -Confirm:$false -ErrorAction SilentlyContinue $currentVM=$null $brokerDesktop=$null } write-host "Sleeping 20sec before forcing shutdown" Start-Sleep 20 $vmsOnHost=$currentHost | Get-VM -Name $VMNameWildcard | % { #Loop through each VM to power it off, just in case $currentVM=$_ Write-Host "vSphereDesktop: $($currentVM.Name)" Write-Host "$(get-date -format "hh:mm:dd") Stopping vSphereDesktop: $($currentVM.Name)" $currentVM | where{$_.PowerState -eq "PoweredOn"} | Stop-VM -RunAsync -Confirm:$false -ErrorAction SilentlyContinue $currentVM=$null $brokerDesktop=$null } write-host "Sleeping 1 min before rebooting ILIO" Start-Sleep 60 #Now we need to turn off ILIO $ilioVM=$currentHost | get-vm -Name $ilioVMName write-host "$(get-date -format "hh:mm:dd") Found $($ilioVM.name), restarting" $ilioVM | Restart-VMGuest -Confirm:$false $currentHost=$null $vmsOnHost=$null $ilioVM=$null } write-host "Sleeping 3 min" Start-Sleep 180 if($disableMaintOnCompletion) { Get-BrokerDesktopGroup $VMNameWildcard -adminaddress $citrixAdminAddress | Set-BrokerDesktopGroup -InMaintenanceMode:$false } else { write-host "skipping disable maintenance mode" } Disconnect-VIServer $vCenterAddress -Confirm:$false } else { Write-Host "$(get-date -format "hh:mm:dd") ERROR: Incorrect hour of day" } Stop-Transcript