< Back

Invoke-Nmap

Sat Jan 18, 2020 8:22 pm

NAME Invoke-Nmap



SYNOPSIS

Runs the NMAP command and then formats the output.





SYNTAX

Invoke-Nmap [[-computerName] <String[]>] [-Preset <String>] [-OutFormat <String>] [-All] [-Snmp]

[-snmpCommunityList <String[]>] [<CommonParameters>]



Invoke-Nmap [[-computerName] <String[]>] [-ArgumentList] <String[]> [-OutFormat <String>] [-All] [-Snmp]

[-snmpCommunityList <String[]>] [<CommonParameters>]





DESCRIPTION





PARAMETERS

-computerName <String[]>

A list of nmap host specifications. Defaults to localhost



Required? false

Position? 1

Default value localhost

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-ArgumentList <String[]>

Specify raw argument parameters to nmap



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Preset <String>



Required? false

Position? named

Default value Quick

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-OutFormat <String>

Choose which format for the output (XML, JSON, HashTable, PSObject, or Raw). Default is PSObject



Required? false

Position? named

Default value PoshNmap

Accept pipeline input? false

Accept wildcard characters? false



-All [<SwitchParameter>]

Show all results, not just online hosts



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Snmp [<SwitchParameter>]

Perform an SNMP community scan. This is also done automatically with the "snmp" preset



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-snmpCommunityList <String[]>

A list of SNMP communities to scan. Defaults to public and private



Required? false

Position? named

Default value @("public","private")

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

[String[]]$ComputerName





OUTPUTS

Depends on -OutFormat parameter





-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Invoke-Nmap scanme.nmap.org



Runs an NMAP scan with the Quick scan preset and provides the result as a formatted Powershell Object









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Invoke-Nmap scanme.nmap.org "-t4 -p 80,443"



This is similar to running nmap "bare" but enjoy the format processing of invoke-nmap











RELATED LINKS