Does anyone know if there is a DSC resource for mount points? (handy for SQL Servers). I’ve requested the feature to be added to xDisk (xDisk - Feature Request - MountPoints · Issue #47 · dsccommunity/StorageDsc · GitHub) but was hoping someone has already created something I could use in the meantime.
Hi,
Haven’t seen one.
I normally used MountVol in vbscripts and batch files to do the work on my SQL servers, but you can also achieve that with WMI code.
As always if you have code to do the job, you can wrap it in a script DSC component and create your own DSC.
Hope it will be added to xStorage as its a good needed addition.
I wrote a custom resource do this for exchange. Just a part of my modified xstorage module. I can share the code if you’re interested. Really should get around to setting up git ;). But basically I just have a wrapper function for diskpart, as far as i’m aware there isn’t a powershell command to add mount points…could be wrong though.
if you don’t want to rely on diskpart or MountVol you can go directly to the Win32 api,
but apparently PowerShell does have cmdlets to deal with mount points.
Look at Add-PartitionAccessPath
@Ryan, as Arie has said you can use Add-PartitionAccessPath to create a mount in Powershell. See example below.
$Disk = Get-Disk 2 $Disk | Initialize-Disk -PartitionStyle GPT $disk | New-Partition -UseMaximumSize -MbrType IFS $Partition = Get-Partition -DiskNumber $Disk.Number $Partition | Format-Volume -FileSystem NTFS -Confirm:$false $Partition | Add-PartitionAccessPath -AccessPath "C:\MyMounts\SQLData01"
PlagueHO has kindly offered to create xMountPoint. See xDisk - Feature Request - MountPoints · Issue #47 · dsccommunity/StorageDsc · GitHub
I still would like to get hold of your custom resource. Any chance you could upload it to Github or even just a Gist?