- August 15, 2016 at 5:54 am #50408
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 (https://github.com/PowerShell/xStorage/issues/47) but was hoping someone has already created something I could use in the meantime.August 15, 2016 at 7:17 am #50412
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.August 31, 2016 at 1:45 pm #52694
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.August 31, 2016 at 5:33 pm #52786
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-PartitionAccessPathSeptember 2, 2016 at 4:44 am #53126
@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 https://github.com/PowerShell/xStorage/issues/47
I still would like to get hold of your custom resource. Any chance you could upload it to Github or even just a Gist?
You must be logged in to reply to this topic.