Public/Get-DownMcAfee.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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
<#
.SYNOPSIS Downloads McAfee SuperDATs and Tools .DESCRIPTION Downloads McAfee SuperDATs and Tools .LINK https://osdupdate.osdeploy.com/module/functions/get-downmcafee .PARAMETER Product The type of update to download .PARAMETER DownloadPath This is the path to download the updates. If this is not specified, the Desktop is used .PARAMETER EPO Downloads the ZIP version for use in McAfee EPO .PARAMETER RenameDAT Renames the DAT without the Version information. Useful for static installation scripts #> function Get-DownMcAfee { [CmdletBinding()] PARAM ( [Parameter(Mandatory)] [ValidateSet('SuperDAT v2','SuperDAT v3','GetSusp32','GetSusp64','Stinger32','Stinger64')] [string]$Download, [string]$DownloadPath, [switch]$EPO, #[switch]$AddInstallScript, [switch]$RenameDAT ) #=================================================================================================== # Paths #=================================================================================================== if (!($DownloadPath)) {$DownloadPath = [Environment]::GetFolderPath("Desktop")} if (!(Test-Path "$DownloadPath")) {New-Item -Path "$DownloadPath" -ItemType Directory -Force | Out-Null} if ($Download -eq 'GetSusp32') { if ($EPO.IsPresent) { $DownloadUrl = 'http://downloadcenter.mcafee.com/products/mcafee-avert/getsusp/getsusp-epo.zip' } else { $DownloadUrl = 'http://downloadcenter.mcafee.com/products/mcafee-avert/getsusp/getsusp.exe' } } if ($Download -eq 'GetSusp64') { if ($EPO.IsPresent) { $DownloadUrl = 'http://downloadcenter.mcafee.com/products/mcafee-avert/getsusp/getsusp64-epo.zip' } else { $DownloadUrl = 'http://downloadcenter.mcafee.com/products/mcafee-avert/getsusp/getsusp64.exe' } } if ($Download -eq 'Stinger32') { if ($EPO.IsPresent) { $DownloadUrl = 'http://downloadcenter.mcafee.com/products/mcafee-avert/Stinger/stinger32-epo.zip' } else { $DownloadUrl = 'http://downloadcenter.mcafee.com/products/mcafee-avert/Stinger/stinger32.exe' } } if ($Download -eq 'Stinger64') { if ($EPO.IsPresent) { $DownloadUrl = 'http://downloadcenter.mcafee.com/products/mcafee-avert/Stinger/stinger64-epo.zip' } else { $DownloadUrl = 'http://downloadcenter.mcafee.com/products/mcafee-avert/Stinger/stinger64.exe' } } if ($Download -eq 'SuperDAT v2') { if ($EPO.IsPresent) { Write-Host "Verifying SuperDAT v2 EPO Download URL ..." -ForegroundColor Cyan $DownloadString = 'download.nai.com/products/DatFiles/4.x/NAI/avvepo' $link = (Invoke-WebRequest -Uri 'https://www.mcafee.com/enterprise/en-us/downloads/security-updates.html').Links | Where-Object {$_.href -like "*$DownloadString*"} $DownloadUrl = $link.href } else { Write-Host "Verifying SuperDAT v2 Download URL ..." -ForegroundColor Cyan $DownloadString = 'download.nai.com/products/licensed/superdat/english/intel' $link = (Invoke-WebRequest -Uri 'https://www.mcafee.com/enterprise/en-us/downloads/security-updates.html').Links | Where-Object {$_.href -like "*$DownloadString*"} $DownloadUrl = $link.href } } if ($Download -eq 'SuperDAT v3') { if ($EPO.IsPresent) { Write-Host "Verifying SuperDAT v3 EPO Download URL ..." -ForegroundColor Cyan $DownloadString = 'download.nai.com/products/datfiles/V3DAT/epoV3' $link = (Invoke-WebRequest -Uri 'https://www.mcafee.com/enterprise/en-us/downloads/security-updates.html').Links | Where-Object {$_.href -like "*$DownloadString*"} $DownloadUrl = $link.href } else { Write-Host "Verifying SuperDAT v3 EPO Download URL ..." -ForegroundColor Cyan $DownloadString = 'download.nai.com/products/datfiles/V3DAT/V3' $link = (Invoke-WebRequest -Uri 'https://www.mcafee.com/enterprise/en-us/downloads/security-updates.html').Links | Where-Object {$_.href -like "*$DownloadString*"} $DownloadUrl = $link.href } } #=================================================================================================== # Download #=================================================================================================== if ($null -eq $DownloadUrl) { Write-Warning "Could not locate a valid link ... Exiting" Break } else { Write-Host "DownloadUrl: $DownloadUrl" -ForegroundColor Cyan Write-Host "DownloadPath: $DownloadPath" -ForegroundColor Cyan Write-Host "Product: $Download" -ForegroundColor Cyan if ($Download -eq 'SuperDAT v2' -and $RenameDAT.IsPresent -and (!($EPO.IsPresent)) ) { Write-Host "RenameDAT: $DownloadPath\xdat.exe" -ForegroundColor Cyan Start-BitsTransfer -Source $DownloadUrl -Destination "$DownloadPath\xdat.exe" } elseif ($Download -eq 'SuperDAT v3' -and $RenameDAT.IsPresent -and (!($EPO.IsPresent)) ) { Write-Host "RenameDAT: $DownloadPath\DATv3.exe" -ForegroundColor Cyan Start-BitsTransfer -Source $DownloadUrl -Destination "$DownloadPath\V3_xdat.exe" } else { Start-BitsTransfer -Source $DownloadUrl -Destination "$DownloadPath" } } #=================================================================================================== # AddInstallScript #=================================================================================================== #if ($AddInstallScript.IsPresent) { # Write-Verbose "Adding $DownloadPath\OSDUpdate-McAfee.ps1" -Verbose # Copy-Item "$($MyInvocation.MyCommand.Module.ModuleBase)\Scripts\OSDUpdate-McAfee.ps1" "$DownloadPath" -Force | Out-Null #} #=================================================================================================== } |