Good day, Another quick Powershell script. Even though it is already 2020, there are still enough servers with older disks capable of slowing down because of fragmentation. So, how can we make sure we stay up to date on the fragmentation? It is an easy Powershell script that you can easily adjust to follow up with actions. Whether you want to create an event viewer log, send a mail or something else that alerts you if needed. It retrieves the fragmentation values from the system itself and lists this for each physical disk. Afterwards it gives access to 2 results. One when it is above the limit and one when below it. You can set the limit by changing the number in this line: if ($frag -gt “10”) { I have it set to 10% right now. You can of course easily replace the write-host commands it ends with by your method of alerting. With the way servers work, new SSD’s and Windows automatically defragging certain devices already this will become less relevant. But it never hurts knowing when a device crosses the border and can end up causing slowness because of fragmentation.
And as always, Hoping this will be of use to someone out there. - Powershellder Categories: Windows, Powershell, Script, Server
2 Comments
Rabie
18/11/2020 11:09:01
thank you for sharing, i just have a small question, could we use this script to figure out the fragmentation value on a sql server?
Reply
20/11/2020 07:36:59
Yes, and no.
Reply
Leave a Reply. |
AuthorPatrick Berger AKA Powershellder. Categories
All
Archives
December 2020
|
[ i ] Parallax section below. Click on the section below to upload image. Don't worry if it looks weird in the Weebly editor. It'll look normal on your published site.
To edit or delete your image, press the "toggle" button below. Then, hover over your image until a popup appears with the "edit" and "delete" options. If you don't want a white content section, leave it blank. It will disappear on your live website.
