Running diskpart on startup using GPO startup script throws COM service error on Windows Server 2025
Hi Experts,
I'm trying to create a Windows Server 2025 template for use in cloud. I have added an startup script called extendvol.bat to "Startup" GPO which runs diskpart tool to extend the system volume to the maximum amount of space available on the disk when computer is starting up. However, the script doesn't work.
I have accomplished this goal on Windows Server 2019 and 2022 just the same way and it works fine on those versions of Windows Server. However, when I do this for Windows Server 2025, it doesn't work.
I have added the script to the following path in GP - Computer Configuration -> Windows Settings -> Scripts -> Startup Scripts.
I have tested the script by running it as "Local System" user using psexec" tool and it works fine. However, when it gets executed upon computer startup, the diskpart tool throws the following error message which is logged into a file:
DiskPart encountered an error starting the COM services.
I have also tried making the virtual disk service to start automatically but didn't help.
As the same script works on previous versions of Windows Server, there should be a change in 2025 that prevents diskpart to run successfully before computer is fully started.
Any direction to fix the issue will be highly appreciate.
Thanks in advance.