Jul 292019
 

Update: Added cli functionality.
Update: Added 2nd pass of defrag to fix the profile ballooning issue that sometimes occurs.
Update: Added ability to target profiles over “X” size for compacting
Update 3/31/2020: Fixed a bug that didn’t allow the new tool to run as a scheduled task. Fixed in version 2003.1
Update 4/21/2020: Fixed bug that didn’t assign drive letters to vhd(x) files when running via CLI. Which breaks the defrag, and in turn doesn’t free up any space for diskpart to shrink. Fixed version is 2004.1.
Update 4/23/2020: Added the ability to sort profiles in the GUI. Clicking the stop button should dismount vhd(x) files automatically. Uses optimize-volume instead of defrag – should be MUCH faster. Also does not need drive letters anymore. Version 2004.2
Update 4/27/2020: Tool now detects RW disks and will not attempt to compact multi session profile disks if in use. Version 2004.4
Update 4/29/2020: Tool will find hidden .vhd(x) files. Version 2004.5
Update 5/26/2020: Fixed the optimize-volumes to use “retrim” after defraging the volume. This will increase processing time, but shrink the vhd(x) files much more. Version 2005.1

Update 6/24/2020: Added defrag back – which seems to do a lot better at freeing up space. Instead of giving a drive letter it sets the drive up as a mount point in the TEMP directory of the user running it (random named folder that will start with “_FSL”). With this I have updated the command line so you can process more than one vhd(x) at a time. TAKE NOTE OF THE NEW COMMAND LINE OPTIONS AS THEY HAVE CHANGED! Version 2006.1
UPDATE 6/25/2020: Bug fix – the 2006.1 version would leave the last vhd(x) attached when using the -tasks # switch. No, popups in cli to stop processing if it doesn’t find any vhd(x), and instead of “N/A” it will show the file size if the file is locked in the after column. Fixed in version 2006.3.
Edit: Version 2006.4 now – last bug fix for the day hopefully. Forgot to add the check for RW.VHD(X) files.

Do not use this tool if you are doing any differencing disks!
Diff disks, no problem!

