# # ---------------------------- # XSD SCHEMA DEFINATION # ---------------------------- # # # ----------------------------- # SCHEMATRON RULES DEFINITION # ----------------------------- # # # ----------------------------- # TRANSLATIONS DEFINITION # ----------------------------- # data _system_translations { ConvertFrom-StringData @' # check File Services service status FileServicesInstalled_Title=The File Services role service is not installed FileServicesInstalled_Problem=The File Services role service is not installed. FileServicesInstalled_Impact=Services provided by File Services and associated role services will not be available. FileServicesInstalled_Resolution=To use File Services and associated role services, use the Add Roles and Features Wizard to add the role services that you want to run on this server. FileServicesInstalled_Compliant=The File and Storage Services Best Practices Analyzer scan has determined that you are in compliance with this best practice. '@ } Import-LocalizedData -BindingVariable _system_translations -filename FileServices.psd1 $windir = $env:Windir . $windir\System32\BestPractices\v1.0\Models\Microsoft\Windows\FileServices\fscommon.ps1 # # ------------------ # FUNCTIONS - START # ------------------ # # # Function Description: # # This function will update the XML document with FileServices data # # Arguments: # # $xmlDoc - XmlDocument manipulated # $ns - namespace used for the element # # Return Value: # # none # function GetFSXml($xmlDoc, $ns) { trap { write-error $error[0] continue } #Create FileServices node $fsNode = $xmlDoc.CreateElement("FS", $ns) [void]$xmlDoc.DocumentElement.AppendChild($fsNode) $computerName = [System.Net.Dns]::GetHostName() #Check File Services Install status $IsFileServicesInstalled = Check-FeatureInstallStatus "File-Services" Append-XmlElement $xmlDoc $fsNode $ns "IsFileServicesInstalled" (Formalize-BoolValue $IsFileServicesInstalled) } # # ------------------ # FUNCTIONS - END # ------------------ # # # ------------------------ # SCRIPT MAIN BODY - START # ------------------------ # # # Initialize to perform querying Role information # Import-Module ServerManager # # Set the Target Namespace to be used by XML # $tns="http://schemas.microsoft.com/bestpractices/models/FileServices/2011/04" # # Create a new XmlDocument # $doc = Create-DocumentElement $tns "FSComposite" GetFSXml $doc $tns # # Role Information obtained. # Remove-Module ServerManager $doc # can be used for testing purpose $doc.Save([Environment]::SystemDirectory + "\BestPractices\v1.0\Models\Microsoft\Windows\FileServices\tempFS.xml") # Run submodels if ((Check-FeatureInstallStatus "File-Services") -eq $true) { Invoke-BPAModel -ModelId Microsoft/Windows/FileServices -SubModelId SMB if ((Check-FeatureInstallStatus "FS-NFS-Service") -eq $true) { Invoke-BPAModel -ModelId Microsoft/Windows/FileServices -SubModelId NFS } if ((Check-FeatureInstallStatus "FS-Resource-Manager") -eq $true) { Invoke-BPAModel -ModelId Microsoft/Windows/FileServices -SubModelId FSRM } if ((Check-FeatureInstallStatus "FS-DFS-Namespace") -eq $true) { Invoke-BPAModel -ModelId Microsoft/Windows/FileServices -SubModelId DFSN } if ((Check-FeatureInstallStatus "FS-DFS-Replication") -eq $true) { Invoke-BPAModel -ModelId Microsoft/Windows/FileServices -SubModelId DFSR } if ((Check-FeatureInstallStatus "FS-iSCSITarget-Server") -eq $true) { Invoke-BPAModel -ModelId Microsoft/Windows/FileServices -SubModelId ISCSITarget } if ((Check-FeatureInstallStatus "FS-Data-Deduplication") -eq $true) { Invoke-BPAModel -ModelId Microsoft/Windows/FileServices -SubModelId Dedup } if ((Check-FeatureInstallStatus "FS-SyncShareService") -eq $true) { Invoke-BPAModel -ModelId Microsoft/Windows/FileServices -SubModelId WorkFolders } }