There have been some major enhancements and modifications in the functionality of defrag in Windows server 2012.
/D Perform traditional defrag (this is the default).
/K Perform slab consolidation on the specified volumes.
/L Perform retrim on the specified volumes.
/O Perform the proper optimization for each media type.
The Storage Optimizer in Windows 8/Server 2012 , also takes care of maintenance activities like compacting data and compaction of file system allocation for enabling capacity reclamation on thinly provisioned disks. This is again platform specific, so if your storage platform supports it, Storage Optimizer will consolidate lightly used ‘slabs’ of storage and release those freed storage ‘slabs’ back to your storage pool for use by other Spaces or LUNs. This activity is done on a periodic basis i.e., without any user intervention and completes the scheduled task provided it is not interrupted by the user.
Microsoft link: https://blogs.technet.microsoft.com/askcore/2014/02/17/whats-new-in-defrag-for-windows-server-20122012r2/
Impact/Risks:
The available free space of a Datastore fills up quickly and run out of space. This may impact already powered on VMs or not allowing VMs to be powered on