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

PowerShell: Deploy Certs on Remote Windows Servers

Quick Script for Local Machines: $certPath="C:\kimconnect_cert.pfx" $certPlaintextPassword='PASSWORD' $certEncryptedPassword=ConvertTo-SecureString $certPlaintextPassword -AsPlainText -Force Import-PfxCertificate -CertStoreLocation Cert:\LocalMachine\My -FilePath…

How to Disable WordPress Auto Wrap Function ‘wpautp’

Update: the current version of WordPress has rendered these methods ineffective. I'll update this post…

Clean Windows C Volume

Have you ever ran into a sluggish performance on a Windows machine that is being…