Security Essentials
| 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021 022 023
| #Requires -version 2.0 ## wrapper functions for Microsoft Security Essentials $mse = "C:\Program Files\Microsoft Security Essentials\MpCmdRun.exe" function Start-Scan{ param ([int]$type = 1) switch ($type){ 0 { Write-Host "Starting Scan based on configuration" & $mse -scan -scantype 0 break } 1 { Write-Host "Starting Quick Scan" & $mse -scan -scantype 1 break } 2 { Write-Host "Starting Full Scan" & $mse -scan -scantype 2 break } } } |
During my enforced break from posting in September & October PowerShell v2 was released for down level systems including Vista, Windows 2008, Windows 2003 and XP. I’ve set up an XP machine to try it on and needed some AV. Not having licenses left for AVG which is my current AV product I decided to try Microsoft Security Essentials as well (its free which is always a good point for test machines)
Security Essentials comes with a command line tool – but its not PowerShell. I can get two wins here by creating a module that wraps the mpcmdrun tool in PowerShell. It is also a good example of how to run a legacy command line tool within PowerShell and pass parameters to it.
This function is the start – need to perform a scan – its easier to remember start-scan than the syntax of mpcmdrun. I’ll can refine this by testing the range of the parameter and adding more functions.