DSC Resource for Mount Points

This topic contains 4 replies, has 3 voices, and was last updated by Profile photo of Zuldan Zuldan 3 weeks, 5 days ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #50408
    Profile photo of Zuldan
    Zuldan
    Participant

    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.

    #50412
    Profile photo of Arie H
    Arie H
    Participant

    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.

    #52694
    Profile photo of Ryan Bartram
    Ryan Bartram
    Participant

    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.

    #52786
    Profile photo of Arie H
    Arie H
    Participant

    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

    #53126
    Profile photo of Zuldan
    Zuldan
    Participant

    @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?

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.