Skype for Business: Create DFS with PowerShell


Skype for Business needs a file share to store shared data of the pool. When installing a Skype for Business environment you want the file share to be high available. In order to make a file share high available you need DFS, Distributed File System.

For installing and configuring DFS I used this blogpost (https://insidemstech.com/2015/08/24/deploy-dfs-for-skype-for-business-server-2015-enterprise-pool-part-i/) for guidance. But after clicking my way through the DFS configuration a couple of times, i wondered if i could create a PowerShell script for it. I’m no PowerShell expert so there may be better ways, but here we go:

# Step 1: Installation Windows Features on DFS Nodes 1 and 2

Install-WindowsFeature RSAT-DFS-Mgmt-Con, FS-DFS-Namespace, FS-DFS-Replication

# Step 2: DFS Node 1

# Create Shared Folders with the correct permissions

New-SmbShare -Name “FileShare” -Path D:\DFSRoots\FileShare -FullAccess Administrators -ReadAccess EveryOne

New-SmbShare -Name “SfBShare” -Path D:\SfBShare -FullAccess Administrators -ReadAccess

EveryOne

# Create New DFS NameSpace

New-DfsnRoot -Path \\domain.com\FileShare -TargetPath \\sql01\FileShare -Type DomainV2

-EnableSiteCosting $true -EnableAccessBasedEnumeration $true

# Create New DFS Folder Target

New-DfsnFolderTarget -Path \\domain.com\FileShare\SfBShare -TargetPath \\dfs01\SfBShare

# Step 3: DFS Node 2

# Create Shared Folders with the correct permissions

New-SmbShare -Name “FileShare” -Path D:\DFSRoots\FileShare -FullAccess Administrators -ReadAccess EveryOne

New-SmbShare -Name “SfBShare” -Path D:\SfBShare -FullAccess Administrators -ReadAccess EveryOne

# Stap 4: uitvoeren op node 1

# Add a Namespace server

New-DfsnRootTarget -Path \\domain.com\FileShare -TargetPath \\dfs02\FileShare

New-DfsnFolderTarget -Path \\domain.com\FileShare\SfBShare -TargetPath \\dfs02\SfBShare

# Step 6: DFS Node 1

# Create New DFS Replication Group, add a DFS Replication folder and members

New-DfsReplicationGroup -GroupName SfBShare | New-DfsReplicatedFolder -FolderName SfBShare |

Add-DfsrMember -ComputerName dfs01, dfs02

# Add the correct connection

Add-DfsrConnection -GroupName SfBShare -SourceComputerName dfs01 -DestinationComputerName dfs02

# Adjust membership

Set-DfsrMembership -GroupName SfBShare -FolderName SfBShare -ContentPath d:\SfBShare -ComputerName dfs01 -PrimaryMember $True

Set-DfsrMembership -GroupName SfBShare -FolderName SfBShare -ContentPath d:\SfBShare -ComputerName dfs02

The script is provided as is. In a future blogpost I might make it a PowerShell DSC script. J

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s