Link to home
Start Free TrialLog in
Avatar of jpletcher1
jpletcher1Flag for United States of America

asked on

Reboot script for Citrix server warn users first

We have Presentation Server 4.5, but not the edition where I can schedule reboots ( I assume because I don't have a Resource Manager).  I'd like to schedule reboots of the server weekly.  I see there are a couple options, shutdown.exe and tsshutdn.exe.  Are either of these better to use if I want to notify end users ahead of time before the reboot?  Say 15 minutes?  I know you can use comments with the shutdown.exe command.  I'd also like to disable logins when the 15 minutes starts or even before that.  I see there is a command to do this as well from the Windows TS side, but not sure if that translates through to Citrix.  

Here is an example of something I found and I'm not sure if it will work or not for my scenario.

change logon /disable
logevent -S W -C 7311 -e 3603 "AUTOMATED SERVER REBOOT IN 12 MINS"
msg * Please log off and save your work. Automated Scheduled Reboot. The Citrix server is going down in 12 mins.
sleep.exe 300
msg * Please log off and save your work. Automated Scheduled Reboot. The Citrix server is going down in 7 mins.
sleep.exe 240
msg * Please log off and save your work. Automated Scheduled Reboot. The Citrix server is going down in 3 mins.
sleep.exe 60
net stop lpdsvc
net stop spooler
sleep.exe 120
del c:\WINNT\System32\spool\PRINTERS\*.* /q
change logon /enable
tsshutdn 30 /DELAY:0 /REBOOT
ASKER CERTIFIED SOLUTION
Avatar of Tony J
Tony J
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jpletcher1

ASKER

Thanks.  Yes the logevent.exe command does not work in Windows 2003 and I had to get the resource kit for the sleep.exe.  

When we stop our print spooler it has to stop the citrix print managment service, and that one doesn't always shut down gracefully, so I think I'll remove the part at the end to stop services and clean the print folder.

Thanks for the input.
Thanks for the added info.