-
Notifications
You must be signed in to change notification settings - Fork 19
DFSNamespaceFolder
Parameter | Attribute | DataType | Description | Allowed Values |
---|---|---|---|---|
Path | Key | String | Specifies a path for the root of a DFS namespace. | |
TargetPath | Key | String | Specifies a path for a root target of the DFS namespace. | |
Ensure | Write | String | Specifies if the DFS Namespace root should exist. |
Present , Absent
|
TargetState | Write | String | Specifies the state of the DFS namespace folder target. |
Offline , Online
|
Description | Write | String | The description of the DFS Namespace. | |
EnableInsiteReferrals | Write | Boolean | Indicates whether a DFS namespace server provides a client only with referrals that are in the same site as the client. | |
EnableTargetFailback | Write | Boolean | Indicates whether a DFS namespace uses target failback. | |
ReferralPriorityClass | Write | String | Specifies the target priority class for a DFS namespace root. |
Global-High , SiteCost-High , SiteCost-Normal , SiteCost-Low , Global-Low
|
ReferralPriorityRank | Write | UInt32 | Specifies the priority rank, as an integer, for a root target of the DFS namespace. | |
TimeToLiveSec | Write | UInt32 | Specifies a TTL interval, in seconds, for referrals. | |
State | Write | String | Specifies the state of the DFS namespace folder. |
Offline , Online
|
This resource is used to create, edit or remove folders from DFS namespaces. When a target is the last target in a namespace folder, the namespace folder itself will be removed.
Create an AD Domain V2 based DFS namespace called software in the domain contoso.com with four targets on the servers ca-fileserver, ma-fileserver, ny-fileserver01 and ny-filerserver02. It also creates a IT folder in each namespace. The ny-fileserver02 IT folder target's state is configured to be offline.
Configuration DFSNamespaceFolder_Domain_MultipleTarget_Config
{
param
(
[Parameter()]
[PSCredential]
$Credential
)
Import-DscResource -ModuleName 'DFSDsc'
Node localhost
{
<#
Install the Prerequisite features first
Requires Windows Server 2012 R2 Full install
#>
WindowsFeature RSATDFSMgmtConInstall
{
Ensure = 'Present'
Name = 'RSAT-DFS-Mgmt-Con'
}
WindowsFeature DFS
{
Name = 'FS-DFS-Namespace'
Ensure = 'Present'
}
# Configure the namespace
DFSNamespaceRoot DFSNamespaceRoot_Domain_Software_CA
{
Path = '\\contoso.com\software'
State = 'Online'
TargetPath = '\\ca-fileserver\software'
Ensure = 'Present'
Type = 'DomainV2'
Description = 'AD Domain based DFS namespace for storing software installers'
PsDscRunAsCredential = $Credential
} # End of DFSNamespaceRoot Resource
DFSNamespaceRoot DFSNamespaceRoot_Domain_Software_MA
{
Path = '\\contoso.com\software'
State = 'Online'
TargetPath = '\\ma-fileserver\software'
Ensure = 'Present'
Type = 'DomainV2'
Description = 'AD Domain based DFS namespace for storing software installers'
PsDscRunAsCredential = $Credential
} # End of DFSNamespaceRoot Resource
DFSNamespaceRoot DFSNamespaceRoot_Domain_Software_NY_01
{
Path = '\\contoso.com\software'
State = 'Online'
TargetPath = '\\ny-fileserver01\software'
Ensure = 'Present'
Type = 'DomainV2'
Description = 'AD Domain based DFS namespace for storing software installers'
PsDscRunAsCredential = $Credential
} # End of DFSNamespaceRoot Resource
DFSNamespaceRoot DFSNamespaceRoot_Domain_Software_NY_02
{
Path = '\\contoso.com\software'
State = 'Online'
TargetPath = '\\ny-fileserver02\software'
TargetState = 'Offline'
Ensure = 'Present'
Type = 'DomainV2'
Description = 'AD Domain based DFS namespace for storing software installers'
PsDscRunAsCredential = $Credential
} # End of DFSNamespaceRoot Resource
# Configure the namespace folders
DFSNamespaceFolder DFSNamespaceFolder_Domain_SoftwareIT_CA
{
Path = '\\contoso.com\software\it'
State = 'Online'
TargetPath = '\\ca-fileserver\it'
Ensure = 'Present'
Description = 'AD Domain based DFS namespace for storing IT specific software installers'
PsDscRunAsCredential = $Credential
} # End of DFSNamespaceFolder Resource
DFSNamespaceFolder DFSNamespaceFolder_Domain_SoftwareIT_MA
{
Path = '\\contoso.com\software\it'
State = 'Online'
TargetPath = '\\ma-fileserver\it'
Ensure = 'Present'
Description = 'AD Domain based DFS namespace for storing IT specific software installers'
PsDscRunAsCredential = $Credential
} # End of DFSNamespaceFolder Resource
DFSNamespaceFolder DFSNamespaceFolder_Domain_SoftwareIT_NY_01
{
Path = '\\contoso.com\software\it'
State = 'Online'
TargetPath = '\\ny-fileserver01\it'
Ensure = 'Present'
Description = 'AD Domain based DFS namespace for storing IT specific software installers'
PsDscRunAsCredential = $Credential
} # End of DFSNamespaceFolder Resource
DFSNamespaceFolder DFSNamespaceFolder_Domain_SoftwareIT_NY_02
{
Path = '\\contoso.com\software\it'
State = 'Online'
TargetPath = '\\ny-fileserver02\it'
Ensure = 'Present'
TargetState = 'Offline'
Description = 'AD Domain based DFS namespace for storing IT specific software installers'
PsDscRunAsCredential = $Credential
} # End of DFSNamespaceFolder Resource
}
}
Create an AD Domain V2 based DFS namespace called departments in the domain contoso.com with a single root target on the computer fs_1. Two sub-folders are defined under the departments folder with targets that direct to shares on servers fs_3 and fs_8.
Configuration DFSNamespaceFolder_Domain_SingleTarget_Config
{
param
(
[Parameter()]
[PSCredential]
$Credential
)
Import-DscResource -ModuleName 'DFSDsc'
Node localhost
{
<#
Install the Prerequisite features first
Requires Windows Server 2012 R2 Full install
#>
WindowsFeature RSATDFSMgmtConInstall
{
Ensure = 'Present'
Name = 'RSAT-DFS-Mgmt-Con'
}
WindowsFeature DFS
{
Name = 'FS-DFS-Namespace'
Ensure = 'Present'
}
# Configure the namespace
DFSNamespaceRoot DFSNamespaceRoot_Domain_Departments
{
Path = '\\contoso.com\departments'
TargetPath = '\\fs_1\departments'
Ensure = 'Present'
Type = 'DomainV2'
Description = 'AD Domain based DFS namespace for storing departmental files'
TimeToLiveSec = 600
PsDscRunAsCredential = $Credential
} # End of DFSNamespaceRoot Resource
# Configure the namespace folders
DFSNamespaceFolder DFSNamespaceFolder_Domain_Finance
{
Path = '\\contoso.com\departments\finance'
TargetPath = '\\fs_3\Finance'
Ensure = 'Present'
Description = 'AD Domain based DFS namespace folder for storing finance files'
TimeToLiveSec = 600
PsDscRunAsCredential = $Credential
} # End of DFSNamespaceFolder Resource
DFSNamespaceFolder DFSNamespaceFolder_Domain_Management
{
Path = '\\contoso.com\departments\management'
TargetPath = '\\fs_8\Management'
Ensure = 'Present'
Description = 'AD Domain based DFS namespace folder for storing management files'
TimeToLiveSec = 600
PsDscRunAsCredential = $Credential
} # End of DFSNamespaceFolder Resource
}
}
Create a standalone DFS namespace using FQDN called public on the server fileserver1.contoso.com. A sub-folder called brochures is also created in this namespace that targets the \fileserver2.contoso.com\brochures share.
Configuration DFSNamespaceFolder_Standalone_FQDN_Config
{
param
(
[Parameter()]
[PSCredential]
$Credential
)
Import-DscResource -ModuleName 'DFSDsc'
Node localhost
{
<#
Install the Prerequisite features first
Requires Windows Server 2012 R2 Full install
#>
WindowsFeature RSATDFSMgmtConInstall
{
Ensure = 'Present'
Name = 'RSAT-DFS-Mgmt-Con'
}
WindowsFeature DFS
{
Name = 'FS-DFS-Namespace'
Ensure = 'Present'
}
# Configure the namespace server
DFSNamespaceServerConfiguration DFSNamespaceConfig
{
IsSingleInstance = 'Yes'
UseFQDN = $true
PsDscRunAsCredential = $Credential
} # End of DFSNamespaceServerConfiguration Resource
# Configure the namespace
DFSNamespaceRoot DFSNamespaceRoot_Standalone_Public
{
Path = '\\fileserver1.contoso.com\public'
TargetPath = '\\fileserver1.contoso.com\public'
Ensure = 'Present'
Type = 'Standalone'
Description = 'Standalone DFS namespace for storing public files'
PsDscRunAsCredential = $Credential
} # End of DFSNamespaceRoot Resource
# Configure the namespace folder
DFSNamespaceFolder DFSNamespaceFolder_Standalone_PublicBrochures
{
Path = '\\fileserver1.contoso.com\public\brochures'
TargetPath = '\\fileserver2.contoso.com\brochures'
Ensure = 'Present'
Description = 'Standalone DFS namespace for storing public brochure files'
PsDscRunAsCredential = $Credential
} # End of DFSNamespaceFolder Resource
}
}
Create a standalone DFS namespace called public on the server fileserver1. A namespace folder called brochures is also created in this namespace that targets the \fileserver2\brochures share.
Configuration DFSNamespaceFolder_Standalone_Config
{
param
(
[Parameter()]
[PSCredential]
$Credential
)
Import-DscResource -ModuleName 'DFSDsc'
Node localhost
{
<#
Install the Prerequisite features first
Requires Windows Server 2012 R2 Full install
#>
WindowsFeature RSATDFSMgmtConInstall
{
Ensure = 'Present'
Name = 'RSAT-DFS-Mgmt-Con'
}
WindowsFeature DFS
{
Name = 'FS-DFS-Namespace'
Ensure = 'Present'
}
# Configure the namespace
DFSNamespaceRoot DFSNamespaceRoot_Standalone_Public
{
Path = '\\fileserver1\public'
TargetPath = '\\fileserver1\public'
Ensure = 'Present'
Type = 'Standalone'
Description = 'Standalone DFS namespace for storing public files'
PsDscRunAsCredential = $Credential
} # End of DFSNamespaceRoot Resource
# Configure the namespace folder
DFSNamespaceFolder DFSNamespaceFolder_Standalone_PublicBrochures
{
Path = '\\fileserver1\public\brochures'
TargetPath = '\\fileserver2\brochures'
Ensure = 'Present'
Description = 'Standalone DFS namespace for storing public brochure files'
PsDscRunAsCredential = $Credential
} # End of DFSNamespaceFolder Resource
}
}