<#
.Synopsis
    Hydration EDITIONS ENI 
.DESCRIPTION
    Hydration EDITIONS ENI 
.EXAMPLE
    C:\Setup\Scripts\New-HydraDataShare.ps1 -Path "E:\MigData" -BuildAccount "MDT_BA"
.NOTES
   Created:	 2015-12-15
    Version:	 1.0

    Author - BEZET-TORRES Jérôme
    Twitter: @JM2K69
   
       
    Disclaimer:
    This script is provided "AS IS" with no warranties, confers no rights and 
    is not supported by the author.
#>

[cmdletbinding(SupportsShouldProcess=$True)]
Param (
    [Parameter(Mandatory=$True,Position=0)]
    $Path,

    [Parameter(Mandatory=$True,Position=1)]
    $BuildAccount
)

# Check for elevation
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`
    [Security.Principal.WindowsBuiltInRole] "Administrator"))
{
    Write-Warning "Oupps, you need to run this script from an elevated PowerShell prompt!`nPlease start the PowerShell prompt as an Administrator and re-run the script."
	Write-Warning "Aborting script..."
    Break
}

# Create the MDT Build Lab Deployment Share root folder
New-Item -Path "$Path" -ItemType directory
Write-Verbose "Change permissions for $Path using Icacls.exe"
New-SmbShare –Name (($Path | Split-Path -Leaf) + "$") –Path "$Path" –ChangeAccess 'Tout le monde'
icacls.exe $Path /grant ($BuildAccount + ":(OI)(CI)(M)")
