# Diskpart for Windows

**URL:** <https://forum.ansible.com/t/diskpart-for-windows/27051>\
**Category:** Ansible Developer\
**Tags:** windows, awx\
**Created:** [March 20, 2018, 12:16pm UTC](https://forum.ansible.com/t/diskpart-for-windows/27051 "2018-03-20T12:16:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Josh\_B](https://avatars.discourse-cdn.com/v4/letter/j/8797f3/32.png) [@Josh\_B](https://forum.ansible.com/u/Josh_B)\
**Post date:** [March 20, 2018, 12:16pm UTC](https://forum.ansible.com/t/diskpart-for-windows/27051/1 "2018-03-20T12:16:30Z")

</div>

Hello,  
I am working on deploying some Server 2016 machines with an awx playbook. I am adding a data volume but I am noticing that server 2016 is not formatting the disk like Server 2012 does. With 2012 all I need to do is reboot.

Is there a way to run the diskpart commands within a playbook to get the drive formatted?

Thanks in advance!

Josh

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [March 21, 2018, 4:38am UTC](https://forum.ansible.com/t/diskpart-for-windows/27051/2 "2018-03-21T04:38:04Z")

</div>

Hi

If you want to use diskpart I believe you need to put each command as a line in a text file and then call the diskpart exe and reference that text file. This isn’t really ideal and you should probably look at the newer PowerShell cmdlets to do what you want. I found this is a good place to start when looking at them [https://blogs.msdn.microsoft.com/san/2012/07/03/managing-storage-with-windows-powershell-on-windows-server-2012/](https://blogs.msdn.microsoft.com/san/2012/07/03/managing-storage-with-windows-powershell-on-windows-server-2012/), unfortunately we don’t have any modules to do this work yet so you will have to use some sort of script right now.

Thanks

Jordan

---

<div class="post-metadata">

**Author:** ![Josh\_B](https://avatars.discourse-cdn.com/v4/letter/j/8797f3/32.png) [@Josh\_B](https://forum.ansible.com/u/Josh_B)\
**Post date:** [March 21, 2018, 5:01pm UTC](https://forum.ansible.com/t/diskpart-for-windows/27051/3 "2018-03-21T17:01:41Z")

</div>

Thanks Jordan. This post solved my issue. I was able to list the commands and pull the dive and format it with a simple power shell script.
