-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathConfigure-CrlBypass.ps1
101 lines (84 loc) · 3.45 KB
/
Configure-CrlBypass.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# Configure-CrlBypass.ps1
# modified by spence to check presence of each framework v2 (not instaled on WAC)
# and general tidy up to fit model of SPAT
#region PARAMS
param ()
#endregion PARAMS
# paths
$netV232path = "c:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config"
$netV264path = "c:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG\machine.config"
$netV432path = "c:\Windows\Microsoft.NET\Framework\v4.0.30319\CONFIG\machine.config"
$netV464path = "c:\Windows\Microsoft.NET\Framework64\v4.0.30319\CONFIG\machine.config"
#v2 32 bit
$path = $netV232path
if (Test-Path $path) {
$xml = [xml](get-content($path))
$xml.Save($path+ ".old")
$runtime = $xml.configuration["runtime"]
if($runtime.generatePublisherEvidence -eq $null) {
Write-Host "$(Get-Date -Format T) : .NET v2 32bit creating generatePublisherEvidence - setting false on $env:ComputerName"
$GPE = $xml.CreateElement("generatePublisherEvidence")
$GPE.SetAttribute("enable", "false")
$runtime.AppendChild($GPE)
}
else {
Write-Host "$(Get-Date -Format T) : .NET v2 32bit detected generatePublisherEvidence - setting false on $env:ComputerName"
$runtime.generatePublisherEvidence.enable = "false";
}
$xml.Save($path)
}
#v4 32 bit
$path = $netV432path
if (Test-Path $path) {
$xml = [xml](get-content($path))
$xml.Save($path+ ".old")
$runtime = $xml.configuration["runtime"]
if($runtime.generatePublisherEvidence -eq $null) {
Write-Host "$(Get-Date -Format T) : .NET v4 32bit creating generatePublisherEvidence - setting false on $env:ComputerName"
$GPE = $xml.CreateElement("generatePublisherEvidence")
$GPE.SetAttribute("enable", "false")
$runtime.AppendChild($GPE)
}
else {
Write-Host "$(Get-Date -Format T) : .NET v4 32bit detected generatePublisherEvidence - setting false on $env:ComputerName"
$runtime.generatePublisherEvidence.enable = "false";
}
$xml.Save($path)
}
#Set 64bit V2 Framework
$path = $netV264path
if (Test-Path $path) {
$xml = [xml](get-content($path))
$xml.Save($path+ ".old")
$runtime = $xml.configuration["runtime"]
if($runtime.generatePublisherEvidence -eq $null) {
Write-Host "$(Get-Date -Format T) : .NET v2 64bit creating generatePublisherEvidence - setting false on $env:ComputerName"
$GPE = $xml.CreateElement("generatePublisherEvidence")
$GPE.SetAttribute("enable", "false")
$runtime.AppendChild($GPE)
}
else {
Write-Host "$(Get-Date -Format T) : .NET v2 64bit detected generatePublisherEvidence - setting false on $env:ComputerName"
$runtime.generatePublisherEvidence.enable = "false";
}
$xml.Save($path)
}
#Set 64bit V4 Framework
$path = $netV464path
if (Test-Path $path) {
$xml = [xml](get-content($path))
$xml.Save($path+ ".old")
$runtime = $xml.configuration["runtime"]
if($runtime.generatePublisherEvidence -eq $null) {
Write-Host "$(Get-Date -Format T) : .NET v4 64bit creating generatePublisherEvidence - setting false on $env:ComputerName"
$GPE = $xml.CreateElement("generatePublisherEvidence")
$GPE.SetAttribute("enable", "false")
$runtime.AppendChild($GPE)
}
else {
Write-Host "$(Get-Date -Format T) : .NET v4 64bit detected generatePublisherEvidence - setting false on $env:ComputerName"
$runtime.generatePublisherEvidence.enable = "false";
}
$xml.Save($path)
}
#EOF