To be annotated later. ===================================================== Param( [string] $HyperVClusterName, [string] $ShareName )
# Check values if(!$HyperVClusterName -or !$ShareName) { Write-Host "Error: Please enter required parameter values." Exit }
# Create the share folder MD C:\ClusterStorage\Volume1\$ShareName
# HyperV Nodes ICACLS.EXE C:\ClusterStorage\Volume1\$ShareName --% /Grant hcp\HC2N1$:(CI)(OI)F ICACLS.EXE C:\ClusterStorage\Volume1\$ShareName --% /Grant hcp\HC2N2$:(CI)(OI)F
# HyperV Cluster Account $cmdString = "ICACLS.EXE C:\ClusterStorage\Volume1\$ShareName --% /Grant hcp\$HyperVClusterName" $cmdString += '$:(CI)(OI)F' Invoke-Expression -Command $cmdString
# HyperV Admins ICACLS.EXE C:\ClusterStorage\Volume1\$ShareName --% /Grant "hcp\Domain Admins:(CI)(OI)F"
# Management group (optional) ICACLS.EXE C:\ClusterStorage\Volume1\$ShareName --% /Grant "hcp\SMBShare:(CI)(OI)F"
# Remove inheritance (optional) ICACLS.EXE C:\ClusterStorage\Volume1\$ShareName /Inheritance:R
# Create new share and set matching Share permissions $FullAccess = ('hcp\HC2N1$','hcp\HC2N2$','hcp\domain admins') $FullAccess += "hcp\$HyperVClusterName" + '$' New-SmbShare -Name $ShareName -Path C:\ClusterStorage\Volume1\$ShareName -FullAccess $FullAccess =====================================================
Richard Mueller edited Revision 2. Comment: Removed (en-US) from title, added tag