Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- setlocal enabledelayedexpansion
- echo Windows Defender Signature Downloader (Windows 10)
- echo ==================================================
- echo This script downloads signature updates to network share
- echo.
- :: Define network paths
- set "SHARE_X86=[ENTER FILE LOCATION]"
- set "SHARE_X64=[ENTER FILE LOCATION]"
- set "FILE_X86=!SHARE_X86!mpam-fe.exe"
- set "FILE_X64=!SHARE_X64!mpam-fe.exe"
- :: Define download URLs
- set "URL_X86=https://go.microsoft.com/fwlink/?LinkID=121721&arch=x86"
- set "URL_X64=https://go.microsoft.com/fwlink/?LinkID=121721&arch=x64"
- echo Network Share Paths:
- echo - x86: !SHARE_X86!
- echo - x64: !SHARE_X64!
- echo.
- :: Step 1: Check network connectivity
- echo Step 1: Checking network connectivity...
- if not exist "!SHARE_X86!" (
- echo ERROR: Cannot access x86 network share: !SHARE_X86!
- echo Please check network connectivity and share permissions
- pause
- exit /b 1
- )
- if not exist "!SHARE_X64!" (
- echo ERROR: Cannot access x64 network share: !SHARE_X64!
- echo Please check network connectivity and share permissions
- pause
- exit /b 1
- )
- echo ✓ Network shares accessible
- echo.
- :: Step 2: Delete existing files if they exist
- echo Step 2: Checking for existing files...
- if exist "!FILE_X86!" (
- echo Found existing x86 file: !FILE_X86!
- echo Deleting existing x86 file...
- del "!FILE_X86!"
- if !errorlevel! neq 0 (
- echo ERROR: Failed to delete x86 file
- pause
- exit /b 1
- )
- echo ✓ x86 file deleted successfully
- ) else (
- echo ✓ No existing x86 file found
- )
- if exist "!FILE_X64!" (
- echo Found existing x64 file: !FILE_X64!
- echo Deleting existing x64 file...
- del "!FILE_X64!"
- if !errorlevel! neq 0 (
- echo ERROR: Failed to delete x64 file
- pause
- exit /b 1
- )
- echo ✓ x64 file deleted successfully
- ) else (
- echo ✓ No existing x64 file found
- )
- echo Step 2 Complete: File cleanup finished
- echo.
- :: Step 3: Download x86 version
- echo Step 3: Downloading x86 version...
- echo URL: !URL_X86!
- echo Destination: !FILE_X86!
- powershell -Command "& {[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $ProgressPreference = 'SilentlyContinue'; try { Invoke-WebRequest -Uri '!URL_X86!' -OutFile '!FILE_X86!' -MaximumRedirection 10 -UserAgent 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36' } catch { Write-Host 'Download failed:' $_.Exception.Message; exit 1 } }"
- if !errorlevel! neq 0 (
- echo ERROR: x86 download failed
- pause
- exit /b 1
- )
- if not exist "!FILE_X86!" (
- echo ERROR: x86 file not found after download
- pause
- exit /b 1
- )
- :: Check file size
- for %%A in ("!FILE_X86!") do set "X86_SIZE=%%~zA"
- if !X86_SIZE! LSS 1000 (
- echo WARNING: x86 file seems too small (!X86_SIZE! bytes)
- echo This might indicate a download error
- )
- echo ✓ x86 download completed successfully (Size: !X86_SIZE! bytes)
- echo Step 3 Complete: x86 version downloaded
- echo.
- :: Step 4: Download x64 version
- echo Step 4: Downloading x64 version...
- echo URL: !URL_X64!
- echo Destination: !FILE_X64!
- powershell -Command "& {[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $ProgressPreference = 'SilentlyContinue'; try { Invoke-WebRequest -Uri '!URL_X64!' -OutFile '!FILE_X64!' -MaximumRedirection 10 -UserAgent 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36' } catch { Write-Host 'Download failed:' $_.Exception.Message; exit 1 } }"
- if !errorlevel! neq 0 (
- echo ERROR: x64 download failed
- pause
- exit /b 1
- )
- if not exist "!FILE_X64!" (
- echo ERROR: x64 file not found after download
- pause
- exit /b 1
- )
- :: Check file size
- for %%A in ("!FILE_X64!") do set "X64_SIZE=%%~zA"
- if !X64_SIZE! LSS 1000 (
- echo WARNING: x64 file seems too small (!X64_SIZE! bytes)
- echo This might indicate a download error
- )
- echo ✓ x64 download completed successfully (Size: !X64_SIZE! bytes)
- echo Step 4 Complete: x64 version downloaded
- echo.
- :: Step 5: Final verification
- echo Step 5: Final verification...
- echo.
- echo Download Summary:
- echo =================
- echo x86 file: !FILE_X86!
- echo Size: !X86_SIZE! bytes
- echo Status:
- if exist "!FILE_X86!" (
- echo ✓ Present
- ) else (
- echo ✗ Missing
- )
- echo.
- echo x64 file: !FILE_X64!
- echo Size: !X64_SIZE! bytes
- echo Status:
- if exist "!FILE_X64!" (
- echo ✓ Present
- ) else (
- echo ✗ Missing
- )
- echo.
- echo =================
- echo Final Status:
- if exist "!FILE_X86!" if exist "!FILE_X64!" (
- echo ✓ SUCCESS: Both files downloaded successfully
- echo.
- echo The signature update files are now available on the network share
- echo Windows 7 clients can now run Script 2 to update their signatures
- echo.
- echo Network paths for clients:
- echo - 32-bit systems: !SHARE_X86!mpam-fe.exe
- echo - 64-bit systems: !SHARE_X64!mpam-fe.exe
- ) else (
- echo ✗ FAILURE: One or more downloads failed
- echo Please check the error messages above and retry
- )
- echo.
- echo Download process completed
- echo Current timestamp: %DATE% %TIME%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement