Skip to content

Instantly share code, notes, and snippets.

@MXP2095onetechguy
Created August 30, 2023 13:17
Show Gist options
  • Select an option

  • Save MXP2095onetechguy/ac15d355a01c56a422b0375a3145219e to your computer and use it in GitHub Desktop.

Select an option

Save MXP2095onetechguy/ac15d355a01c56a422b0375a3145219e to your computer and use it in GitHub Desktop.
Batch script for automating MSERT downloads.
@echo off
rem Amsert
rem Auto MSERT
rem Auto MSERT for doing its job automatically for you
rem Pronounced as ("Am" as in "I am") and ("sert" as "sir" with a "t" or "sert" as in "assert"), or you can just pronounce it as "I Am Sirt" but without the "I" and no space between "Am" and the "Sirt" here. Or just the easy way as "I Am Assert" but without the "I" and that "as" in the "assert" along with no spaces between the "Am" and the "Sert" here. So basically Am-Sert is how you pronounced it, not "A-M-Sert" you slagfish.
rem
rem That one tool made in batch script for you lazy people of slags
rem
rem Batch becuz its EZ to run (and hard to write)
rem Not powershell mainly becuz you need to do hell's work to get it to run any random ps1 script
rem You see, you need to enable/disable some policy in powershell in order for it to be able to run ps1 scripts
rem Or else, it won't and refuse to do so
rem
rem It downloads Microsoft's safety scanner and runs it automatically
rem Microsoft's safety scanner is AKA MSERT
rem MXPSQL wrote and authored this batch script
rem
rem And slag here you can interpret that as (one word that ends with got and starts with f, rhyms with biggot) or molten metal thing slag
rem Whichever you choose do not be offended
rem Because this insults you like a gay person or liquid metal thing waste
rem
rem And this output messages and its choice of wording is not professional, and just for fun because I feel like thinking about british fa**ots.
rem Along with the fact that this looks like sphagetti for the code and bad batch coding standards. But I developed this on my own.
rem I really censored that one cuz word censor magicky whichmajig thingies may do the scunthrope problem way and blit that out of existence.
rem Because MSERT expires after 10 days, it's painful to have to download MSERT every 10 days.
rem And so I invented this to solve that problem (that may not even exist) by automating the process
rem And that I developed this script's original functionality within 2 hours in a day at night in Indonesia at August 30, 2023. Around 7 to 8 pm.
rem
rem
rem It shall be licensed under the Gnu All-Permissive License (FSFAP) for this shall be FOSS
rem Copyright 2023, MXPSQL
rem
rem Copying and distribution of this file, with or without modification, are permitted in any medium without royalty, provided the copyright notice and this notice are rem preserved. This file is offered as-is, without any warranty.
rem Prepare
SETLOCAL EnableDelayedExpansion
rem Declare
set msert3="https://go.microsoft.com/fwlink/?LinkId=212733"
set msert6="https://go.microsoft.com/fwlink/?LinkId=212732"
set mserto="msert.exe"
rem Intro
echo Amsert
echo That one tool for you lazy people
echo It downloads Microsoft's safety scanner and runs it automatically
echo Written by MXPSQL
goto :BITS
rem Bit Parsing
:BITS
set /p bits="32 bits or 64 bits you would Like? Or don't and quit? [3/6/q]
if "!bits!"=="3" (echo "32 Bits" && goto :TOOL)
if "!bits!"=="6" (echo "64 Bits" && goto :TOOL)
if "!bits!"=="q" (goto :EOF)
echo "You Slag" && goto :EOF
rem Tool parsing
:TOOL
set /p tool="Powershell or pwsh for downloading? [p/s]"
if "!tool!"=="p" (echo "Powershell tool" && set tool=powershell && goto :DL)
if "!tool!"=="s" (echo "Pwsh tool" && set tool=pwsh && goto :DL)
echo "You Slag" && goto :EOF
rem Download the tool
:DL
echo DownLoading Microsoft Safety Scanner of bits of !bits! by !tool!
if "!bits!"=="3" (!tool! -Command "Invoke-WebRequest !msert3! -OutFile !mserto!" && goto :INVOKERM)
if "!bits!"=="6" (!tool! -Command "Invoke-WebRequest !msert6! -OutFile !mserto!" && goto :INVOKERM)
echo "I am the slag" && goto :EOF
rem Invocation and running of tool and finally delting it
:INVOKERM
!mserto!
del !mserto!
echo "AMSERT End of Execution"
pause
goto :EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment