title: Assign a mount point folder path to a drive using PowerShell
body: <p>I have a server that is provisioned with several disks. One for an OS, one for programs etc., and the remaining are to be mounted to empty NTFS folders.</p>
  
  <pre><code>Disk 0: C:
  Disk 1: G:
  Disk 2: G:\Folder01\
  Disk 3: G:\Folder02\
  </code></pre>
  
  <p>This is fairly straightforward through the GUI: <a href="https://technet.microsoft.com/en-us/library/cc753321.aspx" rel="noreferrer">https://technet.microsoft.com/en-us/library/cc753321.aspx</a></p>
  
  <p>But, I need to automate so I need to figure out how to do this with PowerShell.
  I have hit several dead ends:</p>
  
  <p>I thought I was making some progress with <a href="https://technet.microsoft.com/en-us/library/hh848657(v=wps.630).aspx" rel="noreferrer">Get-Disk</a>, <a href="https://technet.microsoft.com/en-us/library/hh848708(v=wps.630).aspx" rel="noreferrer">Initialize-Disk</a>, and <a href="https://technet.microsoft.com/en-us/library/hh848714(v=wps.630).aspx" rel="noreferrer">New-Partition</a>
  </p>
  
  <pre class="lang-psh prettyprint-override"><code>$Disk = Get-Disk 2
  $Disk | Initialize-Disk -PartitionStyle MBR
  $Disk | New-Partition -UseMaximumSize -MbrType IFS
  $Partition = Get-Partition -DiskNumber $Disk.Number
  </code></pre>
  
  <p>From here, I was hoping to do something like:</p>
  
  <pre class="lang-psh prettyprint-override"><code>New-Volume $Partition -FriendlyName Folder01 -AccessPath F:\Folder01 -FileSystem NTFS
  </code></pre>
  
  <p>But that doesn't produce any output and I noticed that earlier when I created a partition, it created a volume as well.</p>
  
  <p>I'm thinking that <a href="https://technet.microsoft.com/en-us/library/dn454966(v=wps.630).aspx" rel="noreferrer">New-Volume</a> might be the wrong command because the help indicates that the input object should be a MSFT_StoragePool object. </p>
  
  <p>I tried to go down that path a little ways with commands like: <a href="https://technet.microsoft.com/en-us/library/hh848686(v=wps.630).aspx" rel="noreferrer">Get-PhysicalDisk</a>, <a href="https://technet.microsoft.com/en-us/library/hh848689(v=wps.630).aspx" rel="noreferrer">New-StoragePool</a>, <a href="https://technet.microsoft.com/en-us/library/hh848654(v=wps.630).aspx" rel="noreferrer">Get-StoragePool</a></p>
  
  <pre class="lang-psh prettyprint-override"><code>$Disk = Get-PhysicalDisk -FriendlyName PhysicalDisk2
  New-StoragePool -FriendlyName Pool2 -StorageSubsystemFriendlyName "Storage Spaces*" -PhysicalDisks $Disk
  $Pool = Get-StoragePool Pool2
  New-Volume -FriendlyName Folder01 -AccessPath G:\Folder01 -FileSystem NTFS -InputObject $Pool
  </code></pre>
  
  <p>But I just get an error message at this point for invalid parameters, which I think is weird because I was able to use Get-Member to confirm that $Pool is a MSFT_StoragePool.</p>
  
  <p>I've also noticed that after creating that storage pool, my disk disappeared from Disk Management and no longer shows up with Get-Disk</p>
  
  <p>I think that shows that Storage Pools are something completely different from what I want to actually do.</p>
  
  <p>How do I assign a drive to an NTFS Folder with Powershell?</p>