├── Disk Alert Thresholds with Custom EDFs ├── Get-AutomateDiskAlerts.ps1 └── README.txt ├── Find-MicrosoftSecurityScannerViolations.ps1 ├── InstallerDetection.ps1 ├── LICENSE ├── Ninja-MusicalLock.ps1 ├── Probe - Clear Local Detection Templates └── Clear detection templates from local agent on Probe.ps1 ├── README.md ├── Remote Monitor - Powershell CPU Performance Degraded Test └── Check CPU Performance Report top 5 processes and percentage.ps1 ├── Run Script from Github.ps1 ├── Running as a user in an Automate Script ├── Example - Running as User.xml └── Example - Running as User.zip ├── SQL Snippets └── Active Directory Plugin │ ├── Delete Individual Company from Multiple Plugin_AD Tables.sql │ └── README.md ├── Security-Tests-Windows.ps1 ├── Spectre and Meltdown Solution ├── Automate Reports │ └── Spectre Meltdown Report.zip ├── Automate Scripts │ ├── Meltdown and Spectre - Detection ConnectWise Automate Script.xml │ ├── Meltdown and Spectre - Enable Hyper-V Mitigations for VMs.xml │ ├── Meltdown and Spectre - Enable Local Mitigations.xml │ └── Meltdown and Spectre - Set Allow Reg Key for Update.xml ├── DATAVIEW - Spectre and Meltdown Assessment.sql ├── README.md └── Underlying Powershell │ └── Meltdown and Spectre Detection.ps1 ├── SymantecRemoval.ps1 ├── Test.txt ├── TreeSize - Interactive HTML Reports for Disk Space Distribution ├── README.md ├── TreeSize - HTML Report to E-mail for Customer Facing Size Guide.xml └── Visible Script To Show Changes - Do Not Use.txt ├── Update-ManageContactOnConfiguration.ps1 └── Uptime Statistics Solution ├── README.md ├── Retrieve-Server-Uptime-Statistics.ps1 ├── Screenshots └── UptimeStatistics.png └── Uptime Statistics to EDF.xml /Disk Alert Thresholds with Custom EDFs/Get-AutomateDiskAlerts.ps1: -------------------------------------------------------------------------------- 1 | #Get-ThresholdPassOrFail -diskfreepercent 12 -diskfreegb 10 -testmethod 15pctfree 2 | function Get-ThresholdPassOrFail { 3 | param ( 4 | [Parameter(Mandatory=$true)] 5 | [string]$testmethod, 6 | 7 | [Parameter(Mandatory=$true)] 8 | [single]$diskfreepercent, 9 | 10 | [Parameter(Mandatory=$true)] 11 | [single]$diskfreegb 12 | ) 13 | 14 | switch ($testmethod) { 15 | 'NA' {$Result = "PASS"} 16 | '1 Percent Free' { If($diskfreepercent -le 5){$Result = "FAIL"}Else{$Result = "PASS"}} 17 | '2 Percent Free' { If($diskfreepercent -le 5){$Result = "FAIL"}Else{$Result = "PASS"}} 18 | '3 Percent Free' { If($diskfreepercent -le 5){$Result = "FAIL"}Else{$Result = "PASS"}} 19 | '4 Percent Free' { If($diskfreepercent -le 5){$Result = "FAIL"}Else{$Result = "PASS"}} 20 | '5 Percent Free' { If($diskfreepercent -le 5){$Result = "FAIL"}Else{$Result = "PASS"}} 21 | '10 Percent Free' { If($diskfreepercent -le 10){$Result = "FAIL"}Else{$Result = "PASS"}} 22 | '15 Percent Free' { If($diskfreepercent -le 15){$Result = "FAIL"}Else{$Result = "PASS"}} 23 | '20 Percent Free' { If($diskfreepercent -le 20){$Result = "FAIL"}Else{$Result = "PASS"}} 24 | '30 Percent Free' { If($diskfreepercent -le 30){$Result = "FAIL"}Else{$Result = "PASS"}} 25 | '40 Percent Free' { If($diskfreepercent -le 40){$Result = "FAIL"}Else{$Result = "PASS"}} 26 | '50 Percent Free' { If($diskfreepercent -le 50){$Result = "FAIL"}Else{$Result = "PASS"}} 27 | '60 Percent Free' { If($diskfreepercent -le 60){$Result = "FAIL"}Else{$Result = "PASS"}} 28 | '70 Percent Free' { If($diskfreepercent -le 70){$Result = "FAIL"}Else{$Result = "PASS"}} 29 | '80 Percent Free' { If($diskfreepercent -le 80){$Result = "FAIL"}Else{$Result = "PASS"}} 30 | '90 Percent Free' { If($diskfreepercent -le 90){$Result = "FAIL"}Else{$Result = "PASS"}} 31 | '1 GB Free' { If($diskfreegb -le 1){$Result = "FAIL"}Else{$Result = "PASS"}} 32 | '2 GB Free' { If($diskfreegb -le 2){$Result = "FAIL"}Else{$Result = "PASS"}} 33 | '3 GB Free' { If($diskfreegb -le 3){$Result = "FAIL"}Else{$Result = "PASS"}} 34 | '5 GB Free' { If($diskfreegb -le 4){$Result = "FAIL"}Else{$Result = "PASS"}} 35 | '10 GB Free' { If($diskfreegb -le 10){$Result = "FAIL"}Else{$Result = "PASS"}} 36 | '20 GB Free' { If($diskfreegb -le 20){$Result = "FAIL"}Else{$Result = "PASS"}} 37 | '30 GB Free' { If($diskfreegb -le 30){$Result = "FAIL"}Else{$Result = "PASS"}} 38 | '40 GB Free' { If($diskfreegb -le 40){$Result = "FAIL"}Else{$Result = "PASS"}} 39 | '50 GB Free' { If($diskfreegb -le 50){$Result = "FAIL"}Else{$Result = "PASS"}} 40 | '100 GB Free' { If($diskfreegb -le 100){$Result = "FAIL"}Else{$Result = "PASS"}} 41 | '200 GB Free' { If($diskfreegb -le 200){$Result = "FAIL"}Else{$Result = "PASS"}} 42 | '300 GB Free' { If($diskfreegb -le 300){$Result = "FAIL"}Else{$Result = "PASS"}} 43 | '400 GB Free' { If($diskfreegb -le 400){$Result = "FAIL"}Else{$Result = "PASS"}} 44 | '500 GB Free' { If($diskfreegb -le 500){$Result = "FAIL"}Else{$Result = "PASS"}} 45 | '800 GB Free' { If($diskfreegb -le 800){$Result = "FAIL"}Else{$Result = "PASS"}} 46 | '1000 GB Free' { If($diskfreegb -le 1000){$Result = "FAIL"}Else{$Result = "PASS"}} 47 | '1500 GB Free' { If($diskfreegb -le 1500){$Result = "FAIL"}Else{$Result = "PASS"}} 48 | '2000 GB Free' { If($diskfreegb -le 2000){$Result = "FAIL"}Else{$Result = "PASS"}} 49 | default { 'PASS' } 50 | } 51 | 52 | return $result 53 | 54 | } 55 | 56 | Function Get-DiskHistoryLog 57 | { 58 | param( 59 | $IndividualDisk 60 | ) 61 | $FileExists = "" 62 | 63 | $path = "C:\Windows\LTSVC\DiskHistoryLogs" 64 | If (!(test-path $path)) { 65 | New-Item -ItemType Directory -Force -Path $path | Out-Null 66 | } 67 | 68 | $TempLetterVar = $($disk.DeviceID).Replace(":","") 69 | $DiskSizeInMegabytes = $([math]::Round($Disk.size / 1024 / 1024)) 70 | 71 | $PathToIndividualGrowthLog = "C:\Windows\LTSVC\DiskHistoryLogs\$TempLetterVar-$DiskSizeInMegabytes.txt" 72 | $CurrentDateTimeCorrectFormat = Get-Date -Format "MM-dd-yyyy" 73 | $FreeSpaceToAdd = $([math]::Round($IndividualDisk.FreeSpace / 1024 / 1024 / 1024)) 74 | 75 | If(Test-Path $PathToIndividualGrowthLog ) 76 | { 77 | $FileExists = $true 78 | } 79 | else { 80 | $FileExists = $false 81 | } 82 | 83 | $DiskArray = @() 84 | if ($FileExists) { 85 | Add-Content -Path $PathToIndividualGrowthLog -Value "$CurrentDateTimeCorrectFormat,$FreeSpaceToAdd" 86 | } 87 | 88 | if (!$FileExists) { 89 | New-Item -Path $PathToIndividualGrowthLog -ItemType File | Out-Null 90 | Add-Content -Path $PathToIndividualGrowthLog -Value "$CurrentDateTimeCorrectFormat,$FreeSpaceToAdd" 91 | } 92 | 93 | $DiskHistoryLogContent = Get-Content $PathToIndividualGrowthLog 94 | 95 | $NumberOfEntries = $DiskHistoryLogContent | Measure-Object | Select-Object -ExpandProperty Count 96 | 97 | #We need another in here to actually make some progress 98 | if ($NumberOfEntries -gt 30) { 99 | if ($NumberOfEntries -lt 2100) { 100 | foreach ($Line in $DiskHistoryLogContent) { 101 | $LineData = $Line -split(',') 102 | $Date = $LineData[0] 103 | $DateConverted =[datetime]::ParseExact($Date, "MM-dd-yyyy", $null) 104 | $FreeInGigabytes = $LineData[1] 105 | 106 | $myHashtable = @{ 107 | Date = $Date 108 | FreeInGigabytes = $FreeInGigabytes 109 | DaysSince = $(New-TimeSpan -Start $DateConverted -End $(Get-Date).Date).Days 110 | } 111 | $myObject = New-Object -TypeName PSObject -Property $myHashtable 112 | $DiskArray += $myObject 113 | } 114 | } 115 | else { 116 | $FirstLine = $DiskHistoryLogContent | Select -First 1 117 | $LastLine = $DiskHistoryLogContent | Select -Last 1 118 | 119 | $FirstLineData = $FirstLine -split(',') 120 | $LastLineData = $LastLine -split(',') 121 | 122 | $FirstDate = $FirstLineData[0] 123 | $LastDate = $LastLineData[0] 124 | 125 | $FirstDateConverted =[datetime]::ParseExact($FirstDate, "MM-dd-yyyy", $null) 126 | $LastDateConverted =[datetime]::ParseExact($LastDate, "MM-dd-yyyy", $null) 127 | 128 | $FirstFreeInGigabytes = $FirstLineData[1] 129 | $LastFreeInGigabytes = $LastLineData[1] 130 | 131 | $myHashtable = @{ 132 | Date = $FirstDate 133 | FreeInGigabytes = $FirstFreeInGigabytes 134 | DaysSince = $(New-TimeSpan -Start $FirstDateConverted -End $(Get-Date).Date).Days 135 | } 136 | $myObject = New-Object -TypeName PSObject -Property $myHashtable 137 | $DiskArray += $myObject 138 | 139 | $myObject = "" 140 | $myHashtable = "" 141 | 142 | $myHashtable = @{ 143 | Date = $LastDate 144 | FreeInGigabytes = $LastFreeInGigabytes 145 | DaysSince = $(New-TimeSpan -Start $LastDateConverted -End $(Get-Date).Date).Days 146 | } 147 | $FreeInGigabytes = $LastFreeInGigabytes 148 | 149 | $myObject = New-Object -TypeName PSObject -Property $myHashtable 150 | $DiskArray += $myObject 151 | } 152 | 153 | 154 | 155 | #Get Maximum Days Value and try calculate a date 156 | $MaxDayDifference = ($DiskArray | measure-object -Property DaysSince -maximum).maximum 157 | $MinDayDifference = ($DiskArray | measure-object -Property DaysSince -Minimum).Minimum 158 | $TotalDayDifference = ($MaxDayDifference-$MinDayDifference) 159 | $FreeSpaceAtOldestDate = $DiskArray | Where-Object {$_.DaysSince -eq $MaxDayDifference} | Select-Object -first 1 -ExpandProperty FreeInGigabytes 160 | $FreeSpaceAtNewestDate = $DiskArray | Where-Object {$_.DaysSince -eq $MinDayDifference} | Select-Object -first 1 -ExpandProperty FreeInGigabytes 161 | $TotalFreeDifference = ($FreeSpaceAtOldestDate-$FreeSpaceAtNewestDate) 162 | $DailyRateOfChangeInGB = $TotalFreeDifference / $TotalDayDifference 163 | $NumberOfDaysUntilPancaked = [math]::Round($FreeInGigabytes / $DailyRateOfChangeInGB) 164 | 165 | if (($NumberOfDaysUntilPancaked -lt 1) -or ($NumberOfDaysUntilPancaked -eq [System.Double]::PositiveInfinity) -or ($NumberOfDaysUntilPancaked -eq 'NaN') ) { 166 | Return "$($TempLetterVar): Negative or No Growth" 167 | } 168 | else { 169 | try { 170 | $DateOfPancake = (Get-Date).AddDays($NumberOfDaysUntilPancaked) 171 | Return "$($TempLetterVar): Date Full: $DateOfPancake" 172 | } 173 | catch { 174 | Return "$($TempLetterVar): Unknown date when full" 175 | } 176 | 177 | } 178 | } 179 | else { 180 | Return "$($TempLetterVar): Not Enough Data Points Yet" 181 | } 182 | 183 | } 184 | 185 | Function Get-DiskAlerts 186 | { 187 | param( 188 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] 189 | [AllowEmptyString()] 190 | [string]$diska, 191 | 192 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] 193 | [AllowEmptyString()] 194 | [string]$diskb, 195 | 196 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] 197 | [AllowEmptyString()] 198 | [string]$diskc, 199 | 200 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] 201 | [AllowEmptyString()] 202 | [string]$diskd, 203 | 204 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] 205 | [AllowEmptyString()] 206 | [string]$diske, 207 | 208 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] 209 | [AllowEmptyString()] 210 | [string]$diskf, 211 | 212 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] 213 | [AllowEmptyString()] 214 | [string]$diskg, 215 | 216 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] 217 | [AllowEmptyString()] 218 | [string]$diskh, 219 | 220 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] 221 | [AllowEmptyString()] 222 | [string]$diski, 223 | 224 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] 225 | [AllowEmptyString()] 226 | [string]$diskj, 227 | 228 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] 229 | [AllowEmptyString()] 230 | [string]$diskk, 231 | 232 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] 233 | [AllowEmptyString()] 234 | [string]$diskl, 235 | 236 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] 237 | [AllowEmptyString()] 238 | [string]$diskm, 239 | 240 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] 241 | [AllowEmptyString()] 242 | [string]$diskn, 243 | 244 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] 245 | [AllowEmptyString()] 246 | [string]$disko, 247 | 248 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] 249 | [AllowEmptyString()] 250 | [string]$diskp, 251 | 252 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] 253 | [AllowEmptyString()] 254 | [string]$diskq, 255 | 256 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] 257 | [AllowEmptyString()] 258 | [string]$diskr, 259 | 260 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] 261 | [AllowEmptyString()] 262 | [string]$disks, 263 | 264 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] 265 | [AllowEmptyString()] 266 | [string]$diskt, 267 | 268 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] 269 | [AllowEmptyString()] 270 | [string]$disku, 271 | 272 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] 273 | [AllowEmptyString()] 274 | [string]$diskv, 275 | 276 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] 277 | [AllowEmptyString()] 278 | [string]$diskw, 279 | 280 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] 281 | [AllowEmptyString()] 282 | [string]$diskx, 283 | 284 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] 285 | [AllowEmptyString()] 286 | [string]$disky, 287 | 288 | [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] 289 | [AllowEmptyString()] 290 | [string]$diskz, 291 | 292 | [Parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true)] 293 | [AllowEmptyString()] 294 | [string]$IgnoreRemovable, 295 | 296 | [Parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true)] 297 | [AllowEmptyString()] 298 | [string]$IgnoreNetworkDrive, 299 | 300 | [Parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true)] 301 | [AllowEmptyString()] 302 | [string]$IgnoreCD, 303 | 304 | [Parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true)] 305 | [AllowEmptyString()] 306 | [string]$IgnoreFixedDisks 307 | ) 308 | 309 | # Give us a way to exclude certain drive types 310 | $DrivesToMonitorArray = @() 311 | 312 | if ($IgnoreRemovable -eq "Yes") { 313 | $DrivesToMonitorArray += 2 314 | } 315 | 316 | if ($IgnoreNetworkDrive -eq "Yes") { 317 | $DrivesToMonitorArray += 4 318 | } 319 | 320 | if ($IgnoreCD -eq "Yes") { 321 | $DrivesToMonitorArray += 5 322 | } 323 | 324 | if ($IgnoreFixedDisks -eq "Yes") { 325 | $DrivesToMonitorArray += 3 326 | } 327 | 328 | $DisksWMI = get-WmiObject win32_logicaldisk | Where-Object {$DrivesToMonitorArray -notcontains $_.DriveType} 329 | 330 | if (($DisksWMI | Measure-Object | Select-Object -ExpandProperty Count) -eq 0) { 331 | Write-Output "No disks found to monitor" 332 | } 333 | 334 | $ResultArray = @() 335 | $HistoryLogArray = @() 336 | 337 | foreach ($disk in $diskswmi) 338 | { 339 | $DiskPercentageFree = "" 340 | $DiskFreeGB = "" 341 | $DiskUsedActual = "" 342 | $TempLetterVar = "" 343 | $TestFinal = "" 344 | $ErrorToDisplay = "" 345 | 346 | $DiskUsedActual = $disk.size - $disk.FreeSpace 347 | 348 | if ($Disk.FreeSpace -gt 0) { 349 | $DiskPercentageFree = [math]::Round(($Disk.FreeSpace / $disk.size) * 100) 350 | } 351 | else { 352 | $DiskPercentageFree = 0.1 353 | } 354 | 355 | $DiskFreeGB = $([math]::Round($Disk.FreeSpace / 1024 / 1024 / 1024)) 356 | $TempLetterVar = $($disk.DeviceID).Replace(":","") 357 | $ToUse = Get-Variable "disk$TempLetterVar" -ValueOnly 358 | 359 | $TestFinal = Get-ThresholdPassOrFail -testmethod $ToUse -diskfreepercent $DiskPercentageFree -diskfreegb $DiskFreeGB 360 | 361 | $HistoryLogReturn = Get-DiskHistoryLog -IndividualDisk $disk 362 | $HistoryLogArray += $HistoryLogReturn 363 | 364 | if ($TestFinal -eq 'PASS') { 365 | $ResultArray += "$($Disk.DeviceID) - $TestFinal" 366 | } 367 | else { 368 | if ($ToUse -match 'gb') { 369 | $ErrorToDisplay = "Disk Free Space $DiskFreeGB GB" 370 | } 371 | else { 372 | $ErrorToDisplay = "Disk Free Percentage $DiskPercentageFree" 373 | } 374 | 375 | $ResultArray += "$($Disk.DeviceID) - $TestFinal - EDF Threshold Is $ToUse - $ErrorToDisplay" 376 | } 377 | } 378 | 379 | #Build Final Result 380 | $ResultArrayFinal = ($ResultArray) -join "," 381 | $HistoryLogFinal = ($HistoryLogArray) -join "," 382 | Return "$ResultArrayFinal ||| $HistoryLogFinal" 383 | 384 | } 385 | 386 | # Test Command 387 | #Get-DiskAlerts -diska "a" -diskb "b" -diskc "100 GB Free" -diskd "d" -diske "e" -diskf "f" -diskg "g" -diskh "h" -diski "i" -diskj "j" -diskk "k" -diskl "l" -diskm "m" -diskn "n" -disko "o" -diskp "p" -diskq "q" -diskr "r" -disks "s" -diskt "t" -disku "u" -diskv "v" -diskw "w" -diskx "x" -disky "y" -diskz "z" -------------------------------------------------------------------------------- /Disk Alert Thresholds with Custom EDFs/README.txt: -------------------------------------------------------------------------------- 1 | DO NOT USE! STILL BEING DEVELOPED! -------------------------------------------------------------------------------- /Find-MicrosoftSecurityScannerViolations.ps1: -------------------------------------------------------------------------------- 1 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 2 | 3 | $EXEPath = "$Env:Temp\MSERT.exe" 4 | 5 | function Get-MSERTExecutable { 6 | if (Test-Path $EXEPath) { 7 | # Delete the previous executable if it exists 8 | try { 9 | Write-Debug "Attempting to delete $EXEPath" 10 | Remove-Item $EXEPath -Force -ErrorAction Stop 11 | } 12 | catch { 13 | Write-Output "ERROR: Unable to delete $EXEPath, script terminating with error $($_.Exception.Message)" 14 | throw 15 | } 16 | 17 | } 18 | else { 19 | Write-Debug "EXE does not exist in $EXEPath - continuing" 20 | } 21 | 22 | # Get the download 23 | Invoke-WebRequest -Uri 'https://go.microsoft.com/fwlink/?LinkId=212732' -OutFile $EXEPath 24 | } 25 | 26 | function Remove-MSERTDebugLog { 27 | if (Test-Path 'C:\Windows\Debug\msert.log') { 28 | try { 29 | Write-Debug "Attempting to delete C:\Windows\Debug\msert.log" 30 | Remove-Item 'C:\Windows\Debug\msert.log' -Force -ErrorAction Stop 31 | } 32 | catch { 33 | Write-Output "ERROR: Unable to delete the msert.log file, scripting terminating with error $($_.Exception.Message)" 34 | throw 35 | } 36 | } 37 | } 38 | 39 | function Remove-MSERTExecutable { 40 | if (Test-Path $EXEPath) { 41 | try { 42 | Write-Debug "Attempting to delete $EXEPath" 43 | Remove-Item $EXEPath -Force -ErrorAction Stop 44 | } 45 | catch { 46 | Write-Output "ERROR: Unable to delete $EXEPath, script terminating with error $($_.Exception.Message)" 47 | throw 48 | } 49 | 50 | } 51 | } 52 | 53 | function Start-MSERTScanner { 54 | $Arguments = "/Q /N" 55 | $proc = Start-Process $EXEPath $Arguments -PassThru 56 | try { 57 | $proc | Wait-Process -Timeout 1800 -ErrorAction Stop 58 | } 59 | catch [TimeoutException] { 60 | Write-Error -Message "WARNING: Microsoft security scanner took longer than 30 minutes so script terminated: $($_.Exception.Message)" -Exception $_.Exception 61 | throw 62 | } 63 | Write-Debug "MSERT Scanner has finished" 64 | } 65 | 66 | function Test-MSERTLog { 67 | $LogFile = Get-Content 'C:\Windows\debug\msert.log' 68 | 69 | if ($LogFile -like '*No Infection found.*') { 70 | $ScriptNoInfectionsFound = $true 71 | } 72 | else { 73 | $ScriptNoInfectionsFound = $false 74 | } 75 | 76 | if ($ScriptNoInfectionsFound) { 77 | return "SUCCESS: No infection found $($LogFile)" 78 | } 79 | else { 80 | return "CRITICAL: Potential Infections found. $($LogFile)" 81 | } 82 | } 83 | 84 | Get-MSERTExecutable 85 | Remove-MSERTDebugLog 86 | Start-MSERTScanner 87 | Test-MSERTLog 88 | Remove-MSERTExecutable 89 | -------------------------------------------------------------------------------- /InstallerDetection.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | WPF Application to analyze an installer and determine its packaging technology and subsequently its silent switches. 4 | 5 | .DESCRIPTION 6 | This script creates a WPF GUI application that lets the user select an executable or MSI file. 7 | It then analyzes the file to detect the installer type and displays the result along with 8 | the silent install switches for that installer type. 9 | 10 | .NOTES 11 | Author: Gavin Stone + OpenAI's ChatGPT 12 | Date: 7th October 2024 13 | #> 14 | 15 | Add-Type -AssemblyName PresentationFramework 16 | 17 | # XAML UI Definition 18 | $XAML = @" 19 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 |