# # ---------------------------- # XSD SCHEMA DEFINATION # ---------------------------- # # # ----------------------------- # SCHEMATRON RULES DEFINITION # ----------------------------- # Import-LocalizedData -BindingVariable _system_translations -filename DFSR.psd1 # # DFSR global settings # # # BPA will use the below variable when determining if the volume is almost full # so when free space is less than or equal to the below percentage of full disk # space then BPA will consider that volume to be almost full # $Global:diskSpaceFullThresholdPercentage = 10 # # BPA will use below number to determine if there are high number of conflicts # If a replicated folder has conflicts more than or equal to below number then # BPA will declare that folder to have high number of conflicts # $Global:numberOfConflictsPerReplicatedFolder = 100 # # BPA will check DFSR event logs for staging cleanup started events for each replicated # folder that has occurred in last few hours (as defined below) # $Global:checkStagingCleanupInHours = 24 # # Function Description: # # This function will add the Server Manager module so that Roles # can be queried # # Arguments: # # None # # Return Value: # # None # function Setup { Import-Module ServerManager } # # Function Description: # # This function will remove the Server Manager module after the Roles # have been queried # # Arguments: # # None # # Return Value: # # None # function TearDown { Remove-Module ServerManager } # # Function Description: # # check the status of specifed service # have been queried # # Arguments: # # $serviceName - service name # # Return Value: # # $true - if the service is running # $false - otherwise # function Check-ServiceStatus($serviceName) { $service = get-service -name $serviceName if($service -ne $null -and ($service.Status -eq [System.ServiceProcess.ServiceControllerStatus]"Running")) { $true } else { $false } } # # Function Description: # Creates the Document element for the Xml Document # # Arguments: # $ns - Namespace Name # $name - Name of the document element # # Return Value: # returns the created document element # function Create-DocumentElement ($ns, $name) { [xml] "<$name xmlns='$ns'>" } # # Function Description: # # This function will check to see if the specified service is installed # # Arguments: # # $serviceName - Name of the service # # Return Value: # # $true - If service is Installed # $false - If service is not Installed # function Check-ServiceInstallStatus ($serviceName) { $serviceInstalled = $false $service = get-service -name $serviceName if ($service -ne $null) { $serviceInstalled = $true } $serviceInstalled } # # Function Description: # # This function defines the data type and classes for DFSR objects # # Arguments: # # None # # Return Value: # # None # function Call-GetDfsrInformation() { $code = @' using System; using System.Collections.Generic; namespace Dfsr.Bpa { // // Class that defines a connection between two members for a replication group // public class DfsrConnection { public Guid rgId; public Guid memberId; public string memberName; public Guid partnerId; public string partnerName; public Guid connId; public bool enabled; public bool inbound; } // // Class that defines a replication group // public class DfsrReplicationGroup { public Guid rgId; public string rgName; public UInt32 rgType; public string memberName; public Dictionary> partners; } // // Class that defines a replicated folder // public class DfsrReplicatedFolder { public Guid rfId; public string rfName; public string rfConflictPath; public UInt32 rfConflictSize; public Guid rgId; public string rgName; public Guid memberId; public string memberName; public bool isReadOnly; public bool isEnabled; public UInt32 currentConflictSize; public Guid volId; public UInt32 numberOfConflicts; public bool hasStagingCleanupHappened; } // // Class that defines a replicated volume // public class DfsrVolume { public Guid volId; public string volPath; public bool hasEnoughSpace; } // // Class that defines a DFSR information object. This class will hold all the above information // public class DfsrMachineInfo { public UInt32 conflictHighWaterMark; public bool hasReadOnlyFolder; public bool readOnlyFilterDriverLoaded; public List dfsrReplicationGroupList; public List dfsrReplictaedFolderList; public List dfsrVolumeList; } } '@ Compile-CSharp($code) } # # Function Description: # # Get the "TYPE" for the passed object type strings # # Arguments: # # type - Supplies the object type # typeParameters - Supplies the object type parameters # # Return Value: # # Unique powershell type ID for generic collection type objects # function global:Get-Type ( $type = $(throw "Please specify a type") ) { trap [System.Management.Automation.RuntimeException] { throw ($_.Exception.Message) } if($args -and $args.Count -gt 0) { $types = $args[0] -as [type[]] if(-not $types) { $types = [type[]] $args } if($genericType = [type] ($type + '`' + $types.Count)) { $genericType.MakeGenericType($types) } } else { [type] $type } } # # Function Description: # # Initializes a Generic type object # # Arguments: # # type - Supplies the object type # typeParameters - (Optional) Supplies the object type parameters # constructorParameters - (Optional) Supplies the object type constructor parameters # # Return Value: # # Initialized object of specified type # function New-GenericObject( $type = $(throw "Please specify a type"), [object[]] $typeParameters = $null, [object[]] $constructorParameters = @() ) { $closedType = (Get-Type $type $typeParameters) ,[Activator]::CreateInstance($closedType, $constructorParameters) } # # Function Description: # # Get DFSR data from the service WMI # # Arguments: # # None # # Return Value: # # $null - Returned in case of any error # Dfsr.Bpa.DfsrMachineInfo - Return DfsrMachineInfo object with extracted data # function Get-DfsrData () { # # Create DfsrMachineInfo object that will hold all the information # $machineInfo = New-Object Dfsr.Bpa.DfsrMachineInfo # # Initialize List objects # $machineInfo.dfsrReplicationGroupList = New-GenericObject System.Collections.Generic.List Dfsr.Bpa.DfsrReplicationGroup $machineInfo.dfsrReplictaedFolderList = New-GenericObject System.Collections.Generic.List Dfsr.Bpa.DfsrReplicatedFolder $machineInfo.dfsrVolumeList = New-GenericObject System.Collections.Generic.List Dfsr.Bpa.DfsrVolume # # Query DfsrMachineConfig via WMI # $dfsrMachineConfigList = get-wmiobject -Namespace "root\MicrosoftDfs" -Class DfsrMachineConfig | select-object -Property ConflictHighWaterMarkPercent foreach ($dfsrMachineConfig in $dfsrMachineConfigList) { if ($dfsrMachineConfig -eq $null) { break } $machineInfo.conflictHighWaterMark = $dfsrMachineConfig.ConflictHighWaterMarkPercent $machineInfo.hasReadOnlyFolder = $false $machineInfo.readOnlyFilterDriverLoaded = $false # # If there are more than one instances reported then only use the first one # break } # # Query DfsrVolumeConfig via WMI # $dfsrVolumeInfoList = get-wmiobject -Namespace "root\MicrosoftDfs" -Class DfsrVolumeConfig | select-object -Property VolumeGuid, VolumePath # # If any volumes reported then query volume information of the machine # if ($dfsrVolumeInfoList -ne $null) { # # Query system information and use the list obtained here against each volume information # $mountPointList = get-wmiobject -Namespace "root\cimv2" -Class Win32_MountPoint | select-object -Property Directory, Volume $systemVolumeList = get-wmiobject -Namespace "root\cimv2" -Class Win32_Volume -Filter "FileSystem = 'NTFS'" | select-object -Property __RELPATH, FreeSpace, Capacity } foreach($dfsrVolumeInfo in $dfsrVolumeInfoList) { if ($dfsrVolumeInfo -eq $null) { break } $volumeInfo = New-Object Dfsr.Bpa.DfsrVolume $volumeInfo.volId = $dfsrVolumeInfo.VolumeGuid $volumeInfo.volPath = $dfsrVolumeInfo.VolumePath $volumeInfo.volPath = $volumeInfo.volPath -replace "\\\\.\\" $volumeInfo.hasEnoughSpace = $true # # Extract volume information from the list of Win32_MountPoint and Win32_Volume Fetched earlier # $volName = $volumeInfo.volPath if ($volName[$volName.Length-1] -eq ':') { # # Add \\ to the string as the Directory attribute requires it, but for # mount point we will not concatinate anything # $volName = $volName + "\\" } # # Construct directory string # $directoryValue ='Win32_Directory.Name="' + $volName + '"' foreach($mountPoint in $mountPointList) { # # Find the matching mount point object # if ($mountPoint -and $directoryValue -eq $mountPoint.Directory) { # # Get the volume property # $volName = $mountPoint.Volume # # Work on first matched object # break } } foreach($systemVolume in $systemVolumeList) { # # Now find the volume object corresponding to above volume # if ($systemVolume -and $volName -eq $systemVolume.__RELPATH) { # # Check Free space # if ($systemVolume.FreeSpace -le ($diskSpaceFullThresholdPercentage * $systemVolume.Capacity / 100)) { $volumeInfo.hasEnoughSpace = $false } # # Work on first matched object # break } } # # Add volume config to the machine volume list # $machineInfo.dfsrVolumeList.Add($volumeInfo) } # # Query DfsrReplicationGroupConfig via WMI # $dfsrReplicationGroupList = get-wmiobject -Namespace "root\MicrosoftDfs" -Class DfsrReplicationGroupConfig | select-object -Property ReplicationGroupGuid, ReplicationGroupName, ReplicationGroupType, ContainerComputerName # # If any replication groups found then query all connections for all groups # if ($dfsrReplicationGroupList -ne $null) { $dfsrAllConnectionList = get-wmiobject -Namespace "root\MicrosoftDfs" -Class DfsrConnectionConfig | select-object -Property MemberGuid, PartnerGuid, PartnerName, ConnectionGuid, Enabled, Inbound, ReplicationGroupGuid } # # Process each replication group information # foreach($dfsrReplicationGroupConfig in $dfsrReplicationGroupList) { if ($dfsrReplicationGroupConfig -eq $null) { break } $replicationGroupConfig = New-Object Dfsr.Bpa.DfsrReplicationGroup # # Initialize partner list # $listType = (Get-Type System.Collections.Generic.List Dfsr.Bpa.DfsrConnection) $replicationGroupConfig.partners = New-GenericObject System.Collections.Generic.Dictionary Guid, $listType $replicationGroupConfig.rgId = $dfsrReplicationGroupConfig.ReplicationGroupGuid $replicationGroupConfig.rgName = $dfsrReplicationGroupConfig.ReplicationGroupName $replicationGroupConfig.rgType = $dfsrReplicationGroupConfig.ReplicationGroupType $replicationGroupConfig.memberName = $dfsrReplicationGroupConfig.ContainerComputerName # # Only extract partner and connection information for non-SYSVOL type of RG # SYSVOL RG TYPE is 1 # if ($replicationGroupConfig.rgType -ne 1) { # # Extract replication group's connection information from the connection list # if ($dfsrAllConnectionList -ne $null) { $dfsrConnectionList = $dfsrAllConnectionList | where {$_.ReplicationGroupGuid -eq $replicationGroupConfig.rgId} } # # For each connection belonging to the replication group, determine and add each partner seperately # foreach($dfsrConnectionConfig in $dfsrConnectionList) { if ($dfsrConnectionConfig -eq $null) { break } $connectionConfig = New-Object Dfsr.Bpa.DfsrConnection $connectionConfig.rgId = $dfsrReplicationGroupConfig.ReplicationGroupGuid $connectionConfig.memberId = $dfsrConnectionConfig.MemberGuid $connectionConfig.memberName = $dfsrReplicationGroupConfig.ContainerComputerName $connectionConfig.partnerId = $dfsrConnectionConfig.PartnerGuid $connectionConfig.partnerName = $dfsrConnectionConfig.PartnerName $connectionConfig.connId = $dfsrConnectionConfig.ConnectionGuid $connectionConfig.enabled = $dfsrConnectionConfig.Enabled $connectionConfig.inbound = $dfsrConnectionConfig.Inbound # # If RG already have the partner in its partner list (Dictionary) then add this new connection to that partner's connection list # if ($replicationGroupConfig.partners.ContainsKey($connectionConfig.partnerId)) { $rgPartnerConnectionList = $replicationGroupConfig.partners[$connectionConfig.partnerId] $rgPartnerConnectionList.Add($connectionConfig) $replicationGroupConfig.partners[$connectionConfig.partnerId] = $rgPartnerConnectionList } else { # # Else create a new entry for this new partner in the Dictionary # $rgPartnerConnectionList = New-GenericObject System.Collections.Generic.List Dfsr.Bpa.DfsrConnection $rgPartnerConnectionList.Add($connectionConfig) $replicationGroupConfig.partners.Add($connectionConfig.partnerId, $rgPartnerConnectionList) } } } # # Add replication group information to the machine configuration # $machineInfo.dfsrReplicationGroupList.Add($replicationGroupConfig) } # # Query DfsrReplicatedFolderConfig via WMI # $dfsrReplicatedFolderList = get-wmiobject -Namespace "root\MicrosoftDfs" -Class DfsrReplicatedFolderConfig | select-object -Property ReplicatedFolderGuid, ReplicatedFolderName, ConflictPath, ConflictSizeInMb, ReplicationGroupGuid, MemberGuid, ContainerComputerName, ReadOnly, Enabled, VolumeGuid foreach($dfsrReplicatedFolderConfig in $dfsrReplicatedFolderList) { if ($dfsrReplicatedFolderConfig -eq $null) { break } $replicatedFolderInfo = New-Object Dfsr.Bpa.DfsrReplicatedFolder $replicatedFolderInfo.rfId = $dfsrReplicatedFolderConfig.ReplicatedFolderGuid $replicatedFolderInfo.rfName = $dfsrReplicatedFolderConfig.ReplicatedFolderName $replicatedFolderInfo.rfConflictPath = $dfsrReplicatedFolderConfig.ConflictPath $replicatedFolderInfo.rfConflictSize = $dfsrReplicatedFolderConfig.ConflictSizeInMb $replicatedFolderInfo.rgId = $dfsrReplicatedFolderConfig.ReplicationGroupGuid $replicatedFolderInfo.memberId = $dfsrReplicatedFolderConfig.MemberGuid $replicatedFolderInfo.memberName = $dfsrReplicatedFolderConfig.ContainerComputerName $replicatedFolderInfo.isReadOnly = $dfsrReplicatedFolderConfig.ReadOnly $replicatedFolderInfo.isEnabled = $dfsrReplicatedFolderConfig.Enabled $replicatedFolderInfo.volId = $dfsrReplicatedFolderConfig.VolumeGuid $replicatedFolderInfo.numberOfConflicts = 0 $replicatedFolderInfo.currentConflictSize = 0 $replicatedFolderInfo.hasStagingCleanupHappened = $false # # Query total size used by conflict folder # $conflictDirInfo = (Get-ChildItem $replicatedFolderInfo.rfConflictPath -force -recurse | Measure-Object -property length -sum) if ($conflictDirInfo -ne $null) { $replicatedFolderInfo.numberOfConflicts = $conflictDirInfo.Count $replicatedFolderInfo.currentConflictSize = "{0:N0}" -f ($conflictDirInfo.sum / 1MB) } # # Try to get correct replication group name for the replicated folder from the previous replication group list # $rgFromList = $machineInfo.dfsrReplicationGroupList | where {$_.rgId -eq $replicatedFolderInfo.rgId} if ($rgFromList -eq $null) { $replicatedFolderInfo.rgName = "UNAVAILABLE" } else { $replicatedFolderInfo.rgName = $rgFromList.rgName } # # Check event log entry in last few hours for staging cleanup # $eventStartDate = Date $eventStartDate = $eventStartDate.AddHours(-1 * $checkStagingCleanupInHours) $events = get-eventlog -logname "DFS Replication" -After $eventStartDate -EntryType "Warning" -ErrorAction:SilentlyContinue | where {$_.EventID -eq 4202 -and $_.ReplacementStrings[0] -eq $replicatedFolderInfo.rfId} # # If replicated folder encountered 2 or more staging cleanups then report issue # if ($events -ne $null -and $events.Count -gt 1) { $replicatedFolderInfo.hasStagingCleanupHappened = $true } # # If this is a read-only folder then set a machine config flag to indicate that this machine does # contain read-only folder # if ($dfsrReplicatedFolderConfig.ReadOnly -eq $true) { $machineInfo.hasReadOnlyFolder = $true } # # Add replicated folders to the machine configuration # $machineInfo.dfsrReplictaedFolderList.Add($replicatedFolderInfo) } # # If the current machine has any read-only replicated folder then check if the DFSR read-only # driver is loaded # if ($machineInfo.hasReadOnlyFolder -eq $true) { # # Search for "DfsrRo" in the output string when listing loaded drivers # $tempCheck = fltmc | select-string -Pattern "^DfsrRo\s" -Quiet # # If found then set the flag to true, stating that the driver is loaded # if ($tempCheck -eq $true) { $machineInfo.readOnlyFilterDriverLoaded = $true } } # # Return Machine configuration # $machineInfo } # # Function Description: # Create XmlElement and append it into the specified parent # # Arguments: # $doc - XmlDocument manipulated # $parent - parent node # $ns - namespace used for the element # $elementName - element name # $elementValue - element value # # Return Value: # none # function Append-XmlElement($doc, $parent, $ns, $elementName, $elementValue) { $element = $doc.CreateElement($elementName, $ns) $element.set_InnerText($elementValue) [void]$parent.AppendChild($element) } # # Function Description: # formalize the text of the boolean value # # Arguments: # $value - boolean value # # Return Value: # "true" - if $value -eq $true # "false" - if $value -eq $false # function Formalize-BoolValue($value) { if($value) { "true" } else { "false" } } # # Function Description: # formalize the text of the boolean value # # Arguments: # $code - C# code # $Reference - reference assembley # # Return Value: # none # function Compile-Csharp ([string] $code, [Array]$References) { # Get an instance of the CSharp code provider $cp = New-Object Microsoft.CSharp.CSharpCodeProvider $refs = New-Object Collections.ArrayList $refs.AddRange( @("System.dll", "System.Windows.Forms.dll", "System.Data.dll", "System.XML.dll")) if ($References -and ($References.Count -ge 1)) { $refs.AddRange($References) } # Build up a compiler params object... $cpar = New-Object System.CodeDom.Compiler.CompilerParameters $cpar.GenerateInMemory = $true $cpar.GenerateExecutable = $false $cpar.IncludeDebugInformation = $false $cpar.CompilerOptions = "/target:library" $cpar.ReferencedAssemblies.AddRange($refs) $cr = $cp.CompileAssemblyFromSource($cpar, $code) if ($cr.Errors.Count) { $codeLines = $code.Split("`n"); foreach ($ce in $cr.Errors) { write-host "Error: $($codeLines[$($ce.Line - 1)])" $ce | out-default } Throw "INVALID DATA: Errors encountered while compiling code" } } # # ------------------ # FUNCTIONS - START # ------------------ # function Call-DfsrEnum() { Call-GetDfsrInformation } # # Function Description: # Create DFSR Xml with all the required data # # Arguments: # $xmlDoc - XmlDocument manipulated # $ns - namespace used for the element # # Return Value: # None # function Get-DfsrXml($xmlDoc, $ns) { # # Initialize DFSR specific information and classes # Call-DfsrEnum # # Get current computer name # $computerName = [System.Net.Dns]::GetHostName() # # Create "DFSR" XML tag # $dfsrNode = $xmlDoc.CreateElement("DFSR", $ns) [void]$xmlDoc.DocumentElement.AppendChild($dfsrNode) Append-XmlElement $xmlDoc $dfsrNode $ns "ServerName" $computerName # # Check DFSR service status # $checkDfsrServiceStatus = Check-ServiceStatus "dfsr" Append-XmlElement $xmlDoc $dfsrNode $ns "IsServiceStarted" (Formalize-BoolValue $checkDfsrServiceStatus) # # Get DFSR service startup type from registry # $path = "HKLM:\SYSTEM\CurrentControlSet\Services\Dfsr" $DfsrStartType = get-itemproperty -path $path -name 'Start' if ($DfsrStartType.Start -eq 2) { $IsServiceStartTypeAuto = $true } else { $IsServiceStartTypeAuto = $false } Append-XmlElement $xmlDoc $dfsrNode $ns "IsServiceStartTypeAuto" (Formalize-BoolValue $IsServiceStartTypeAuto) # # Continue only if DFSR service is running # if ($checkDfsrServiceStatus -eq $true) { # # Collect DFSR machine configuration # $machineInfo = Get-DfsrData # # Only continue if data is returned # if ($machineInfo -ne $null) { # # Only add the driverloaded information if there was any read-only replicated folder found # if ($machineInfo.hasReadOnlyFolder -eq $true) { Append-XmlElement $xmlDoc $dfsrNode $ns "IsReadOnlyDriverLoaded" (Formalize-BoolValue $machineInfo.readOnlyFilterDriverLoaded) } # # Add DFSR replicated folder data in the XML # Foreach ($dfsrReplicatedFolder in $machineInfo.dfsrReplictaedFolderList) { if ($dfsrReplicatedFolder -eq $null) { break } $hasEnoughConflictSpace = $true $hasMoreConflictedFiles = $false # # Add "ReplicatedFolder" tag in XML # $dfsrReplicatedFolderNode = $xmlDoc.CreateElement("ReplicatedFolder", $ns) [void]$dfsrNode.AppendChild($dfsrReplicatedFolderNode) Append-XmlElement $xmlDoc $dfsrReplicatedFolderNode $ns "RfName" ($dfsrReplicatedFolder.rfName) Append-XmlElement $xmlDoc $dfsrReplicatedFolderNode $ns "MemberName" ($dfsrReplicatedFolder.memberName) Append-XmlElement $xmlDoc $dfsrReplicatedFolderNode $ns "IsEnabled" (Formalize-BoolValue $dfsrReplicatedFolder.isEnabled) Append-XmlElement $xmlDoc $dfsrReplicatedFolderNode $ns "RfRgName" ($dfsrReplicatedFolder.rgName) # # Check if current conflict size has reached high water mark or not # if ($dfsrReplicatedFolder.currentConflictSize -ge ($dfsrReplicatedFolder.rfConflictSize * $machineInfo.conflictHighWaterMark / 100)) { $hasEnoughConflictSpace = $false } # # Check if number of conflicts for the replicated folder has exceeded desired value # if ($dfsrReplicatedFolder.numberOfConflicts -ge $numberOfConflictsPerReplicatedFolder) { $hasMoreConflictedFiles = $true } Append-XmlElement $xmlDoc $dfsrReplicatedFolderNode $ns "HasEnoughConflictSpace" (Formalize-BoolValue $hasEnoughConflictSpace) Append-XmlElement $xmlDoc $dfsrReplicatedFolderNode $ns "HasMoreConflictedFiles" (Formalize-BoolValue $hasMoreConflictedFiles) Append-XmlElement $xmlDoc $dfsrReplicatedFolderNode $ns "HasStagingCleanupHappened" (Formalize-BoolValue $dfsrReplicatedFolder.hasStagingCleanupHappened) } # # Add DFSR replicated volume data in the XML # Foreach ($dfsrVolume in $machineInfo.dfsrVolumeList) { if ($dfsrVolume -eq $null) { break } # # Add "ReplicatedVolume" tag in XML # $dfsrVolumeNode = $xmlDoc.CreateElement("ReplicatedVolume", $ns) [void]$dfsrNode.AppendChild($dfsrVolumeNode) Append-XmlElement $xmlDoc $dfsrVolumeNode $ns "VolName" ($dfsrVolume.volPath) Append-XmlElement $xmlDoc $dfsrVolumeNode $ns "HasEnoughSpaceLeft" (Formalize-BoolValue $dfsrVolume.hasEnoughSpace) } # # Add DFSR replication group data in the XML # Foreach ($dfsrReplicationGroup in $machineInfo.dfsrReplicationGroupList) { if ($dfsrReplicationGroup -eq $null) { break } # # Add "ReplicationGroup" tag in XML # $dfsrReplicationGroupNode = $xmlDoc.CreateElement("ReplicationGroup", $ns) [void]$dfsrNode.AppendChild($dfsrReplicationGroupNode) Append-XmlElement $xmlDoc $dfsrReplicationGroupNode $ns "RgName" ($dfsrReplicationGroup.rgName) Append-XmlElement $xmlDoc $dfsrReplicationGroupNode $ns "MemberName" ($dfsrReplicationGroup.memberName) # # Add DFSR partner data in the XML # ForEach ($partnerConnList in $dfsrReplicationGroup.partners.Values) { # # If replication group contain partner list # if ($partnerConnList -ne $null -and $partnerConnList.Count -gt 0) { # # Add "Partner" tag in XML # $dfsrReplicationGroupPartnerNode = $xmlDoc.CreateElement("Partner", $ns) [void]$dfsrReplicationGroupNode.AppendChild($dfsrReplicationGroupPartnerNode) Append-XmlElement $xmlDoc $dfsrReplicationGroupPartnerNode $ns "PartnerName" ($partnerConnList[0].partnerName) $hasTwoWayConnection = $false # # Check if each partner has 2 enabled connections with this machine or not # if ($partnerConnList.Count -eq 2) { if ($partnerConnList[0].enabled -eq $true -and $partnerConnList[1].enabled -eq $true) { $hasTwoWayConnection = $true } } Append-XmlElement $xmlDoc $dfsrReplicationGroupPartnerNode $ns "HasTwoWayConnection" (Formalize-BoolValue $hasTwoWayConnection) } } } } } } # # ------------------ # FUNCTIONS - END # ------------------ # # # ------------------------ # SCRIPT MAIN BODY - START # ------------------------ # # # Initialize to perform querying Role information # Setup # # Set the Target Namespace to be used by XML # $tns="http://schemas.microsoft.com/bestpractices/models/FileServices/DFSR/2011/04" # # Create a new XmlDocument # $doc = Create-DocumentElement $tns "DFSRComposite" # # Check DFSR service installed or not # $dfsrInstalled = Check-ServiceInstallStatus "dfsr" # # Only continue if DFSR service is installed # if ($dfsrInstalled -eq $true) { # # Populate the XML data related to DFSR # Get-DfsrXml $doc $tns } # # Role Information obtained. # TearDown # # Return the XML document # $doc # # Save XML document temporarily to file services directory # $doc.Save([Environment]::SystemDirectory + "\BestPractices\v1.0\Models\Microsoft\Windows\FileServices\tempDFSR.xml")