This post is an updated version of my original profile compacting script ( http://www.citrixirc.com/?p=829). I wrote it using Powershell Studio and converted it into an executable. This version does not require the Hyper-V powershell module as it diskpart to perform the shrink function.

Requirements:

  1. Administrative rights on the machine running the tool, and read/write to the profiles.
  2. .Net 4.5
  3. Recommend not running from a machine which has any .vhd(x) attached

Instructions/How it works:

  1. The program will remember the last directory selected (via an .ini file – if it exists), or you can click the “…” button at the top left to browse to the root directory of your profile share.
  2. Once a directory is selected it will list all .vhd and .vhdx files along with their current size and their current locked status in descending order by size. (this can take a little while depending on how many vhd(x) files are present – be patient)
  3. Select the profile(s) you wish to compact (you can select multiple using ctrl and shift+click)
  4. Click the compact button, and the program will process each profile selected one at a time
    1. Checks one more time to make sure the file is not locked
      1. If it is, it will skip on to the next one
    2. Gets the current size again before processing
    3. Attaches the vhd(x) in R/W mode
    4. Creates a random named folder in the user’s temp directory starting with “_FSL”
    5. Mounts the vhd(x) to that folder
    6. defrags the volume
    7. Detaches and re-attaches as read only
    8. Uses diskpart to compact the vhd(x)
    9. Gets the size of the file post processing
    10. Updates the results pane
  5. After it has run through all the selected profiles it will display the total reduction in MB at the bottom.
  6. Update: To run via CLI simply run from command prompt with the following options
    -path \\servername\share (path to the root vhd(x) share)
    -size 4096 (minimum size to touch in MB – will skip any vhd(x) smaller)
    -tasks # (number of concurrent vhd(x) files to compact – there is no limit, so be careful not to overload the machine you’re running this on)

    Examples:
    Run against all vhd(x) files one at a time
    ShrinkFSL.exe -path \\servername\share\

    Run against all vhd(x) files 2 at a time
    ShrinkFSL.exe -path \\servername\share -tasks 2

    Run against all vhd(x) files over 5GB
    ShrinkFSL.exe -path \\servername\share -size 5120

    Run against all vhd(x) files over 5GB AND process 2 at a time
    ShrinkFSL.exe -path \\servername\share -size 5120 -tasks 2
    1. A log file in csv format will be generated in the same directory that ShrinkFSL is run from. Shrink_MMddyyy_HHmmss.log
    2. If you stop the process make sure you disconnect any vhd(x) file that may be lingering, and delete _FSL folders in the temp directory!

You can keep track of the .vhd(x) attaching/detaching via diskmgmt.msc if you want. If for some reason the program hangs up you can click the stop button. It will detect if there is a vhd(x) attached, and detach it.

Always test new tools in Development/UAT environments prior to running in production! If you have any questions/comments please post here, and I will respond as soon as I can.

Here is a link to the tool (Updated 6/25/2020)
https://david62277.sharefile.com/d-saad8432c8994f61b

  211 Responses to “FSLogix Profile Compacting Tool”

  1. Thanks David, this is great!!

  2. Simply amazing

  3. Excellent, thank you David. Is there a way that this could be scheduled?

    • I just added cli functionality. ShrinkFSL.exe \\path\to\profiles

    • Hi…Do you have tool or commands to increase container (vhdx) size ?

      • I don’t think he has a tool to do this automatically. However, you can do this with diskpart.

        Open a command window as administrator
        diskpart
        select vdisk file=”d:\blah\somedisk.vhd”
        list vdisk (make sure your disk has a * on it) (If not, select vdisk #)
        expand vdisk maximum=xxxxxxxx (204800 = 200GB)
        attach vdisk
        list disk (make sure your disk has a * on it) (If not, select disk #)
        list volume
        select volume # (Make sure you select your volume)
        extend (Make sure the volume size is correct now)
        detach vdisk
        exit

        • Have you tried to expand the VHDX? Did it work? I’m trying not to recreate the profile disks.. I need to expand like 5 profiles! Thanks

          • You can expand them with diskpart.You will not need to recreate them.

            Open a command window as administrator
            diskpart
            select vdisk file=”d:\blah\somedisk.vhd”
            list vdisk (make sure your disk has a * on it) (If not, select vdisk #)
            expand vdisk maximum=xxxxxxxx (204800 = 200GB)
            attach vdisk
            list disk (make sure your disk has a * on it) (If not, select disk #)
            list volume
            select volume # (Make sure you select your volume)
            extend (Make sure the volume size is correct now)
            detach vdisk
            exit

  4. Pretty good tool to use, specially now that FsLogix is kind of free and we will be implementing this on most of our clients.

  5. Amazing! I think many of us will need and use this! Thank you very much for sharing this!

  6. Hi David

    Big thanks for your work. The Tool is for Peoples with GUI Love :). I like the Script more, because i can run it every night. So the CLI Parameter what you wrote is only open ShrinkFSL.exe with the URL to the VHDX Files Root, but not starting it, you must click than “Compact” for your own. So maybe it fails a parameter to compact it than also from CLI automticly!

  7. […] FSLogix Profile Compacting Tool – David Ott […]

  8. I tried this on an O365 Container and it actually grew the vhdx. It said it gained 768mb. Is this expected?

  9. Can you please add the option and/or open source the script so can reset / backup last X profiles?

  10. Hi David,

    Is it possible you could reintroduce the PowerShell script version of this alongside the executable? or provide a link back to the old script you had?

  11. Great tool, thanks!. But I get a bit confused, many .vhdx files gets a – before, and seems to increase in size rather than shrink. Why does some vhdx file get – value as result?

  12. Strange, any body seen any slowness after using this with FSlogix? It take 200+ seconds to login now. I tested it first. So good thing I didnt use this in production yet.

    • The only way this could possibly cause an increased logon time is if the vhd/vhdx remains locked (attached) to the computer running the program. If you terminate it while it is running a virtual disk could remain attached. Whoever owns that vhd/vhdx would not be able to attach it, and depending on your timeout settings for fslogix… it could take a very long time, and then give them a temporary profile.

  13. Yea, its strange. The vhdx detatches fine.
    I tested it again. Same thing. Trying to understand what it is that causing it. Redo the profile and its fast again.

  14. It’s a awesome tool. Just trying to figure out what it is (possible my environment)

  15. The tool don’t write any log to programfolder for me.

  16. Any chance the Size can be converted to GB instead of MB? It would be much easier to read.

  17. Will this tool also work on FSLogix O365 containers?

  18. Hi David,

    Would it be possible to provide the powershell source code behind the exe?
    If not, would it be possible to add search/sort functionality to the list?

    Great tool, Thanks!

  19. Hi David,

    It seems that this tool is not compatible with (a) DFS (share) and replication. This is to be expected as you point the tool to a DFS share that is in the background pointing to multiple (file) servers and it has no way to decide which containers are in use on which server. It’s a more complicated scenario currently not addressed with this tool. Apart from that, terrific tool!!

    • I use DFS as well, but we only use one path unless we are in a DR scenario. That said DFS should replicate changes, but it would not know if the disk was in use on one path vs the others.

  20. Hi David,

    We’ve been using the tool on a schedule for a couple of months now and it’s working great! However, there are a couple of vhds which are not shrinking when we are certain that they should. It looks as though there are a couple of problems within the disk (one example had errors in the master file table bitmap, for example. This issue would be solved by a chkdsk /f within you rtool, would it be possible for you to update to include this? Or perhaps to release the powershell code of the tool so I could edit myself?

    Thanks again for the great tool.
    Bryan

    • I have an update for the tool (will update the post shortly). I noticed that sometimes the disks do not shrink, and that adding a second defrag process fixes it.

  21. David,
    I’ve been using the tool for a few weeks now, and I noticed a problem. We use a differential disk to store changes to the profile during the sessions, which then gets migrated once the use logs off. This way, the profile.vhdx remains unlocked and the RW.vhdx is locked during the session.
    When we run your tool at night and there are still some users active, they skip the RW.vhdx cause it’s locked, but it does compact the userprofile.vhdx file. Afterwards, we notice that changes are not being saved in the profile anymore and according to the logs, the RW.vhdx cannot be merged, because the chain is broken. I suspect, by changing the master VHDX while there’s a differencing disk attached to it, breaks the chain. Are you aware of this?

    Regards,
    Michiel.

  22. Great Tool. I am only missing some information on the vhdx file in th eGUI. That is the size of the virtual disk. If you mount it you see it in diskpart.
    Eg I have a VHDX which is size to 29 GB

    DISKPART> list disk

    Disk ### Status Size Free Dyn Gpt
    ——– ————- ——- ——- — —
    Disk 3 Online 29 GB 0 B *
    DISKPART> list partition

    Partition ### Type Size Offset
    ————- —————- ——- ——-
    Partition 1 Primary 29 GB 1024 KB

    That size does not change during compacting, but it would be nice to show it in the GUI.

  23. Ditto post #22 you need to add an accounting for a RW.vhd(x) file if differencing is used in the environment or you can corrupt the disk pair.

    • We also experience issues when a profile is in use. Only the RW.vhdx is locked but the tool tries compacting the non-locked profile disk. If profiles where a differencing disk is in use could be skipped it would be a great improvement.

      • I have not gotten around to messing with diff disks. Being that I don’t use them in my environment this may not get implemented.

  24. Hi David,

    Great tool, thanks for posting.

    Is there any update to resolve the issue with the RW file?

    Many Thanks
    Brian

  25. Hi David,

    I just noticed there’s a new version since I found this tool the first time. Do you have any changelog information somewhere?

  26. Hi David, great tool, and one I’ve promoted in the community… Bit of an issue though when working through a share I’m seeing 100% of the containers show Unlocked when enumerating, then when I start the Compact process, around 20% show Locked – True… – There are no Live sessions, and even looking on the fileshare, there are no open handles on any of these files. – Any idea?

  27. Is it already possible to run the exe silent with parameters so we can schedule it? If not will it be on your roadmap?

    Thanks.

  28. Hi.

    Nice tool, may i ask for command line so i can schedule this todo compact?

  29. Hi David, first of all awesome tool!
    Since the update (2nd defrag pass), the discs is no longer shrink when i do it automatically via the CLI and task scheduler, while it works fine via the GUI. Did something change with the CLI functionality or am I doing something wrong here?

  30. Hey David,

    Just a FYI, this tool instantly gets blocked by Symantec Endpoint Protection the second you download it. I had to turn off my SEP, and then rename the file to get SEP to not instantly delete the .exe.

  31. Thanks for this great tool! One thing we noticed is that we run the tool from the command-line it runs fine but it doesn’t really compact the disk. We tried running with UNC path (ShrinkFSL.exe \\servername\share\profiles) and local path (ShrinkFSL.exe X:\UPDFolder) and both run fine, you can see the server is mouning and unmounting the UPD files.

    But it doesn’t compact the UPD files that much when we use the CLI. When we run the tool with the GUI it significantly decreases diskspace. Maybe this is a known issue?

    • Hi Rob.. we notice exactly the same. And scipting this is what you need to do this unnatended at night if all citrix sessions are automatically ended so the vhdx are not locked any longer. Hopefully this can be fixed.

  32. Great tool. I just test it in our test enviroment. It works great. Thank you.

  33. Has anyone successfully used this with FSL profiles in a VMware VDI environment? After I ran SrinkFSL and started up a VMware Horizon desktop, it created a new profile.vhd vs using the compacted one.

    • If you are using diff disks this could have happened. Don’t use this tool if you are using differencing disks. It is only looking for vhd/vhdx files.

  34. first of all this tool is very nice.. worked perfect for fslogix container. I tried to use this for Citrix Profile Container as well, but this doesnt worked. Does anyone know what is the exact different why this is working for fslogix container but for Citrix Profile Container not?

  35. I have run the tool from the GUI against a number of profiles but it always says DiffMB 0.
    It only takes a second to run the tool where I would expect it to take longer.
    Is there any way to determine that the DiffMB 0 is the actual value or that there has gone something wrong (debug log or something) ?

  36. Using the tool version from a few weeks ago, I have run the tool from elevated command prompt and the log shows that it is reducing quite a lot of the VHDs by marginal amounts, i.e. from 20MB to 300MB.

    Using the latest tool from 31/03/20 I get DiffMB=0 for all profiles.

    Going back to the original, older tool version repeated runs of that tool using CLI do not show further reductions.

    Then I run the tool again using the GUI and it reduces the size further.

    Using a specific VHD;

    CLI First run with older tool: 30.33MB reduction
    CLI Subsequent runs: 0MB reduction
    GUI run: 3659.13MB reduction

    • If you run the tool across all of your profiles and they are already reduced, running it a second time will most likely result in a 0MB difference.

  37. Hi,
    same problem here.
    Works correctly using GUI.

    Thanks!
    Great tool

  38. You Sir are a hero !
    Thanks very much

  39. Brilliant Tool, works very well with the GUI. We have over 2000 FSLogix disks and if you could get the CLI working again that would be great as we could have a scheduled task to run this weekly.

    • I run it as a weekly scheduled task as well, and the last time it ran it reduced the profile store by 10GB (over 300ish profiles). The more you run it the less fat it is going to cut out. The first time I ran it I got a total reduction of about 90GB, then a couple times later it was about 30GB, and the last 2 times it has ran it has done 15 and 10GB.

      • Hi David,

        As a scheduled task it is not shrinking a lot. When we run it GUI based it is shrinking. Microsoft Teams is creating empty space in the FSlogix disks so it would be nice to get shrinking to work again as a scheduled task. It does not matter if we run in multiple times it is just not shrinking when we run it as a scheduled task. If you read the comments a lot of people having this issue right now with the latest version. Hope you have time to have a look at it.

  40. Brilliant tool, using it on 2000 FSLogix profiles we got the disk space down to 3tb of the original 6tb usage (almost 50% savings!). sadly it doesn’t work when using it in CLI mode, would be really appreciated to get the CLI working again!

  41. Regarding the above which works fine through the GUI, I have some questions relating to the use of this tool via the command line.

    Q.

    When using the option \\ShrinkFSL.exe \\servername\share, I get “directory not found.”
    When using the option \\ShrinkFSL.exe \\servername\share this works. Can anyone advise where I have gone wrong?

    Q.
    When using the CLI, how do I actually stop the process? When viewed through Task Manager, the ShrinkFSL.exe process is not visible. The only way I have been able to stop it is to restart the server itself. Again any advice would be great.

    • Do a taskkill /f /im:shrinkfsl.exe

    • If it is in fact running, and you can’t see it – you’re not an administrator.

      I don’t understand your first question – the paths you are giving appear to be the same.

      CLI options
      shrinkfsl.exe \\path\to\profile\share
      or
      shrinkfsl.exe \\path\to\profile\share,4096

      The second would only touch profiles equal or greater to 4GB.

  42. I would like to delete files out of the vhd x is there any option that you could implemenet to do that, for example i would like to delete all ost from the profile.

    • That is not what this tool is designed for. You could try using redirections.xml to redirect .ost files to the “local” profile directory that is wiped at logoff

  43. Hi! We also see a massive difference when running it GUI vs running command line like this:

    ShrinkFSL.exe \\Severname\Fileshare\

    Working perfect using GUI. Using command line (or scheduled task..) it only shrink a tiny bit on each run.

    Would be nice if this could be “fixed”.

    Anyway – thanks for a great tool!

    Regads
    Fredrik

  44. Hi. Same here, it’s a great tool but indeed when i run it using the command line it doesn’t schrink the o365 vhd’s at all.
    But never the less i’m not complaining.
    Best regards, Ino

  45. Well guys, I screwed up. I was sure the cli was working, but that was just because I had attached all of the vhdx files before so the computer knew which drive letter to assign. Updating now.

  46. Hello, great tool! It would be nice to add an option to export a report.

    thanks!

  47. Great tool! The 2004.1 update fixed the not shrinking bug when using the cli.
    I have a feature request. Would it be possible to feed the cli with a .csv that contains unc file paths to vhdx files?
    I’m asking because i would like to run a scheduled task on a few 2016 servers so I can split the load and shrink multiple vhdx containers simultaneously.

    • Hi, have spread the .VHDX files to a lot of different shares?
      If not – you do not need to point to the root of the users VHDX. Point to the share it self, and the tool will scan for .VHDX files in all the sub folders.

  48. Dear developer,

    Great tool you have here but it hasn’t turned out too good for our environment. I ran it once and ever since, users complain that applied settings are gone every time they log back in after logoff. Any idea why this is happening? Thank you in advance

  49. Hi! (I`m not the developer ๐Ÿ™‚ ) Have you configured FSLogix to allow Multiple Connections? Do users get the RW.VHD(X) file in the profile folder when logged on? If you then did run this tool while users where logged on, the tool made change to parent disk and some issued occurred when the difference disk tried to write back (to the changed parent disk) when logging off. Just a theory.

  50. Firstly this looks like a great tool. Not sure but can you post all the switches available and what they do please?

    • This will attempt to compact every vhd(x) in a directory and all subdirectories
      shrinkfsl.exe \\root\profile\share

      This will attempt to compact every vhd(x) in a directory and all subdirectories that are equal or greater than 4GB in size
      shrinkfsl.exe \\root\profile\share,4096

  51. Noticed that it doesn’t cope well with apostrophes, for example a profile disk called Profile_o’sullivanr.VHDX appears to get stuck at the diskpart stage (diskpart process starts, stops, starts, stops etc.). Expect one or more references to the name of the VHDX in the script might need some quotes putting around it in order to cope with the special characters (or similar)? Thanks.

    • As long as it is a ‘ and not a ` it should work. Have you tried the latest release?

      • Apologies for delay. Yes, I noticed a newer version the day after I posted and that worked fine with the ‘ characters. Great utility, will keep checking back for future updates. Thanks.

  52. Hi,
    thank you very much for this useful tool. Also with the latest version 23/04/2020 there is different result between run the tool as scheduled task or using the gui interface. With the gui interface you free much more space. You can obtain better result if you mount the vhd, optimize it with windows defrag, dismount and lunch again shrinkfsl using the gui. So I want ask you if it’s possible in your script automatically mount file, defrag it, and after optimize it everything automatically. And my last question is why so different between scheduled and gui process ? Thank you in advance.

  53. Your work is amazing, thank you for sorting out the schedule task issue, I was just about to look it up. Keep up the great work.

  54. Thanks again for the nice work an a very useful tool!

    One question, could you make the program able to see folders with the “hidden” attribute?

    If i point directly to the hidden folder it works, but if it`s a hidden subfolder some where under the root path the program donยดt “see” it.
    It`s the same with both GUI and CLI.

  55. This looks amazing! We have some old non fslogix upd’s that I’d like to use this on. No problems?

    • Not trying to be pushy or demanding, just offering suggestions; would incorporating Sidder.exe into the gui be feasible? Easy enough to do on its own but would be nice to find specific users. Thank you so much for this utillity.

      • FSLogix profiles are under a folder named _ by default (I reverse mine for easy sorting though). Also the .vhdx files are named Profile_.vhd(x). So, I don’t see the need for sidder.exe.

  56. I just downloaded the tool this morning and it is not working. Immediately returns 0. Went back to the old version and that is working correctly.

    • What do you mean it returns 0? Make sure you are pointing it to the root of the profile share.

      • Yes I am using the old version fine. With the new version I select the vhdx and it immediately returns the results 0 diffMB on all VHDX files. I change back to the older version and it works fine.

  57. New version doesn’t compress from GUI or command line for me. Tried the old version (dated 10/10/2019) and it worked. Why would new version not work but old does?

  58. Thanks for this tool it’s great. I’ve been testing this and it seems that it does not do a defrag? I’ve been running this on all my VHDX file and it seems to do a good job but I noticed I had a 7GB VHDX file but when I cracked it open it only had 1GB of actual data. Since it was mounted I ran a defrag on it and discovered it was 14% fragmented. After I ran a defrag I was able to leverage your program to shrink it to 1GB.

    Can you add Defrag to the process?

    • I noticed I had an older version but it still seems to have the same problem. Optimize-VHD power shell command does not do a true defrag.

  59. Hi again! Some questions and feedback.

    1. The later versions of this program uses optimize-volume instead of defrag.
    Would it be any with benefits of combining these methods? More optimized disks?
    E.g. first run defrag (with older version), then run again optimize-volume (latest version)

    2. “Does not need drive letters anymore” (From Version 2004.2)
    In my experience, all versions still assign the disk a drive letter.

    3. Latest version does not seem to create log file when running in GUI mode. Work in CLI mode.

    Thanks again!

    Regards
    Fredrik

  60. It seems like the different approaches has very different results on different disks.
    Guess it depends on how the data and white spaces on the disks are.. (?)

    Here is an example where the new version not did free up any space at all, but the old version did shrink A LOT.

    New version (2004.5.0.0)

    “Profile”,”SizeBeforeMB”,”SizeAfterMB”,”DiffMB”,”Locked”
    “TSProfile.V6.VHDX”,”4772″,”4772″,”0″,”False”

    Older version (2004.1.0.0)

    “Profile”,”SizeBeforeMB”,”SizeAfterMB”,”DiffMB”,”Locked”
    “TSProfile.V6.VHDX”,”4772″,”964″,”3808″,”False”

    I have also done testing, where the result was totally different. The new version did free up a lot of space on the same disk as the old version not did free up anything.

    • What about maybe two passes, defrag first, then compact? Maybe even as an option

      • Yes, that is what we currently are doing. First 2004.1.0.0 and then 2004.5.0.0
        The second run does not seem to do much – when it comes to freeing up space.

  61. Hi David,

    This tool works great but in order to get approval to use it in my company I will have to show Source code.

    Is that something you might be able to make available?

    Thanks

    Paul

  62. Hi David,

    Thanks for this great tool. However, its not compating our profile disks, it seems that the disk optimization does not free up any empty space like defragmentation would. I came across another powershell script that does this exactly and as a test, it frees up 5GB from a 6GB profile. This same profile disk, passed through your tool only frees up 300 MB leaving more than 5 GB profile behind.

    I would rather use your tool and have my hopes that you are able to resolve this.

    Regards,
    Richard – Exite ICT

  63. New version (2004.5.0.0) isn’t working for me, doesn’t compress some of the VHD’s. Some do, but the results from a really old version are far better. Does anyone have a link to version 2004.1? I don’t have it anymore. Thanks.

    • Seconded, this would be really useful if someone has older versions as I’m seeing almost no gains on the latest version

  64. Hello David,

    is it also possible to still share version 2004.1 (with defrag instead of optimize-volume) of the tool? It seems that the gains with defrag are significant more than with using optimize-volume.

    thanks in advance,

    Joeri

    • +1

      Love the concept of this tool. But I have users with 6GB .VHD files, and the profiles are only 1 -2 GB in size. Running the latest ShrinkFSL tool, I only get marginal gains 20 – 200MB.

      As per the above posters request, I’d like to get a copy of the older version (or an updated version) that uses defrag instead of optimize-volume.

      Thanks in advance,
      Dan

  65. I believe the latest version is not working properly, I almost see no shrink, and the script is finished In like 5 minutes with more then 100 profiles?

    • The latest script shrinkt 9024MB on 157 profiles.

      Script version 2003.1.0.0 (yes we still use one of the first scripts) shrinkt 569984MB on 157 profiles..

  66. Hi, sorry, but version 2005.1 still isn’t reducing VHD’s much. I ran it against a 5GB VHD, and it took off 80mb. Then I ran the old one (Version 1.0.2.0) against the same VHD and it took off 3542mb.

    • I just compacted a vhdx with the newest version, restored it, and compacted again with the last version that used defrag.exe – they reduced the profile the same.

      • Let me give you a bit more spec.

        VHD (we use VHD, not VHDX) storage server is Windows Server 2019 Version 1809. VHD are created by FSLogix 2.9.7237.48865 from Citrix Servers running Citrix Virtual Apps and Desktop 7 2003.

        I made a copy of a VHD that I know is oversized from one of our users:

        Version 2005.1 Results from Copy 1:

        First Run: Initial 7047.77, After 7047.77, Diff 0
        Second Run: Initial 7047.77, After 7047.77, Diff 0

        Very fast runs on the above, under 20 seconds.

        Version 1.0.2.0 Result from Copy 2:

        First Run: Initial 7047.77, After 3905.65, Diff 3142.12
        Second Run: Initial 3905.65, After 3901.64, Diff 4.01

        Slower runs on the above, about 60 seconds before results.

        I think this is a great tool so please do keep up the good work.

  67. Should we be noticing a difference in the new build? Files are shrinking about the same; however, I’m using this against user profile disks not specifically fslogix files.

  68. Does anyone have access to the older version? I ran the newest version 2005.1 on a fslogix profile that I know is 9gb total size, yet the vhdx is 19gb, and the tool only reduced the size of the vhdx by a couple hundred mb.

  69. Thanks for the new version David, some feedback from our implementation of FSLogix (VHD not VHDX);

    Using the latest version I see behaviours similar to previous versions CLI is reducing the size marginally on some, significantly on others, and not at all on yet others.

    I’ll continue to test. Any idea if i can get a previous version to review/compare?

    • FYI All, I found an old version in my downloads

      2005.1 reduced a bunch of VHD’s by 94MB Subsequent pass with 2005.1 I reduced the same VHDs by 0MB

      Subsequent pass with 2004.5 reduced the same VHD’s by 0MB

      I picked the biggest VHD to review, this 10GB VHD only contained 2.68GB worth of files.

      Not sure where to go from here.

  70. I experience the same with the newest version 2005.1. Profiledisks sometimes shrinked by 0MB and after a rerun by 32MB (or another low value).
    In one case my VHDX had 10GB assigned but it only contains around 4,5GB. After shrinking it was reduced to 7,5GB.

    Is it possbile to get the old version also to verify this behaviour? I really appreciate your work, it is a great tool.

    • If you guys jump into WorldofEUC, should should be able to chat with David and ask him.

      https://communityinviter.com/apps/worldofeuc/world-of-euc-project

    • Here are the results from my scheduled task over the past couple of months – log name and total amount in MB that profiles have been reduced. I have gone through the same versions as everyone else.
      Shrink_03152020_030003.log
      18912
      Shrink_03222020_030002.log
      31840
      Shrink_03292020_030001.log
      13216
      Shrink_03312020_083542.log
      -4
      Shrink_04052020_030001.log
      10688
      Shrink_04122020_030002.log
      9920
      Shrink_04192020_030002.log
      8480
      Shrink_04262020_030002.log
      10304
      Shrink_05032020_030002.log
      14272
      Shrink_05102020_030002.log
      8960
      Shrink_05172020_030002.log
      13376
      Shrink_05242020_030002.log
      16128
      Shrink_05312020_030002.log
      22848

  71. Hello David,
    Have you received any reports of the compacting tool causing corruption issues with outlook data files or .osts? I ran the tool against vhdx’s for a company I support and a week later people are reporting .ost corruption which I know is common in the Outlook/Exchange world but I just want to cover my tail on this one. I tried to explain that it could not be the tool due to its functionality but not 100% sure. Your feedback will be greatly appreciated.

  72. I found the cause of my profile bloat. Microsoft Teams.

    Creating and using the following redirections.xml has prevented this bloat;

    <FrxProfileFolderRedirection ExcludeCommonFolders="”>

    AppData\Local\SquirrelTemp
    AppData\Local\Microsoft\Teams\Current\Locales
    AppData\Local\Microsoft\Teams\Packages\SquirrelTemp
    AppData\Roaming\Microsoft\Teams\Service Worker\CacheStorage
    AppData\Roaming\Microsoft\Teams\Application Cache
    AppData\Roaming\Microsoft\Teams\Cache
    AppData\Roaming\Microsoft Teams\Logs
    AppData\Roaming\Microsoft\Teams\media-stack

    https://social.msdn.microsoft.com/Forums/windows/en-US/029e130e-5892-4d1f-88a7-f8046d78f3b0/using-redirectionsxml-to-configure-what-to-copy-to-a-profile-with-fslogix?forum=FSLogix

    Profiles are now around 400MB on average instead of 4-10GB

    • I can confirm this, I had exactly the same problem and did the exact same fix. My VHD’s have stopped growing to crazy sizes.

    • This only works for profiles right? Not for office 365 containers. I’ve been looking for a way to exclude folders from Teams cache with O365 containers but had no luck so far. The registry key for redirections doesn’t seem to work.

  73. I experience the same with the newest version 2005.1, but i never tried the older versions. Is it possible to upload 2004.1 somewhere so we can test both versions. Teams bloat our fslogix profiles to 10-13 GB in size.

  74. Hi all,

    Any news fixing the 2005.1 version to shrink more, can it be changed back to defrag instead of optimize? If we run a manual defrag and then diskpart-compact then we get massive reductions compared.

    Great tool though, great work.

    thanks

    steve.

  75. My VDHX file is 6,5 GB and has only 1 GB of actual data inside. Used the tool but does not shrink at all.
    Could this be a bug in te latest version?

    • I’m going to re-write the tool when I have a chance.

    • Hi Martin, FSlogix comes with an FRX command utility that will migrate a VHDX file to a new one, this migrates just the data and so the new VHDX is smaller than if you just run the compaction utility. The frx utility is installed in the FSLogix\apps folder in wherever you’ve installed FSLogix, usually C:\Program Files\

      The syntax is frx.exe migrate-vhd -src “\\path\to\source.vhdx” -dest “\\path\to\destination.vhdx”

      You can copy just the frx.exe to other systems to run it, I have it on an operations server and I have a script running on that server that does a migration if the vhdx is over a certain size, otherwise it does a compaction.

      • Hi Micheal,

        The FRX command utility seems to work fine. Migrated my personal VHDX from 6,5 GB to 1,2 GB.
        Quite a big difference!

        Could you share your script? Otherwise I will have to create my own in order to rename the new VHDX and delete the origional ones.
        The compaction you mentioned, if the VHDX is under a certain size, is done with David’s tool I presume?

      • I am curious how long that takes.

  76. I love this tool. I have heard that security tools are seeing it trying to reach out to South Africa or Austria or something. Is there an update lookup function running in the tool? Or could our security team have missed something.

    Thanks.

  77. With your latest version I’m trying to run the CLI version. ShrinkFSL.exe -path \\UNC\UNC\ -size 10120 -tasks 2 what I’m seeing is in disk manager ALL VHDx are being loaded, not just two… I let this run past 100 and it wasn’t stopping. Thoughts? Or expected behavior?

  78. Hi David,

    Thanks for the ShrinkFSL tool. I just tested the 2006.4 version. For the profiles it is working great but for the office profiles it always ends with a DIffMB of 0. When I use the old 2003.1 version and test with a office profile I get a result 6976MB where the new tool gives me 0MB. There is no difference of running it via commandline or the gui.
    Can you fix this?

    Kind regards,

    Freek van Ekkendonk

    • Hello,

      I have same problem with actual version as Freek, we are currently using only Office containers and difference is always 0.

      Rudo

  79. Hi David,

    Really appreciate the time and work you’ve put into the tool, thank you!

    I’m afraid that I’m another person who is getting no shrinking when using the 2006.4 version. I’ve tried updating Powershell on the Server 2012R2 file server to v5.1 but that hasn’t sorted the problem. I’ve also tried running the tool from a Windows Server 2016 machine across a VNC path and still getting no shrinking, even though the old version (I’m still running 1.0.2.0!) is still able to claim some space back.

    Extra annoying is that the 2006.4 version is not detaching the VHDx files when it’s finished. Glad I tested before running on production!

    Thanks,
    Bryan

    • “Extra annoying is that the 2006.4 version is not detaching the VHDx files when itโ€™s finished.”

      No issues with shrinking here, but I did find only after I had about 3,000 VHDXs listed as added when I ran a diskpart so I encountered that too.

    • yes same problem here. dataching is not working ๐Ÿ™

      • What OS and powershell version? I am running it as a scheduled task on server 2016 with ps version 5.1, and built the program in powershell studio on Windows 10 with ps version 5.1. I do not have any issues.

  80. I have mixed results. With version 2006.4 my profile containers are shrinking very good, but my ODFC containers do not shrink a single bite.
    With version 2005.1 my ODFC containers shrink a lot.

    Maybe you can combine both technologies in a single pass per VHDX.

    I also noted that when running “ShrinkFSL.exe -path \\servername\share -size 1024 -tasks 4” (with version 2006.4) some VHDX files remain mounted during the run of the program. (script is still running, so I don’t know if they will dismount at the end)

    • If you look at task manager you should see a powershell instance for each vhd(x) attached. If you have fewer powershell instances than you have vhd(x) attached then there is a problem – the powershell instance shrinking the disk failed to dismount the virtual disk. If that is the case then it is probably your version of powershell – I am using it on Windows 10 and on Server 2016 with no issues – both look to have PS version 5.1

      • Script is also run on server 2016.
        From the 1800 VHDX about 20 remain mounted. not much, but to much to schedule this tool to run unattended.

      • I am having the same issue with 2006.4. Profile disks shrink fine but ODFC files never seem to shrink. I don’t have an older version to test with.

        Manually mounting, defragging and shrinking the VHD works fine though.

  81. Hi , I am trying to run this as a task with power shell using the exe. When open the the exe and browse to path this works fine. I run this in power with the path , i get the message no path specified.

  82. This is absolutly wonderful. Thanks a lot for this simple tool. Can i donate somehow? ๐Ÿ™‚

  83. This is a great tool – I have been running the original PS script shrinker tool for a couple of years to great effect. However recently profiles have been bloating up massively, which we assume is from a combination of Teams (the well known issue) and also some changes to Chrome paths which, because I haven’t been paying close enough attention, are no longer excluded in my FSLogix redirections.xml file.

    However, I have noticed that whilst both this exe version and the original script version shrink the files, neither achieve much on their own. I copied 100 profile folders to a test disk and ran both this and the old PS script sequentially with the following results:

    Original folder size on disk: 648GB
    First run of ShrinkVHD: 590GB (NB whilst some files lost multiple GBs, quite a number actually gained size according to the ShrinkVHD output)
    Second run of ShrinkVHD: 590GB (ie no further reductions, as expected I guess)

    Then I ran the original PS script against the same folder, and it dropped to just 238GB. So by running the two methods sequentially, I shrunk 648GB of profiles into 238GB.

    What could cause this, and would there be any mileage in combining whatever the tools do differently into a single operation?

  84. I always get the message that Hyper-V is not available when running the old powershell script.
    Even when I do “Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All”
    How do you get the old script running without this error?

  85. Hi,

    First of all thanks for your tool and your ongoing support of it. YOU ARE AWESOME!
    Just wanted to highlight some odd behaviors and my workarounds. All of it experienced when using tool versions via command line.
    -2004.5 – sometime the tool doesn’t detach profiles. So I used a script to feed one container folder at a time and then, once the tool is finished, to run Dismount-diskimage
    -2005.1 – Works like a charm. However I need to run it 3-4 times in order to have a maximum shrink this tool can do by itself
    -2006.4 – gives me whole lot of pop-up windows with folder or path not found buttons and something else. It also fail to detach the vhdx. (I checked command line arguments, I promise)

    So, I was reading comments and understood that versions with defrag are making the best shrinking. Since 2006.4 is not working for me I’ve decided to make a little script that first runs 2005.1 then it mounts vhdx, performs a defrag, retrim, slabconsolidate (both using defrag utility and Optimize-Volume) and then runs 2005.1 again. Results are amazing. As an example the O365 container with initial size 16GB, after runing through 2005.1 several times reduced it’s size to 14 GB. Once I did a defrag and optimize-volume it actually extended size by several hundred MB, but the second run of 2005.1 shrinked it to 7GB. The only downside of this approach is time required for one profile – it is very slow

    Thanks for your tool. it is a life saver

  86. This tool works fine for shrinking Profile Disks, but it doesn’t seem to shrink ODFC files at all?

    My current problem is due to Teams our ODFC disks are up to 20GB in size and we’re running out of space. ๐Ÿ™

  87. Same issue here – latest version 2006.4 is not compacting Office VHDX files at all, whereas the 1.0.2.0 version does. Any ideas why?

    Also noted,if I go into diskpart and list vdisk, it shows a load of vdisk have been added for all the profiles I’ve been trying to compact, I guess this is another bug?

  88. Look at the list of exclusions for Teams earlier in the thread – this will stop your profiles expanding. You will have to knock up a login script or similar to delete what is already there, after which the exclusions will do the trick. You will probably also need to shrink the disks down too ๐Ÿ™‚

  89. For the 2006.4 version, on a 2012 R2 file server the app does not dismount he vhdx files after it runs, either via gui or through command line. In Windows 2016 and 2019 it is fine. Any ideas?

  90. Hi David,

    Many thanks for this tool which seems promising.

    We have here FSLogix VHDX that weigh 20 GB but in which only 7 GB are used; we urgently need to shrink them in order not to explode the storage.

    Unfortunately, executing the tool on a few VHDX does not shrink a single byte, DiffMB is always = 0.
    I’ve tried to use the tool via GUI and via command line, both ways does not work.
    Executed on a Windows Server 2019 and Windows 10 1909 machines with administrative rights and .Net 4.8 installed.

    Do you have an idea on how we could make it work?

    Thanks!

    Kind regards,
    Nicolas

    • I’m seeing the same issue with O365 VHDX files running 2006.4. Scanned a folder, none are shrinked at all. Not sure why. My Win10 1809 PC meets all the requirements.

  91. Hey David, I’ve been testing ShrinkFSL.exe against our O365 VHDX files, and have not gotten any to actually shrink. I noticed that a few people above said they did not see them shrink either. I’m not sure what the difference would be… There is a lot of slack space in these VHDX files due to Teams, and should shrink substantially. We’ve tried on various PCs running Powershell 5.1 Some say the old version (2003.1) worked on Office containers. Any way you could post the older versions somewhere?

    I see the VHDX mount, process, and dismount.
    Here’s the log:

    “Profile”,”SizeBeforeMB”,”SizeAfterMB”,”DiffMB”,”Locked”
    “ODFC_UserID.VHDX”,”996″,”996″,”0″,”False”

  92. Thank you for this nice tool, this is very helpful

    I have a small problem using the CLI-Version.
    My Filestructure is D.\Profile\User1, D:\Profile\User2

    shrinkfsl.exe -path d:\Profile\ find only the files in User1 not User2. The gui is finding every content of the subfolders.

  93. When I rerun it then he jump to a few subfolders and stop it.

  94. Thanks for putting this tool together!

    However I have the same issue people are mentioning above, it has no effect on my ODFC disks ๐Ÿ™

  95. Thanks for this brilliant tool. The latest version 2006.4 seems to leave the VHDX’s mounted after it completes. This was on Server 2016 with FXLogix Profile Containers (without differencing disks). This is both with GUI and CLI.

  96. Thank you for the great tool, please keep working on it as you can, it helps a lot of SysAdmins.

  97. Wow, you are a hero. Great and thank you so much!

  98. Hi,

    i used to use version 1902.0.0.0 and here it works perfectly and the profiles are scaled down.

    With the latest version this does not work.

    as an example:

    O365 container 3000mb large
    – new version does not shrink anything
    – old version finds 1400mb to reduce

    The problem is that the old version cannot be started via the script. Is there a new version or does anyone know this error?

  99. New to fslogix world but loving this tool.

    1 question – if it sees a disk as locked will it attempt to compress it or just skip it?

  100. Is there a place to get an old version? i.e. version 1902.0.0.0 or something other than the latest.
    The only download I can find is the current one (which as seen in many posts above does not properly shrink the O365 containers).
    I was hoping to shrink my VHD’s soon (waiting since the beginning of summer) as they are filling up the allocated space and I was hoping this bug would have been resolved. Thanks.

  101. Hi David,

    This script works on any type of VHDX ?

    For example i use some vhdx on my local machine but when i run the script, before and after sizy is the same.

  102. I have run it on a few UPD’s and it doesn’t shrink them at all. i opened up one manually and could see that it was possible for it to shrink the space, however the GUI is not compacting? i ran it as admin and ensured net 4.5 was installed.

  103. This is really a great tool ! Sadly it does not seem to compact my Office365 containers and only my profile containers. I read that this worked in the past with an older version of the tool.
    Any plans on fixing this or any explaination why it is acting like this and not compacting the vhd(x) ?

  104. Hi, maybe this can help in solving the inabiliby to compact O365 containers.

    A volume shrink analysis was initiated on volume O365-user.name. This event log entry details information about the last unmovable file that could limit the maximum number of reclaimable bytes.

    Diagnostic details:
    – The last unmovable file appears to be: \$BitMap::$DATA
    – The last cluster of the file is: 0xbfffe
    – Shrink potential target (LCN address): 0x3eeb0
    – The NTFS file flags are: -S–D
    – Shrink phase:

    To find more details about this file please use the “fsutil volume querycluster \\?\Volume{3f3daa32-8c04-43fe-b3ea-eaaa29469d05} 0xbfffe” command.

    if i manually mount the vhd file ik can shrink the volume by 80% but of course, as expected, the vhd size remains te same.
    Is the message above useable in order to find a solution for the O365 containers?

  105. […] unused space and shrink the VHD(X) files to the minimal size possible. I use the tool “ShrinkFSL“, created by David Ott. The nice thing about this tool is you can run it interactively with a […]

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

This site uses Akismet to reduce spam. Learn how your comment data is processed.