Link to home
Start Free TrialLog in
Avatar of Mark Ellis
Mark EllisFlag for Australia

asked on

Script that achecks for users before rebooting Citrix XenApp server.

I have some Citrix XenApp servers provisioned via PVS.
I have a group of users who run simulations that may take several days to run.
I want to reboot my Citrix XenApp servers every night IF one of these users are not connected.  If they are connected I will just wait until tomorrow for the reboot.
I can end idle sessions for the non-simulation users easily enough with a group policy leaving only the users from Engineering running simulations.
I am thinking of running a scheduled task that does this:

IF user connected
then exit
else  shutdown /r /t 0
end

I just need to know that exact commands and syntax to make this work.
Thanking you in anticipation of your assistance.

Regards,
Mark   :-)
Avatar of Sekar Chinnakannu
Sekar Chinnakannu
Flag of Singapore image

You can try with powershell script to schedule Citrix server reboot. Test the same in test environment and then plan for PROD.
https://github.com/wingnut1000/CitrixScripts
https://www.geekshangout.com/citrix-xenapp-rolling-reboot-script/
Avatar of Mark Ellis

ASKER

Both links are valid but a bit more complex than what I was looking for.  I am not sure I would feel safe using the load evaluator as the method to determine if I still had users logged on is fool proof.  I will be in trouble if I kill someone's session to do a reboot.

Rather than a central script I would looking for something that runs on each server.

All the same good work but not quite what I was looking for.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.