Windows Server 2016 Optimisation Script

Windows Server 2016 Optimization Script.

Tested on: Windows Server 2016 build 14393.0.

Description: This script disables services, removes  scheduled tasks and imports registry values to optimise system performance on Windows Server 2016 running in a Citrix SBC environment.

Warning: This script makes changes to the system registry and other configurational change  and as such a full backup of the machine or # snapshot if running in a virtual environment is strongly recommended. Carry out full testing before introducing image to production.

Note: You should review ALL optimisations this script makes and determine if they fit in to your environment. Not every optimisation suits all environments. For example, this script disables key Hyper-V services for use in non-Hyper-V environments. If you use Hyper-V, you must enable these services.

Instructions: To avoid failure, run PowerShell as an administrator.

Download (click below):

Windows Server 2016 Optimisation Script (1918 downloads)

Any problems with the script or if you want to make your own improvement suggestions then comment below.

Open the script using a text editor or PowerShell ISE to see what exactly the script does.


57 Comments

  • Steve Elgan

    April 14, 2017

    Great script. You may want to consider setting power to high performance and also disabling Server Manager task.

    Reply
    • George Spiers

      April 15, 2017

      Thanks. I did consider including disabling Server Manager on startup at the time however that is an HKCU key. I’ve included High Performance.

      Reply
  • RICHARD HUGHES-CHEN

    May 18, 2017

    Was looking for some 2016 optimizations to test in my POC.

    If using Citrix App Layering would it be best to run in the OSLayer or as another layer?

    There seems to be a similar script configured with Citrix App Layering in the OS machine tools scripts folder C:\windows\setup\scripts\Optimize.html

    What is the best thing to do?

    Reply
    • George Spiers

      May 18, 2017

      Run optimisations in the OS Layer. The script I provide is specifically for Windows Server 2016 and does contain a tonne of optimisations that have been checked and evaluated thoroughly. The Optimisation builder you mention does contain probably the same optimisations that my script has but not as many.

      Reply
  • eltjo

    May 19, 2017

    Hello George,

    how does your script compare the Base Image Script Framework (BIS-F) that Login has released?

    Regard,

    Eltjo

    Reply
  • George Spiers

    May 19, 2017

    BIS-F can run defragmentations, clean out profiles, rearm Office, run Antivirus etc. and many other preparation type tasks. My script is purely disabling Services, disabling Scheduled Tasks, removing Active Setup, decreasing Event Logs size and much more to get the best performance out of your image.

    Reply
    • Matthias Schlimm

      June 14, 2017

      You can use this Optimization Script in a combination with BIS-F, copy it to the custom preparation folder in BIS-F and it would be automatically executed if you BIS-F starts.

      Reply
    • George Spiers

      May 31, 2017

      Thanks – I had a review. I’m going to include 8 more services to be disabled. The document also says to disable some services but I’m not going to disable via the script. Examples are Print Spooler (required to see printers so not wise to disable). The document also doesn’t specify to disable services such as Remote Access Connection Manager. My script disables it since there is no need to manage dial-up and VPN connections. Also the script disables superfetch (service that improves performance over time) – not useful for stateless machines.

      Reply
      • Steve Elgan

        May 31, 2017

        Cool. What are your thoughts on configuring the script in such a way that you can pass a variable for a Citrix config vs. just a general 2016 server config? Right now I just comment out lines that are specific to Citrix workloads when I want to use it on a general 2016 server. I’m still learning PoSh but i’d be willing to work up a PoC for you to review.

        Reply
        • George Spiers

          May 31, 2017

          The script is focused on SBC regardless of whether the image is deployed via Citrix, RDS, VMware. Everyone’s taste will be different in terms of what to keep and remove. That is why I think it’s easier to suggest that each person reviews what this script does and then remove or comment out lines to their liking.

          Reply
      • RICHARD HUGHES-CHEN

        June 1, 2017

        Hi George, have you included the additional services to be disabled in the script? Thanks

        Reply
        • George Spiers

          June 1, 2017

          Hey. Yes they are included now.

          Reply
  • RICHARD HUGHES-CHEN

    June 1, 2017

    just noticed the comments around Hyper-V which is what I am using.

    # in non-Hyper-V environments. If you use #

    # Hyper-V, you must enable these services.

    Reply
    • George Spiers

      June 1, 2017

      That’s right. Edit the script and remove the lines relating to disabling Hyper-V services.

      Reply
  • Jochen

    June 23, 2017

    Hello,
    I used this script in my test environment and it is great, Much more responsive Xenapp Server.
    The only thing I have now is that during logon I am stuck for about 20-30 seconds on the following message: please wait for user profile service.
    After this everything is lightning fast.
    Any idea why i have to wait for the user profile service? (We use roaming profiles)

    Reply
    • George Spiers

      June 23, 2017

      Thanks for the feedback. Have you tried taking roaming profiles out of the equation to see if it still occurs? That would be my first action, pick a machine, put it in maintenance mode, disable roaming profiles and test.

      Reply
  • Frank

    July 10, 2017

    hi george
    i take also bis-f script from matthias schlimm, and now there is the CTXOE supported. so your script is awesome, but did you test if CTXOE make the same now, or did you make some additional special things, so that both scripts will be good for optimization?
    regards
    frank

    Reply
    • George Spiers

      July 10, 2017

      The Citrix Optimizer tool has 71 different types of optimisations for Windows Server 2016. The script here has 170+ different optimisations. There are about 5-7 different unique optmisations in Citrix Optimiser with the majority of those left out of my script intentially. So my script has 90% of optimisations that are included in the Citrix Optimizer tool but around 80+ additionals. For example Citrix Optimizer does not disable Xbox related Scheduled Tasks whereas my script does. You are safe to use both, which I highly recommend.

      Reply
  • Steve Elgan

    August 1, 2017

    George,

    Have you considered adding any of the optimizations mentioned in Rory’s blog post here? http://rorymon.com/blog/?p=3951

    For example the other offload options. Or what about disabling power management on the NIC card?

    Reply
    • George Spiers

      August 1, 2017

      No to disabling power management on NIC as I’ve not encountered that setting interfering with VDAs before and the script sets power to High Performance anyway. The script does disable TCP Large Send Offload but no other of the offload settings. I’ll have a look in to them to decide if they should go in the script. Thanks

      Reply
  • Jonathan Aumont

    August 23, 2017

    HI,
    this is an awsome script. I was wondering if you have a word or excel document that list all the features that you do modify in your script?

    Reply
    • George Spiers

      August 23, 2017

      Sure, I have your email so I’ll send the Excel document across.

      Reply
      • Jonathan Aumont

        August 24, 2017

        thank’s for this. I’ll wait for it.

        Reply
  • Vincent Caberas

    September 2, 2017

    Hi george,

    Thank you for your very good Word. I m interesting too, about the Excel file with the optimization. Thank you

    Reply
    • George Spiers

      September 3, 2017

      No problem, I’ll send it to you soon.

      Reply
  • Mikael Laine

    September 7, 2017

    Great work George. I’ll have a rundown in our lab environment and provide some feedback. Would it be ok to drop me the excel sheet?

    Reply
    • George Spiers

      September 8, 2017

      Thanks and sure – I’ll get that across to you later today.

      Reply
  • jonathan Aumont

    September 8, 2017

    Hi George,
    One quick question for you. Is there any part in your script that might affect the Microsoft supportability of the Windows 2016 OS?

    Regards.

    Reply
    • George Spiers

      September 8, 2017

      I can’t exactly comment for sure on Microsoft’s support terms and conditions. I can’t imagine they would deny support because you have disabled a Scheduled Task or Service, they would likely just ask you to enable it. If system settings are configurable then they are there to be changed and modified. The script itself does not perform anything that is irreversible.

      Reply
      • jonathan Aumont

        September 8, 2017

        Thanks for your quick reply. I agree with you on this. I was juste checking if you hade face a situation that it could break support. Thank again. really appreciated.

        Reply
        • George Spiers

          September 8, 2017

          No problem at all! 🙂

          Reply
  • Reinhard

    September 13, 2017

    Hi George,

    great script, thanks for sharing! Could you please also send me the Excel?

    Reply
    • George Spiers

      September 13, 2017

      Thanks. Yes I have just sent it.

      Reply
  • Owen Reynolds

    September 15, 2017

    Amazing!
    I ran this on a XD 7.15 / Win 2016 in my home lab tonight, and noted a huge performance in logon and over-all UI latency!

    Great work , George!

    One question – would this script be appropriate for non Citrix Windows Server 2016 installs? Looking over the various changes, they seem appropriate for Win 2016 as it’s used in other roles: File servers, active directory controllers, store front , SQL , etc.

    Owen

    Reply
    • George Spiers

      September 15, 2017

      Cool, it’s nice to hear good results! In regards to running it on other servers, I guess it is up to you. Personally I do not run optimisations on non Citrix servers, but it would not be a bad practice at all.

      Reply
      • Owen Reynolds

        September 15, 2017

        I’ll give it a shot on my other servers, thx again.
        Wold you be able to send me the xls that contains the items changed by this script?

        Reply
        • George Spiers

          September 15, 2017

          Have sent it.

          Reply
  • Gareth

    September 18, 2017

    George this is amazing work! Thank you for sharing, you’ve saved me hours of work. Could I push my luck a little further and trouble you for a copy of your excel document please.

    Reply
    • George Spiers

      September 18, 2017

      Thanks – I will send you the document shortly.

      Reply
  • Michael

    September 28, 2017

    George – great job! Love the script! Thank you so much for sharing! Could I also have a copy of the Excel spreadsheet? Thanks!

    Reply
    • George Spiers

      September 28, 2017

      Thanks. I have sent it across to you.

      Reply
  • Zach

    September 29, 2017

    Will this also disable/remove Windows Ink Workspaces?

    Reply
    • George Spiers

      September 29, 2017

      No I can confirm it doesn’t.

      Reply
  • Alexander Schwarz

    October 5, 2017

    Hello George
    I´m very happy that I found this great script!
    Thank´s a lot for sharing 🙂
    Can you also send me the excel sheet?

    Reply
    • George Spiers

      October 5, 2017

      Thanks. Glad you like it. I’ve just sent the sheet across.

      Reply
  • Tommy

    October 8, 2017

    Thansk George

    Will this work on Windows 2016 RDP server ?

    Regards
    /Tommy

    Reply
    • Tommy

      October 8, 2017

      Hi Goerge

      Actual my Questions was is it possible to run this script on Windows 2018 RDP server
      that running in vmware as guest?

      /Tommy

      Reply
      • George Spiers

        October 8, 2017

        Hi Tommy, yes this will work fine on RDSH.

        Reply
  • Tommy

    October 9, 2017

    Great George and Thanks!

    Sorry for my bad English 🙂

    Regards
    Tommy

    Reply
  • George Spiers

    October 9, 2017

    Your English is great actually! 🙂

    Reply
  • Aaron

    October 10, 2017

    FYI
    Your ClearPageFileAtShutdown setting isn’t correct, its re-running the NtfsDisableLastAccessUpdate command.

    Reply
    • George Spiers

      October 10, 2017

      Thanks for pointing that out. I’ve corrected it.

      Reply
  • Srinivas

    November 7, 2017

    Hi George,

    can this script run on Win2k12 R2.

    Thanks,
    Sri

    Reply
    • George Spiers

      November 7, 2017

      No I do not advise this as the script was created for WS2016 and may contains Services, Scheduled Tasks and so on that are not available on WS2012 R2.

      Reply
  • Brian Mooney

    November 10, 2017

    George,
    How does your script work compared to the Citrix latest Citrix optimization tool? Have you compared the two?

    Reply
    • George Spiers

      November 10, 2017

      I haven’t checked recently but last time I did check the script had over 80+ additional customisations.

      Reply

Leave a Reply