In the production we have identified issue preventing the application hosted by IIS to work properly. The solution is to disable the Certificate Revocation List (CRL) lookup since they boxes are not connected on the internet.
According to http://www.symantec.com/business/support/index?page=content&id=TECH192580 in order to disable CRL lookups on the Symantec Management Platform computer, you need to edit the machine.config file on the computer, as follows:
- Open the machine.config file in a text editor. (If you run in a x64 environment you will need to edit the x64 framework file)
(x86) The machine.config file is located at %runtime install path%\Config\machine.config, where the runtime install path is usually C:\Windows\Microsoft.NET\Framework\v2.0.50727.
(x64) The machine.config file is located at %runtime install path%\Config\machine.config, where the runtime install path is usually C:\Windows\Microsoft.NET\Framework64\v2.0.50727. - Look for in the machine.config file and change to this:
{
}
3.Save the machine.config file.
4.Open a command prompt with Administrator rights, and type iisreset.
I need to do it for over 140 servers.
I am having a little trouble manipulating the XML object. Following the example from powershell - adding XML sub-elements - Stack Overflow I managed to create the following code.
Param(
[string]$ComputerName = 'TestServer'
)
#Detect system type
$SystemType = Get-WmiObject Win32_ComputerSystem -ComputerName $ComputerName | select -ExpandProperty systemtype
#Get content from remote server
$MachineConfig = switch ($SystemType)
{
'x86-based PC' {"\\$ComputerName\c$\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config"}
'x64-based PC' {"\\$ComputerName\c$\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\CONFIG\machine.config"}
}
#XML document creation
$xmlDoc =[xml](Get-Content $MachineConfig)
# Creation of a node and its text
$xmlElt = $xmlDoc.CreateElement("Runtime")
$xmlElt.AppendChild($xmlText)
# Creation of a sub node
$xmlSubElt = $xmlDoc.CreateElement("generatePublisherEvidence")
$xmlSubElt.AppendChild($xmlSubText)
$xmlElt.AppendChild($xmlSubElt)
# Creation of an attribute in the principal node
$xmlAtt = $xmlDoc.CreateAttribute("enabled")
$xmlAtt.Value = "false"
$xmlsubElt.Attributes.Append($xmlAtt)
# Add the node to the document
$xmlDoc.LastChild.AppendChild($xmlElt);
# Store to a file
$xmlDoc.Save("C:\temp\machine.config")
#Backup the original file and copy the modified file
#Copy-Item -Path $MachineConfig "\\$ComputerName\c$\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config.backup"
#Copy-Item -Path "C:\temp\machine.config" -Destination $MachineConfig -Force
#Retart IIS on remote server
#Get-Service -ComputerName $ComputerName -DisplayName 'IIS Admin Service' | Restart-Service -Force
The troubles I am facing are:
- It adds element at the end of document. How to add the entry just after xml section configProtectedData in document?
- Some files already contain empty section. In such scenario I end up having to entries: at end of document
and original empty ones - How to check if the node exists. When I use Get-Member it list Haschildnodes but when it run does not work.
Method invocation failed because [System.Xml.XmlElement] does not contain a method named 'HasChildNodes'.
At line:1 char:1
+ $xmlDoc.configuration.HasChildNodes('runtime')
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (HasChildNodes:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFoundpre]
So the code I am going to develop should check if
If runtime exists
If does, check if entry is correct then amend accordingly.
If not exist add runtime section
Thank you for any hints in advance.
Tomasz