Posted On August 29, 2019

PowerShell: Manually Create Failover Cluster SMB Shares

kimconnect 0 comments
blog.KimConnect.com >> Codes >> PowerShell: Manually Create Failover Cluster SMB Shares
# Set three variables
$shareName="someShare"
$smbServer="someClusteredVServer"
$sharePath="S:\Shares\someShare"

# Generate Domain Admins label
$subdomain=(net config workstation) -match 'Workstation domain\s+\S+$' -replace '.+?(\S+)$','$1'
$domainadmins="$subdomain`\Domain Admins";

# Create directory and its parents if they do not exists
New-Item -ItemType Directory -Force -Path $sharePath;

# Set NTFS Permissions on folder
Add-NTFSAccess –Path $sharePath –Account $domainadmins –AccessRights Full -ErrorAction SilentlyContinue

# Create the share with associated share permissions
New-SmbShare -ScopeName $smbServer -Name $shareName -Path $sharePath -FullAccess $domainadmins -FolderEnumerationMode AccessBased

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

HAProxy with Multiple SSL Certs

Method 1: --------- defaults   log 127.0.0.1 local0   option tcplog   frontend ft_test   mode http   bind…

LAMPP Passwords Change

Change ProFTP password: vim /opt/lampp/etc/proftpd.conf <?-- delete the last line in password, leave the first…

PowerShell: How to Properly Delete a Msol User Account

# Set the user ObjectID attribute variable$msolUser="6f2fcfcd-...."# Move user account to Recycle BinRemove-MsolUser -ObjectId $msolUser#…