In Windows Vista and higher, there is a new WMI class called Win32_Volume that you can use to format drives. However, you should be careful when formatting data on a drive. The following line will format drive D:\ using NTFS file system, provided you have appropriate permissions:
(Get-WmiObject -Class Win32_Volume –Filter "DriveLetter='D:'" ). `
Format('NTFS',$true,4096,"",$false)
Format('NTFS',$true,4096,"",$false)