Skip to content

Latest commit

 

History

History
124 lines (92 loc) · 5.92 KB

File metadata and controls

124 lines (92 loc) · 5.92 KB

Test-PathUsingWindowsDefender

SubModule: GenXdev.Windows | Type: Cmdlet | Aliases: virusscan, HasNoVirus

Synopsis

Scans files or directories for malware using Windows Defender.

Description

  • Performs a targeted scan of specified files or directories using Windows Defender's command-line interface (MpCmdRun.exe).
  • Can scan in detection-only mode or with automatic threat remediation enabled.
  • Returns true if no threats are detected, false if threats are found or the scan fails.

Syntax

Test-PathUsingWindowsDefender -FilePath <String> [-EnableRemediation] [<CommonParameters>]

Parameters

Name Type Required Description
-FilePath String The path to the file or directory to be
scanned
-EnableRemediation SwitchParameter Instructs Windows Defender to take action on
threats

Examples

Test-PathUsingWindowsDefender -FilePath "C:\Downloads\file.exe" -Verbose

Scans the specified file and displays verbose output.

virusscan "C:\Downloads\file.exe" -EnableRemediation

Scans the file using the alias and enables remediation.

"C:\Downloads\file.exe" | HasNoVirus

Pipes the file path to the cmdlet using an alias.

Parameter Details

-FilePath <String>

The path to the file or directory to be scanned

Property Value
Required? Yes
Position? 0
Default value (none)
Accept pipeline input? True (ByValue, ByPropertyName)
Aliases (none)
Accept wildcard characters? No

-EnableRemediation

Instructs Windows Defender to take action on threats

Property Value
Required? No
Position? Named
Default value False
Accept pipeline input? False
Aliases (none)
Accept wildcard characters? No

Related Links