From fbca81dc097e010856e520355a2325bd685c84bb Mon Sep 17 00:00:00 2001 From: Ben Newton Date: Mon, 20 Jun 2022 10:59:05 +0100 Subject: [PATCH] Adding Windows Automation Similar to the wrapping of the ERB script for Linux. Not sure if this is the best location for the script, but the alternative was an unattributed Gist! --- .../Nightly-Installers.md | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/docs/metasploit-framework.wiki/Nightly-Installers.md b/docs/metasploit-framework.wiki/Nightly-Installers.md index 26e09ccfdd3e..8deca7f8099b 100644 --- a/docs/metasploit-framework.wiki/Nightly-Installers.md +++ b/docs/metasploit-framework.wiki/Nightly-Installers.md @@ -30,6 +30,33 @@ Download the [latest Windows installer](https://windows.metasploit.com/metasploi If you downloaded Metasploit from us, there is no cause for alarm. We pride ourselves on offering the ability for our customers and followers to have the same toolset that the hackers have so that they can test systems more accurately. Because these (and the other exploits and tools in Metasploit) are identical or very similar to existing malicious toolsets, they can be used for nefarious purposes, and they are often flagged and automatically removed by antivirus programs, just like the malware they mimic. +## Windows Installation (Silent) + +The PowerShell below will download and install the framework, and is suitable for automated Windows deployments. +``` +[CmdletBinding()] +Param( + $DownloadURL = "https://windows.metasploit.com/metasploitframework-latest.msi", + $DownloadLocation = "$env:APPDATA/Metasploit", + $InstallLocation = "C:\Tools", + $LogLocation = "$DownloadLocation/install.log" +) + +If(! (Test-Path $DownloadLocation) ){ + New-Item -Path $DownloadLocation -ItemType Directory +} + +If(! (Test-Path $InstallLocation) ){ + New-Item -Path $InstallLocation -ItemType Directory +} + +$Installer = "$DownloadLocation/metasploit.msi" + +Invoke-WebRequest -UseBasicParsing -Uri $DownloadURL -OutFile $Installer + +& $Installer /q /log $LogLocation INSTALLLOCATION="$InstallLocation" +``` + ## Improving these installers Feel free to review and help improve [the source code for our installers](https://github.com/rapid7/metasploit-omnibus).