Skip to content

Commit ceb93ad

Browse files
committed
Fixing spacing and indents for consistency
1 parent 7d1f3fa commit ceb93ad

File tree

1 file changed

+42
-42
lines changed

1 file changed

+42
-42
lines changed

LabTech.psm1

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -978,59 +978,59 @@ Function Install-LTService{
978978
Throw "Needs to be ran as Administrator"
979979
}
980980

981-
if (!$SkipDotNet) {
982-
983-
$DotNET = Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -recurse -EA 0 | Get-ItemProperty -name Version,Release -EA 0 | Where-Object { $_.PSChildName -match '^(?!S)\p{L}'} | Select-Object -ExpandProperty Version -EA 0
984-
if (-not ($DotNet -like '3.5.*')){
985-
Write-Output ".NET 3.5 installation needed."
986-
#Install-WindowsFeature Net-Framework-Core
987-
$OSVersion = [System.Environment]::OSVersion.Version
988-
989-
if ([version]$OSVersion -gt [version]'6.2'){
990-
try{
991-
If ( $PSCmdlet.ShouldProcess("NetFx3", "Enable-WindowsOptionalFeature") ) {
992-
$Install = Enable-WindowsOptionalFeature -Online -FeatureName "NetFx3" -All
993-
if ($Install.RestartNeeded) {
994-
Write-Output ".NET 3.5 installed but a reboot is needed."
981+
if (!$SkipDotNet){
982+
983+
$DotNET = Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -recurse -EA 0 | Get-ItemProperty -name Version,Release -EA 0 | Where-Object { $_.PSChildName -match '^(?!S)\p{L}'} | Select-Object -ExpandProperty Version -EA 0
984+
if (-not ($DotNet -like '3.5.*')){
985+
Write-Output ".NET 3.5 installation needed."
986+
#Install-WindowsFeature Net-Framework-Core
987+
$OSVersion = [System.Environment]::OSVersion.Version
988+
989+
if ([version]$OSVersion -gt [version]'6.2'){
990+
try{
991+
If ( $PSCmdlet.ShouldProcess("NetFx3", "Enable-WindowsOptionalFeature") ) {
992+
$Install = Enable-WindowsOptionalFeature -Online -FeatureName "NetFx3" -All
993+
if ($Install.RestartNeeded) {
994+
Write-Output ".NET 3.5 installed but a reboot is needed."
995+
}
995996
}
996997
}
997-
}
998-
catch{
999-
Write-Error "ERROR: .NET 3.5 install failed." -ErrorAction Continue
1000-
if (!($Force)) { Write-Error $Install -ErrorAction Stop }
1001-
}
1002-
}
1003-
Else{
1004-
If ( $PSCmdlet.ShouldProcess("NetFx3", "Add Windows Feature") ) {
1005-
Try {$Result=& "$env:windir\system32\Dism.exe" /online /get-featureinfo /featurename:NetFx3 2>''}
1006-
Catch {Write-Output "Error calling Dism.exe."; $Result=$Null}
1007-
If ($Result -contains "State : Enabled"){
1008-
# also check reboot status, unsure of possible outputs
1009-
# Restart Required : Possible
1010-
Write-Warning ".Net Framework 3.5 has been installed and enabled."
1011-
}
1012-
Else {
998+
catch{
1013999
Write-Error "ERROR: .NET 3.5 install failed." -ErrorAction Continue
1014-
If (!($Force)) { Write-Error $Result -ErrorAction Stop }
1000+
if (!($Force)) { Write-Error $Install -ErrorAction Stop }
1001+
}
1002+
}
1003+
Else{
1004+
If ( $PSCmdlet.ShouldProcess("NetFx3", "Add Windows Feature") ) {
1005+
Try {$Result=& "$env:windir\system32\Dism.exe" /online /get-featureinfo /featurename:NetFx3 2>''}
1006+
Catch {Write-Output "Error calling Dism.exe."; $Result=$Null}
1007+
If ($Result -contains "State : Enabled"){
1008+
# also check reboot status, unsure of possible outputs
1009+
# Restart Required : Possible
1010+
Write-Warning ".Net Framework 3.5 has been installed and enabled."
1011+
}
1012+
Else {
1013+
Write-Error "ERROR: .NET 3.5 install failed." -ErrorAction Continue
1014+
If (!($Force)) { Write-Error $Result -ErrorAction Stop }
1015+
}#End If
10151016
}#End If
10161017
}#End If
1017-
}#End If
10181018

1019-
$DotNET = Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -recurse | Get-ItemProperty -name Version -EA 0 | Where-Object{ $_.PSChildName -match '^(?!S)\p{L}'} | Select-Object -ExpandProperty Version
1020-
}#End If
1019+
$DotNET = Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -recurse | Get-ItemProperty -name Version -EA 0 | Where-Object{ $_.PSChildName -match '^(?!S)\p{L}'} | Select-Object -ExpandProperty Version
1020+
}#End If
10211021

1022-
If (-not ($DotNet -like '3.5.*')){
1023-
If (($Force)) {
1024-
If ($DotNet -like '2.0.*'){
1025-
Write-Error "ERROR: .NET 3.5 is not detected and could not be installed." -ErrorAction Continue
1022+
If (-not ($DotNet -like '3.5.*')){
1023+
If (($Force)) {
1024+
If ($DotNet -like '2.0.*'){
1025+
Write-Error "ERROR: .NET 3.5 is not detected and could not be installed." -ErrorAction Continue
1026+
} Else {
1027+
Write-Error "ERROR: .NET 2.0 is not detected and could not be installed." -ErrorAction Stop
1028+
}#End If
10261029
} Else {
1027-
Write-Error "ERROR: .NET 2.0 is not detected and could not be installed." -ErrorAction Stop
1030+
Write-Error "ERROR: .NET 3.5 is not detected and could not be installed." -ErrorAction Stop
10281031
}#End If
1029-
} Else {
1030-
Write-Error "ERROR: .NET 3.5 is not detected and could not be installed." -ErrorAction Stop
10311032
}#End If
10321033
}#End If
1033-
}#End If
10341034

10351035
$logpath = [System.Environment]::ExpandEnvironmentVariables("%windir%\temp\LabTech")
10361036
$logfile = "LTAgentInstall"

0 commit comments

Comments
 (0)