# Copyright (c) Microsoft Corporation. All rights reserved. # # THIS CODE IS MADE AVAILABLE AS IS, WITHOUT WARRANTY OF ANY KIND. THE ENTIRE RISK # OF THE USE OR THE RESULTS FROM THE USE OF THIS CODE REMAINS WITH THE USER. # # Synopsis: This script imports Edge config that has been previously exported using # the export-edgeConfig script. # # Usage: # # Validate Phase: .\importedgeconfig # -cloneConfigData "C:\cloneConfigData.xml" # -cloneConfigAnswer "C:\cloneConfigAnswer.xml" # -isImport $false # # Import Phase: .\importedgeconfig # -cloneConfigData "C:\cloneConfigData.xml" # -cloneConfigAnswer "C:\cloneConfigAnswer.xml" # -isImport $true # -Key:"A9ABA4D2C21C4bc58B303EA47BBE3608" (32 byte string used for # password encryption/decryption) # param($cloneConfigData, $cloneConfigAnswer, $isImport = $false, $key = "A9ABA4D2C21C4bc58B303EA47BBE3608") $cloneTemplateDoc = new-object System.Xml.XmlDocument $cloneDataDoc = new-object System.Xml.XmlDocument $cloneAnswerDoc = new-object System.Xml.XmlDocument ############################################################################# # Logs the information to the cloneLogFile.log # isHost : If true Write the message to the host, inaddition to the log file. # message : The message string to be logged. ############################################################################# function Write-Information([Boolean] $isHost, [String] $message) { $logger.WriteLine(); $logger.WriteLine($message) # Write the error message to the host also. if($isHost -eq $true) { write-host $message } } ########################################################################### # The function adds some useful information into the log file # before the actual Export process starts. ########################################################################### function Write-LogStartInformation() { $startTime = ([System.DateTime]::Now).ToString() Write-Information $false "************ BEGIN IMPORT PROCESS **************" Write-Information $false $startTime } ############################################################# # Releases the file handles used by the Export Script. ############################################################# function Export-ReleaseHandles() { # Restore Error Action Preference $ErrorActionPreference = $errorActionSave write-debug "Export-ReleaseHandles" if($logger -ne $null) { Write-Information $false "************ END IMPORT PROCESS **************" $logger.flush() $logger.close() } } ###################################################### # Retrieves the Root setup registry entry. # returns: return entry value of found else null ###################################################### function GetEdgeInstallPath() { write-debug "GetEdgeInstallPath" # Get the root setup entires. $setupRegistryPath = "HKLM:\SOFTWARE\Microsoft\Exchange\Setup" $setupEntries = get-itemproperty $setupRegistryPath if($setupEntries -eq $null) { return $null } # Try to get the Install Path. $installPath = $setupEntries.MsiInstallPath return $installPath } ###################################################### # Retrieves the Setup Regsitry value of the given entry. # setupProperty: Setup Setting to the retrieved # returns: return entry value of found else null ###################################################### function GetEdgeScriptsPath([String] $scriptFileName) { write-debug "GetEdgeScriptsPath" # Append the script path with file name. $scriptFilePath = $script:installPath + "Scripts\" + $scriptFileName return $scriptFilePath } ################################################################################## # Creates a MultiValued string compatible with the Monad Multi value parameters. # componentAnswerNodeItem: Multivalued node with child items. # returns multivalued sting. ex: '0.0.0.0:25', '0.0.0.0:216' ################################################################################## function createMultivaluedMonadString([System.Xml.XmlNode]$componentAnswerNodeItem) { write-debug ("CreateMultivaluedMonadString ") $multiValuedString = $null $individualMultivaluedNodes = $componentAnswerNodeItem.SelectNodes("Item") write-debug ("individualNodes = $individualMultivaluedNodes") if ($IndividualMultivaluedNodes) { # for each multivalued child node found. foreach($individualMultivaluedNode in $individualMultivaluedNodes) { write-debug ("nodeValue=$nodeValue") $nodeValue = $individualMultivaluedNode.Get_InnerXml().ToString().Trim() if($nodeValue -ne "") { if($multiValuedString -eq $null) { $multiValuedString = "'" + $nodeValue + "'" continue } $multiValuedString = $multiValuedString + ", '" + $nodeValue + "'" } } } return $multiValuedString } ####################################################################### # Validates the input parameters. # Returns True if validation succeeds else False. ####################################################################### function ValidateInput() { write-debug ("ValidateInput") $isValid = $true #check if the Configuration Data file exists. $fileExists = [System.IO.File]::Exists($cloneConfigData) if($fileExists -eq $false) { Write-Information $true "Cannot find Config Data file[$cloneConfigData]" $isValid = $false } # if phase is Import and Answer File is passed as parameter. # make sure the file exists. if(($isImport -eq $true) -and ($cloneConfigAnswer -ne $null)) { if([System.IO.File]::Exists($cloneConfigAnswer) -eq $false) { Write-Information $true "Cannot find Config Data file[$cloneConfigAnswer]" $isValid = $false } } if(($isImport -eq $false) -and ($cloneConfigAnswer -eq $null)) { Write-Information $true "Please specify an Answer File Path." $isValid = $false } return $isValid } ######################################################### # Validates the IP Address # address: Address to be validated ######################################################### function ValidateIPAddress([String] $address) { write-debug ("ValidateIPAddress " + $address) [System.Net.IPAddress] $IpAddress = [System.Net.IPAddress]::Parse($address) if($IpAddress -eq $null) { write-debug ("null IP Address") return $false } # IPv4 or IPv6 if(($IpAddress.AddressFamily -ne [System.Net.Sockets.AddressFamily]::InterNetwork) -and ($IpAddress.AddressFamily -ne [System.Net.Sockets.AddressFamily]::InterNetworkV6)) { write-debug ("not IPV4 or IPV6") return $false } #IPANY, IPv6ANY, Loopback or a configured address if(($IpAddress.Equals([System.Net.IPAddress]::Any) -eq $true) -or ($IpAddress.Equals([System.Net.IPAddress]::IPv6Any) -eq $true) -or ([System.Net.IPAddress]::IsLoopBack($IpAddress) -eq $true)) { return $true } else { $flag = $false $ipHostEntry = new-object System.Net.IPHostEntry $ipHostEntry = [System.Net.Dns]::GetHostEntry([String]::Empty) #Lookup the address in the hostlist for($i = 0; $i -le $ipHostEntry.AddressList.Count; $i++) { if($IpAddress.Equals($ipHostEntry.AddressList[$i]) -eq $true) { $flag = $true } } # bindingIP doesn't match any local IP Address if($flag -eq $false) { write-debug ("bindingIP doesn't match any local IP Address") return $false } } trap { return $false } return $true } ####################################################################### # Validate the Bindings Multivalued parameter. # Bindings: The string to be validated against a given Type. # Returns NULL if all the entires succeded. # Returns HashTable with validation entries for each item. ####################################################################### function ValidateBindings([String] $bindings) { write-debug ("ValidateBindings " + $bindings) $ValidBindingListHash = @{} $validBindingsFlag = $true # Example : '0.0.0.0:25', '214.0.0.0:25' # # No need to check for Empty BindingsList. $bindingsList = $bindings.Trim().Split(',') foreach ($bindingsElement in $bindingsList) { # Split the IP:Port and validate the IPAddress Part. $bindingsElement = $bindingsElement.Replace("'", "").Trim() $items = $bindingsElement.Trim().Split(':') if($items.Count -le 1) { $ValidBindingListHash[$bindingsElement] = $false $validBindingsFlag = $false continue } $a = ValidateIPAddress($items[0].ToString()) $ValidBindingListHash[$bindingsElement] = $a if ($a -eq $false) { $validBindingsFlag = $false } } if ($validBindingsFlag -eq $true) { return $null } return $ValidBindingListHash } ######################################################### # Validates the local Server FQDN # address: Local Server FQDN to be validated ######################################################### function ValidateFqdn([String] $fqdn) { write-debug ("ValidateFqdn " + $fqdn) $localServerName = [System.Net.Dns]::GetHostName() $localIPHostEntry = [System.Net.Dns]::GetHostEntry($localServerName) $localServerFQDN = $localIPHostEntry.HostName if ($fqdn -ine $localServerFQDN) { write-debug ("mismatched local Server FQDN") return $false } trap { return $false } return $true } ####################################################################### # Validate whether a given Value matches to a given Type. # Value: The string to be validated against a given Type. # Type: The Validation Type. # Returns True if validation succeeds else False. # Returns false if the Type is "None" ####################################################################### function ValidateItem([String] $value, [String] $type) { write-debug ("ValidateItem Value:$value Type:$type") #Validation blocks for each Type. #New blocks should be added for new Types. $validItem = $true if ($type -eq "DirectoryPath") { $validItem = [System.IO.Directory]::Exists($value.Trim()) write-debug "validItem=$validItem" if($validItem -eq $false) { $dirInfo = [System.IO.Directory]::CreateDirectory($value.Trim()) $validItem = ($dirInfo -ne $null) # remove any newly created directory [System.IO.Directory]::Delete($value.Trim()) trap { write-debug ("trap: set validItem false") $validItem = $false } } } elseif ($type -eq "NullableDirectoryPath") { if ($value -ne "") { $validItem = [System.IO.Directory]::Exists($value.Trim()) write-debug "validItem=$validItem" if($validItem -eq $false) { $dirInfo = [System.IO.Directory]::CreateDirectory($value.Trim()) $validItem = ($dirInfo -ne $null) # remove any newly created directory [System.IO.Directory]::Delete($value.Trim()) trap { write-debug ("trap: set validItem false") $validItem = $false } } } } elseif ($type -eq "FilePath") { $FileFolder = [System.IO.Path]::GetDirectoryName($value.Trim()) $validItem = ValidateItem $FileFolder "DirectoryPath" } elseif($type -eq "IPAddress") { $validItem = ValidateIPAddress($value.Trim()) } elseif($type -eq "Bindings") { # The return value is either NULL or # an Hash table with atleast one elements. # Multivalued property, we need to know the validation result # of individual elements. $validItem = ValidateBindings($value.Trim()) if ($validItem -eq $null) { write-debug ("valid bindings") $validItem = $true } else { write-debug ("invalid bindings") return $validItem } } elseif($type -eq "FQDN") { # The return value is either NULL or # an Hash table with atleast one elements. # Multivalued property, we need to know the validation result # of individual elements. $validItem = ValidateFqdn($value.Trim()) if ($validItem -eq $null) { write-debug ("valid local server FQDN") $validItem = $true } else { write-debug ("invalid local server FQDN") return $validItem } } else { # if you are here XML Template has validationType # set to something that we are not supporting. Write-Information $true "ValidationType [$type] is not supported." } write-debug ("return valid = $validItem") return $validItem } ############################################################################### # Retrieve all the components of give component type from the data file. # itterate through them to see if the machine specific information can be validated # on the Target machine. if validation returns false add a keyed entry into the # answer file. # component: component type to retrieve from Data file. # cloneDataDoc: XML Data file # returns: String representation of the XML answer components. ############################################################################### function ValidateAndAppendComponentConfig([System.Xml.XmlElement]$component, [System.Xml.XmlDocument]$cloneDataDoc) { write-debug "" write-debug ("ValidateAndAppendComponentConfig " + $component.ToString()) $componentPath = "/ExportedEdgeConfiguration/" + $component.ToString() $componentDataNodes = $cloneDataDoc.SelectNodes($componentPath) # If data nodes are present in the Data File $appendString = "" if($componentDataNodes) { #For each data node of this component Type foreach($componentDataNode in $componentDataNodes) { $individualComponentString = "" $componentItems = $component.Get_ChildNodes() $componentDataNodeItems = $componentDataNode.Get_ChildNodes() # if component has a key(meaning not unique, we have to add key to the # to the answer file node. if($component.GetAttribute("Key") -ne "None") { $individualComponentString = $individualComponentString + "<" + $component.ToString() + " " + $component.GetAttribute("Key") + "='" + $componentDataNode.Get_Item($component.GetAttribute("Key")).Get_InnerXml() + "'"+ ">" } # if the component doen't have a Key(always will be a single node, on both source # and target server else { $individualComponentString = $individualComponentString + "<" + $component.ToString() + ">" } write-debug ("IndividualComponentString $individualComponentString `n") write-debug "" # for each machine specific item in this Data Node $machineSpecificAnswerString = "" foreach($componentItem in $componentItems) { #Get the validation Type Key $validationType = $componentItem.GetAttribute("ValidationType") write-debug ("Validate " + $componentItem.Get_InnerText() + " element of type $validationType" ) #validate the machine specific item on the target server. $isValid = ValidateItem $componentDataNode.Get_Item($componentItem.Get_InnerText()).Get_InnerXml() $validationType #if the validation failed add entry in the answer file # for admin to enter it manually. if ($isValid -eq $false) { Write-Information $true ("Validation Failed for " + $componentItem.Get_InnerText() + " element of type " + $validationType) $machineSpecificAnswerString = $machineSpecificAnswerString + "" $machineSpecificAnswerString = $machineSpecificAnswerString + "<" + $componentItem.Get_InnerText() + ">" + $componentDataNode.Get_Item($componentItem.Get_InnerText()).Get_InnerXml() + "" } # if the validation succeeded Add an entry to the console. elseif ($isValid -eq $true) { Write-Information $true ("Validation succeeded for " + $componentItem.Get_InnerText() + " element of type $validationType" ) } else { # if we are here we got a hash table with validation status of each item # of a multivalued property. Write-Information $true ("Validation Failed for " + $componentItem.Get_InnerText() + " Multivalued element of type $validationType : Answer file entry created" ) $machineSpecificAnswerString = $machineSpecificAnswerString + "<" + $componentItem.Get_InnerText() + ">" foreach($hashKey in $isValid.Get_Keys()) { if ($isValid[$hashKey] -eq $false) { $machineSpecificAnswerString = $machineSpecificAnswerString + "" } else { $machineSpecificAnswerString = $machineSpecificAnswerString + "" } $machineSpecificAnswerString = $machineSpecificAnswerString + "" + $hashKey + "" } $machineSpecificAnswerString = $machineSpecificAnswerString + "" } } write-debug ("machineSpecificAnswerString $machineSpecificAnswerString") if ($machineSpecificAnswerString -ne "") { $appendString = $appendString + $individualComponentString $appendString = $appendString + $machineSpecificAnswerString $appendString = $appendString + "" } } } return $appendString } ############################################################################## # This function does the extra processing work, which is required for some # parameters outputted by the Monad Tasks. # DataComponent: The data node from which we will populate # the values for the task parameters. # Returns: The command string if any else null. ############################################################################## function CreateExtraProcessingCommand([System.Xml.XmlElement]$datacomponent) { $extraCommandString = $null # As of now SendConnector is the only object we have to do extra processing. # Only for the LinkedReceiveConnector parameter. if($datacomponent.ToString().ToUpper() -eq "SENDCONNECTOR") { write-debug ("CreateExtraProcessingCommand " + $dataComponent.ToString()) $linkedReceiveConnector = $datacomponent.Get_Item("LinkedReceiveConnector").Get_InnerXml().Trim() if($linkedReceiveConnector -ne '$null') { $extraCommandString = "Set-SendConnector -Identity '" + $datacomponent.Get_Item("Name").Get_InnerXml().Trim() + "'" $linkedReceiveConnectorItems = $linkedReceiveConnector.Trim().Split(',') $linkedReceiveConnectorObject = get-receiveconnector $linkedReceiveConnectorItems[0] if($linkedReceiveConnectorObject -ne $null) { $extraCommandString = $extraCommandString + " -LinkedReceiveConnector '" + $linkedReceiveConnectorObject.Identity + "'" } } } return $extraCommandString } ########################################################################################## # Create each individual monad task command to be run on the Target Server. # command: The command name, its also used to get the parameters this command takes. # Datacomponent: The data node from which we will populate the values for the task parameters. # AnswerComponent: The answer node from which we will populate the machine related task paramaters. # NonClonableItemsNode: Skip the task parameters which are listed in this Node. # Key: There are some commands whose identity or server info cannot be cloned and they are single # Objects on Edge, in these cases use pipelining to set the Object ########################################################################################## function EvaluateAndAppendCommandParameters([String]$command, [System.Xml.XmlElement]$datacomponent, [System.Xml.XmlElement]$answerComponent, [System.Xml.XmlElement]$NonClonableItemsNode, [String]$key, [String]$preConditionVerb) { write-debug ("EvaluateAndAppendCommandParameters " + $command) write-debug ("preconditionVerb=" + $preConditionVerb) $commandWithParameters = "" $cmdObject = get-command $command $commandWithParameters = $command # for each parameter of this object foreach($parameter in $cmdObject.ParameterSets[0].Parameters) { write-debug ("parameter= " + $parameter.Name) # For each parameter the resulting command can take; # If the parameter is in the non-clonable list just ignore it # Else Try to get the value from the Answer file if any. # Else use the value present in the data file. if($NonClonableItemsNode) { $nonClonableItems = $NonClonableItemsNode.Item $nonCloneFlag = $false # if this parameter is a no clonnable item, # ignore this parameter in resulting task command. foreach($nonClonableItem in $nonClonableItems) { if($nonClonableItem.Trim() -eq $parameter.Name) { $nonCloneFlag = $true break; } } if($nonCloneFlag -eq $true) { continue; } } # if Data for this parameter is present in the Answer file pick it # else use the data from the Data file. # we don't need to check for "" and "{}" since the intial validation # while importing will fail if they are empty. if(($answerComponent) -and ($answerComponent.Get_Item($parameter.Name)) -and ($answerComponent.Get_Item($parameter.Name).Get_InnerXml() -ne "") -and ($answerComponent.Get_Item($parameter.Name).Get_InnerXml() -ne "{}")) { # if Multivalued Answer Node create the command string from the # child nodes. if ($answerComponent.Get_Item($parameter.Name).Get_ChildNodes().Count -gt 1) { $multiValuedString = createMultivaluedMonadString($answerComponent.Get_Item($parameter.Name)) $paramString = " -" + $parameter.Name + ":" + $multiValuedString $commandWithParameters = $commandWithParameters + $paramString } # if boolean use $true or $false. Based on its value in the answer file elseif($parameter.ParameterType.Name -eq "Boolean") { $commandWithParameters = $commandWithParameters + " -" + $parameter.Name + ":$" + $answerComponent.Get_Item($parameter.Name).Get_InnerXml().ToLower() } # if not boolean consider as a regular string, tasks will take care of # converting them to specific Type ( TimeStamp, IpAddress etc..) else { $escapedValue = $answerComponent.Get_Item($parameter.Name).Get_InnerXml().Trim() $escapedValue = $escapedValue.Replace(">",">") $escapedValue = $escapedValue.Replace("<","<") $commandWithParameters = $commandWithParameters + " -" + $parameter.Name + " '" + $escapedValue + "'" } } # if not present in the answer file, pick them from the data file only # if the parameter is there elseif ($datacomponent.Get_Item($parameter.Name) -ne $null) { write-debug ("parameter elt present= " + $parameter.Name) # if it is not blank OR the precondition is "SetBlank". if (($datacomponent.Get_Item($parameter.Name).Get_InnerXml() -ne "") -or ($preConditionVerb -eq "SetBlank")) { write-debug ("parameter not blank OR no Remove precondition") # pass null to the corresponding element during import phase. if($datacomponent.Get_Item($parameter.Name).Get_InnerXml() -eq '$null') { $commandWithParameters = $commandWithParameters + " -" + $parameter.Name + ":$" + "null" } # if the parameter is of type MultiValued construct the command # accordingly. elseif($parameter.ParameterType.Name.ToString().ToUpper().StartsWith("MULTIVALUED")) { $paramString = " -" + $parameter.Name + ":" + $datacomponent.Get_Item($parameter.Name).Get_InnerXml().Trim() $commandWithParameters = $commandWithParameters + $paramString } # if boolean use $true or $false. Based on its value in the Data node. elseif($parameter.ParameterType.Name -eq "Boolean") { $commandWithParameters = $commandWithParameters + " -" + $parameter.Name + ":$" + $datacomponent.Get_Item($parameter.Name).Get_InnerXml().ToLower() } # if PSCredential construct a new credential object elseif($parameter.ParameterType.Name -eq "PSCredential") { $mshCredentialNode = $datacomponent.Get_Item($parameter.Name) $userName = $mshCredentialNode.Get_Item("UserName").Get_InnerXml() $encryptedPassword = $mshCredentialNode.Get_Item("Password").Get_InnerXml() $securePassword = ConvertTo-SecureString -String $encryptedPassword -key $encryptionKey # $encryptedPassword = ConvertFrom-SecureString -SecureString $securePassword -key $encryptionKey # Catch password conversion errors if ($securePassword -eq $null) { throw $Error[0].Exception } $script:Credential = new-object System.Management.Automation.PSCredential ($userName, $securePassword) write-debug ("credential.UserName=" + $Credential.UserName) # write-debug ("credential.Password=" + $Credential.GetNetworkCredential().Password) $paramString = " -" + $parameter.Name + ":" + '$script:Credential' $commandWithParameters = $commandWithParameters + $paramString } elseif ($parameter.Name -eq "ProxyServerType") { $stringProxyServerType = $datacomponent.Get_Item($parameter.Name).Get_InnerXml().ToLower() write-debug ("stringProxyServerType = " + $stringProxyServerType) $paramString = " -" + $parameter.Name + ":" + $stringProxyServerType $commandWithParameters = $commandWithParameters + $paramString } # Otherwise consider as a regular string, tasks will take care of # converting them to specific Type ( TimeStamp, IpAddress etc..) else { $escapedValue = $datacomponent.Get_Item($parameter.Name).Get_InnerXml().Trim() $escapedValue = $escapedValue.Replace(">",">") $escapedValue = $escapedValue.Replace("<","<") $commandWithParameters = $commandWithParameters + " -" + $parameter.Name + " '" + $escapedValue + "'" } } } } # If this command has machine specific information and the component # associated with this is unique. ex-- TransportServer. if(($key) -and ($key -eq "None")) { $MachineName = [System.Environment]::MachineName $commandWithParameters = "Get-" + $datacomponent.ToString() + " -Identity:" + $MachineName + " | " + $commandWithParameters #write-debug ("Unique/Machine specific completeCommand= " + $commandWithParameters) } Write-Information $false $commandWithParameters write-debug ("commandWithParameters= " + $commandWithParameters) return $commandWithParameters } ########################################################################################## # Creates and runs commands # ImportTemplateComponent: Encapsulates the Type of component and # commands to be run on the Target machine. # Datacomponent: Data File Node # AnswerComponent: Machine Specific Data Node # Key: Key which Distinguishes objects of same component Type. ########################################################################################## function ImportObject([System.Xml.XmlElement]$importTemplateComponent, [System.Xml.XmlElement]$datacomponent, [System.Xml.XmlElement]$answerComponent, [String]$key) { write-debug "" write-debug ("ImportObject " + $importTemplateComponent.ToString()) $preConditionVerb = $importTemplateComponent.GetAttribute("PreCondition").ToString() write-debug ("Precondition = " + $preconditionVerb) # Creates the Monad Command # As of now the PreCondition and PostCOndition have only single command. # ImportVerbs may have multiple elements so split them and build each command seperately. $command = "" $baseCommand = "" if(($importTemplateComponent.GetAttribute("ImportVerbs").ToString()) -ne "None") { # In some cases output from a single task may have to be # sent to multiple tasks with the same Noun. # In these cases ImportVerbs will have multiple items separated by : $subCmds = $importTemplateComponent.GetAttribute("ImportVerbs").ToString().Split(':') write-debug ("ImportVerbs:" + $importTemplateComponent.GetAttribute("ImportVerbs").ToString()) foreach($subCmd in $subCmds) { # Special Case specific to TransportAgents # There are two different tasks to enable/disable(why?). if($subCmd -eq "EnableOrDisable") { #Assuming that the parameter name associated with flag is "Enabled" #Will have to add some extra mappings in Template XML to care of this. if($datacomponent.Get_Item("Enabled").Get_InnerXml().ToString() -eq "True") { $baseCommand = "Enable-" + $importTemplateComponent.ToString() } else { $baseCommand = "Disable-" + $importTemplateComponent.ToString() } } else { # command created from ImportVerbs element and component name which is Noun. $baseCommand = $subCmd + "-" + $importTemplateComponent.ToString() } # Now we have command name, So go get the parameters and append to command. $nonclonableItemsNode = $importTemplateComponent.Get_Item("NonClonableItems") $completeCommand = EvaluateAndAppendCommandParameters $baseCommand $datacomponent $answerComponent $nonClonableItemsNode $key $preConditionVerb write-debug ("importTemplateComponent = " + $importTemplateComponent.ToString()) # Special Case specific to RemoteDomain to deal with Identity and unremovable Default instance if ($importTemplateComponent.ToString() -eq "RemoteDomain") { $domainName = $datacomponent.Get_Item("DomainName").Get_InnerXml().ToString() write-debug "domainName=$domainName" #We can't do a New on the (fixed) Default RemoteDomain Value since it can't be removed initially if ($subCmd -eq "New") { if ($domainName -eq "*") { # Special handling for Default Remote Domain # We can't do a New on the Default RemoteDomain Value since it can't be removed initially # However if it doesn't exist we have to create it $remoteDomain = get-remotedomain | where {$_.DomainName -eq $domainName} if ($remoteDomain -ne $null) { write-debug "Continue for Default New-RemoteDomain" continue } } } else { # Save the New-RemoteDomain Identity param for the Set-RemoteDomain $remoteDomain = get-remotedomain | where {$_.DomainName -eq $domainName} write-debug ("Identity=" + $remoteDomain.Identity.Name.ToString()) $completeCommand = $completeCommand + " -Identity:" + "'" + $remoteDomain.Identity.Name + "'" } } # Special Case specific to AcceptedDomain to deal with Identity if ($importTemplateComponent.ToString() -eq "AcceptedDomain") { $domainName = $datacomponent.Get_Item("DomainName").Get_InnerXml().ToString() write-debug "domainName=$domainName" $name = $datacomponent.Get_Item("Name").Get_InnerXml().ToString() write-debug "Name=$name" #We can't do a New on the (fixed) Default RemoteDomain Value since it can't be removed initially if ($subCmd -eq "Set") { # Save the New-AcceptedDomain Identity param for the Set-AcceptedDomain $acceptedDomain = get-accepteddomain | where {$_.Name -eq $name} write-debug ("Identity=" + $acceptedDomain.Identity.Name.ToString()) $completeCommand = $completeCommand + " -Identity:" + "'" + $acceptedDomain.Identity.Name + "'" # If this was the Original Default Accepted Domain make it the new Default write-debug ("defaultDomain?:" + $datacomponent.Get_Item("Default").Get_InnerXml()) if ($datacomponent.Get_Item("Default").Get_InnerXml() -eq $true) { write-debug ("Original Default AcceptedDomain") $completeCommand = $completeCommand + ' -MakeDefault:$true' } } } write-debug ("invoke-expression " + $completeCommand) # invoke the command with parameters. invoke-expression $completeCommand $command = $command + $baseCommand } # This is to take care of some parameters that cannot be handled # in a generic way. EvaluateAndAppendCommandParameters only looks at the first parameter set # For SendConnectors the LinkedReceiveConnector parameter is in the second parameter set and so # this needs to be handled as a special case. $extraCommand = CreateExtraProcessingCommand $datacomponent # write-debug ("extraCommand= " + $extraCommand) if($extraCommand -ne $null) { Write-Information $false $extraCommand invoke-expression $extraCommand $command = $command + $extraCommand } } return $command } ########################################################################################## # Imports the configuration using clone Template, Data File and Answer File. # cloneTemplateDoc: Clone Template document. # cloneDataDoc: Data document. # cloneAnswerDoc: Answer file document. ########################################################################################## function ImportConfig([System.Xml.XmlDocument]$cloneTemplateDoc, [System.Xml.XmlDocument]$cloneDataDoc, [System.Xml.XmlDocument]$cloneAnswerDoc) { write-debug ("ImportConfig ") $importSpecificRoot = $cloneTemplateDoc.SelectSingleNode("/cloneTemplate/importCloneItems") # Get all the import items. $importItems = $importSpecificRoot.Get_ChildNodes() # Get all machine specific items. $machineSpecificRoot = $cloneTemplateDoc.SelectSingleNode("/cloneTemplate/machineSpecificItems") # For each import specific item. foreach($importItem in $importItems) { $componentDataPath = "/ExportedEdgeConfiguration/" + $importItem.ToString() $AnswerDataPath = "/MachineSpecificSettings/" + $importItem.ToString() # Get the machine specific node if any for this import item. $machineSpecificComponentItem = $machineSpecificRoot.Get_Item($importItem.ToString()) # Get the Data nodes if any for this import item. $componentSpecificDataNodes = $cloneDataDoc.SelectNodes($componentDataPath) # Get the Answer file node if any for this import item. $componentSpecificAnswerNodes = $cloneAnswerDoc.SelectNodes($AnswerDataPath) write-debug "" write-debug ("importItem= " + $importItem.ToString()) write-debug ("componentSpecificDataNodes= $componentSpecificDataNodes") write-debug ("componentSpecificAnswerNodes= $componentSpecificAnswerNodes") $key = $null if($machineSpecificComponentItem) { # Get the key if any for this import item from machine specfic Node. $key = $machineSpecificComponentItem.GetAttribute("Key") } $preConditionVerb = $importItem.GetAttribute("PreCondition").ToString() $componentNoun = $importItem.ToString() write-debug ("key= $key") write-debug ("PreconditionVerb = " + $preConditionVerb) #As of now precondition can be either "None", "SetBlank" or "Remove" #If "Remove" Remove all the components of the current Type before adding new ones. #Better way of doing is put all the cleanup process as a separate block in the Template if( $preConditionVerb -eq "Remove") { # Clean up all the items of this Type on the Target machine. # I prefered to do it here so that we can delete all the objects in a single command # by using Monad pipelining if ($componentNoun -eq "IPAllowListEntry") { $baseCommand = $preConditionVerb + "-" + $componentNoun $cleanupCommand = 'Get-IPAllowListEntry | where { $_.IsMachineGenerated -eq $false}' + " | " + $baseCommand write-debug ("cleanupCommand= $cleanupCommand") invoke-expression $cleanupCommand } elseif ($componentNoun -eq "RemoteDomain") { $baseCommand = $preConditionVerb + "-" + $componentNoun $cleanupCommand = 'Get-RemoteDomain | where { $_.DomainName -ne "*"}' + " | " + $baseCommand write-debug ("cleanupCommand= $cleanupCommand") invoke-expression $cleanupCommand } elseif ($componentNoun -eq "AcceptedDomain") { # If no accepteddomains exist then don't add the unique one. $existingDomains = Get-AcceptedDomain if ($existingDomains -ne $null) { # Add a Unique GUID Value and make it the new Default $cleanupCommand = 'New-AcceptedDomain ' $cleanupCommand = $cleanupCommand + ' -DomainName:' + $script:uniqueName $cleanupCommand = $cleanupCommand + ' -Name:' + $script:uniqueName write-debug ("cleanupCommand= $cleanupCommand") invoke-expression $cleanupCommand $cleanupCommand = 'Set-AcceptedDomain -Identity:' + $script:uniqueName + ' -MakeDefault:$true' write-debug ("cleanupCommand= $cleanupCommand") invoke-expression $cleanupCommand $baseCommand = $preConditionVerb + "-" + $componentNoun $cleanupCommand = 'Get-AcceptedDomain | where { $_.Default -ne $true}' + " | " + $baseCommand write-debug ("cleanupCommand= $cleanupCommand") invoke-expression $cleanupCommand } } else { $baseCommand = $preConditionVerb + "-" + $componentNoun $cleanupCommand = "Get-" + $componentNoun + " | " + $baseCommand write-debug ("cleanupCommand= $cleanupCommand") invoke-expression $cleanupCommand } } $cmd = "" # Get the data nodes for each import specific item. # and import the data foreach($componentSpecificDataNode in $componentSpecificDataNodes) { [Boolean]$foundMatchingAnswerNode = $false # find a matching Answer node if any. foreach($componentSpecificAnswerNode in $componentSpecificAnswerNodes) { # if the key is "None", unique node so just pass whatever you have in hand and break. if($key -eq "None") { $foundMatchingAnswerNode = $true write-debug ("found matching answer node for unique data node") $cmd = ImportObject $importItem $componentSpecificDataNode $componentSpecificAnswerNode $key break } # find a matching key node in the answer file for the component and use that Answer Node. elseif(($componentSpecificAnswerNode.GetAttribute($key)) -eq ($componentSpecificDataNode.Get_Item($key).Get_InnerXml())) { write-debug ("found matching answer node for multi data node") $foundMatchingAnswerNode = $true $cmd = ImportObject $importItem $componentSpecificDataNode $componentSpecificAnswerNode $key break; } } # If there is no answer node(meaning doesn't contain any machine specific information # for this item) just use the Data Node. if($foundMatchingAnswerNode -eq $false) { write-debug ("no machine specific answer node - use exported data node directly") $cmd = ImportObject $importItem $componentSpecificDataNode $null $key } } #As of now postcondition can be either "None" or "Remove" #If "Remove" then Remove the temporary Unique Default value used to handle non-removeble defaults $postConditionVerb = $importItem.GetAttribute("PostCondition").ToString() $componentNoun = $importItem.ToString() write-debug ("PostConditionVerb = " + $postConditionVerb) if( $postConditionVerb -eq "Remove") { #As of now only AcceptedDomain has a postcondition if ($componentNoun -eq "AcceptedDomain") { $postConditionCommand = 'Get-AcceptedDomain | where {$_.DomainName -eq "' + $script:uniqueName + '"} | Remove-AcceptedDomain ' write-debug ("postConditionCommand= $postConditionCommand") invoke-expression $postConditionCommand } } } } ########################################################################################## # Creates the Answer File. # cloneTemplateDoc: Clone Template document. # cloneDataDoc: Data document. # cloneConfigAnswer: Name of the answer file including complete path. ########################################################################################## function ValidateAndCreateAnswerFile([System.Xml.XmlDocument]$cloneTemplateDoc, [System.Xml.XmlDocument]$cloneDataDoc, [String]$cloneConfigAnswer) { write-debug "ValidateAndCreateAnswerFile " $rootNode = "MachineSpecificSettings" $xmlData = "<" + $rootNode + ">" $machineSpecificNode = $cloneTemplateDoc.SelectSingleNode("/cloneTemplate/machineSpecificItems") # Get all the machine specific nodes. $components = $machineSpecificNode.Get_ChildNodes() # for each machine specific node foreach($component in $components) { # Validate the machine specific info on the Target machine and # Get all the non valid nodes. $xmlItem = ValidateAndAppendComponentConfig $component $cloneDataDoc $xmlData = $xmlData + $xmlItem } # There should not be any string overflow because there is very little data # in the Answer file. $xmlData = $xmlData + "" $xmlDocument = [System.Xml.XmlDocument]($xmlData) $xmlDocument.Save($cloneConfigAnswer) } ########################################################################################## # Validates the Answer File. # cloneTemplateDoc: Clone Template document. # cloneDataDoc: Data document. # Returns True if success else False ########################################################################################## function ValidateAnswerFile([System.Xml.XmlDocument]$cloneTemplateDoc, [System.Xml.XmlDocument]$cloneAnswerDoc) { write-debug "ValidateAnswerFile" write-verbose "ValidateAnswerFile" $isValid = $true $machineSpecificNode = $cloneTemplateDoc.SelectSingleNode("/cloneTemplate/machineSpecificItems") write-debug ("machineSpecificNode= " + $machineSpecificNode) # Get Machine specific componenets $components = $machineSpecificNode.Get_ChildNodes() # for each machine specific component. foreach($component in $components) { write-debug ("TemplateComponent = " + $component.ToString()) $componentItems = $component.Get_ChildNodes() $componentPath = "/MachineSpecificSettings/" + $component.ToString() # Get all the components for this machine specific component. $componentAnswerNodes = $cloneAnswerDoc.SelectNodes($componentPath) if($componentAnswerNodes) { # For each answer component foreach($componentAnswerNode in $componentAnswerNodes) { write-debug ("AnswerFileComponent = " + $componentAnswerNode.ToString()) # Get each individual item in this Answer component node $componentAnswerNodeItems = $componentAnswerNode.Get_ChildNodes() if($componentAnswerNodeItems) { # Do process for each item in this answer node. # for MultiValuedProperty node we will have child nodes # which have to be taken in consideration. foreach($componentAnswerNodeItem in $componentAnswerNodeItems) { write-debug ("AnswerNodeItem=" + $componentAnswerNodeItem.ToString()) #Loop through the machine items to find a match # for this answer item foreach($componentItem in $componentItems) { write-debug ("TemplateNodeItem=" + $componentItem.Get_InnerXml().ToString()) # if match is found if($componentItem.Get_InnerXml().ToString() -eq $componentAnswerNodeItem.ToString()) { write-debug ("MATCH:TemplateNode=AnswerNode") # if Multivalued property Validation if ($componentAnswerNodeItem.Get_ChildNodes().Count -gt 1) { $currentAnswerNodeValue = createMultivaluedMonadString($componentAnswerNodeItem) } else { $currentAnswerNodeValue = $componentAnswerNodeItem.Get_InnerXml().ToString().Trim() } write-debug ("AnswerNodeValue=$currentAnswerNodeValue") #if data not found for this item in the answer node validation failed. if ($currentAnswerNodeValue -eq "") { Write-Information $true "Validation Failed: " $component.ToString() $componentItem.Get_InnerXml().ToString() "{" $currentAnswerNodeValue "}" $isValid = $false break } # if match found and not empty and validation Type is "None" # skip this item. elseif ($componentItem.GetAttribute("ValidationType") -eq "None") { break } #if validation Type is not "None" do validation. $temp = ValidateItem $currentAnswerNodeValue $componentItem.GetAttribute("ValidationType") # if validation failed Log the failure. if ($temp -eq $false) { Write-Information $true "Validation Failed: " $component.ToString() $componentItem.Get_InnerXml().ToString() "{" $currentAnswerNodeValue $componentItem.GetAttribute("ValidationType") "}" $isValid = $false } elseif ($temp -eq $true) { } else { $isValid = $false foreach($hashKey in $temp.Get_Keys()) { if ($temp[$hashKey] -eq $false) { Write-Information $true "Validation Failed: " $component.ToString() $componentItem.Get_InnerXml().ToString() "{" $hashKey $componentItem.GetAttribute("ValidationType") "}" } } } write-debug "" break } } } } } } } return $isValid } ############################################################################# # InitializationCheck # Setup script variables, check arguments etc. ############################################################################# function InitializationCheck() { write-debug "InitializationCheck" # Global variable for storing handle to the clone log file. # Change this to Actual Path relative to [C:\Program Files\Microsoft\Exchange Server\] $script:success = $false $script:uniqueName = "A9ABA4D2-C21C-4bc5-8B30-3EA47BBE3608" $script:uniqueKey = "A9ABA4D2C21C4bc58B303EA47BBE3608" $script:installPath = GetEdgeInstallPath $script:logfilePath = $installPath + "Logging\SetupLogs\cloneLogFile.log" $script:logger = new-object System.IO.StreamWriter ($logfilePath , $true) if ($key -eq $uniqueKey) { write-host -ForegroundColor "red" "Warning:Passwords will be encrypted with the default script encryption key" } # Check/Setup the SecurePassword encryption key if (($key.Length -ne 32) -and ($key.Length -ne 24) -and ($key.Length -ne 16)) { Write-Information $true "Key Length needs to be 16, 24 or 32 bytes long." return } $script:encryptionKey = $key.ToCharArray() write-debug ("encryption key=" + $encryptionKey) Write-LogStartInformation # Return error if any extra parameters are supplied. if($script:args.Count -gt 0) { foreach($arg in $script:args) { Write-Information $true "Invalid additional parameter $arg passed." } return } # Adam Service Name $AdamServiceName = "ADAM_MSExchange" # Make sure ADAM_MsExchange Service is running. $adamServiceStatus = get-service $AdamServiceName if(($adamServiceStatus -eq $null) -or ($adamServiceStatus.Status -ne [System.ServiceProcess.ServiceControllerStatus]::Running)) { Write-Information $true "Adam service should be running, in order to import clone config." return } # Initialize "global" variables that can be used in the template. $script:MachineName = [System.Environment]::MachineName $script:edgeServer = get-ExchangeServer -Identity:$MachineName | where { $_.IsEdgeServer -eq $true } if (!$script:edgeServer) { Write-Information $true "Please run the Import script on the Edge Server." return } $isValidInput = validateInput if($isValidInput -eq $false) { return } $script:success = $true } $cloneTemplate = ' ConnectivityLogPath MessageTrackingLogPath PickupDirectoryPath PipelineTracingPath ReceiveProtocolLogPath ReplayDirectoryPath RoutingTableLogPath RootDropDirectoryPath SendProtocolLogPath SourceIPAddress Bindings Fqdn Identity PickupDirectoryDefaultDomain ExternalDsnReportingAuthority InternalDsnReportingAuthority ExternalPostmasterAddress Name Identity Identity CharacterSet NonMimeCharacterSet ContentType LineWrapSize MsExchRoutingDisplaySenderEnabled TNEFEnabled AllowedOOFType AutoReplyEnabled AutoForwardEnabled DeliveryReportEnabled NDREnabled MeetingForwardNotificationEnabled UseSimpleDisplayName Server AdvertisedDomain PermissionGroups ' ####################################################################### # Main Script starts here. Validates the parameters and based on isImport value # will run through the Import or Create answer file Steps. ####################################################################### $errorActionSave = $ErrorActionPreference # Do all the Initialization Checks InitializationCheck if (-not $success) { Export-ReleaseHandles exit } write-debug "Main" write-debug ("cloneConfigData = $cloneConfigData") $cloneTemplateDoc.LoadXML($cloneTemplate) $cloneDataDoc.Load($cloneConfigData) if($isImport -eq $true) { # Incase of Importing. write-verbose "Import Cloned Config" if($cloneConfigAnswer -ne $null) { $cloneAnswerDoc.Load($cloneConfigAnswer) trap { Write-Information $true "Loading Answer File Failed." Write-Information $true ("Reason: " + $error[0]) Export-ReleaseHandles exit } } # Incase of Restoring. else { $emptyAnswerString = "" $cloneAnswerDoc = [System.Xml.XmlDocument]($emptyAnswerString) } $validationSuccess = ValidateAnswerFile $cloneTemplateDoc $cloneAnswerDoc if($validationSuccess -eq $false) { Write-Information $true ("Validation Process Failed. Please enter correct information in " + $cloneConfigAnswer) Export-ReleaseHandles exit } ImportConfig $cloneTemplateDoc $cloneDataDoc $cloneAnswerDoc trap { # Catch password conversion errors if ($error[0].Exception.GetType() -eq [System.Security.Cryptography.CryptographicException]) { Write-Information $true "Password Decryption Failed - Check the decryption key." } else { Write-Information $true "Importing Edge configuration information Failed." } Write-Information $true ("Reason: " + $error[0]) Export-ReleaseHandles exit } Write-Information $true "Importing Edge configuration information Succeeded." } else { write-verbose "Validate Cloned Config" # Don't display errors For Validation Phase $ErrorActionPreference = "SilentlyContinue" ValidateAndCreateAnswerFile $cloneTemplateDoc $cloneDataDoc $cloneConfigAnswer trap { # Restore Error Action Preference $ErrorActionPreference = $errorActionSave Write-Information $true "Creating Answer File Step Failed." Write-Information $true ("Reason: " + $error[0]) Export-ReleaseHandles exit } Write-Information $true ("Answer File is successfully created: " + $cloneConfigAnswer) } Export-ReleaseHandles # SIG # Begin signature block # MIIXUQYJKoZIhvcNAQcCoIIXQjCCFz4CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB # gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR # AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUJLVGRWa9j6BMFcCQbJeK9pVn # hFOgghIkMIIEYDCCA0ygAwIBAgIKLqsR3FD/XJ3LwDAJBgUrDgMCHQUAMHAxKzAp # BgNVBAsTIkNvcHlyaWdodCAoYykgMTk5NyBNaWNyb3NvZnQgQ29ycC4xHjAcBgNV # BAsTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEhMB8GA1UEAxMYTWljcm9zb2Z0IFJv # b3QgQXV0aG9yaXR5MB4XDTA3MDgyMjIyMzEwM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