Skip to content

Commit

Permalink
Updated $Report parameter
Browse files Browse the repository at this point in the history
Changed [switch] to [string] input
  • Loading branch information
n03lx committed Jul 23, 2015
1 parent 7406673 commit 692915a
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions Invoke-EgressAssess.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function Invoke-EgressAssess
[Parameter(Mandatory = $False)]
[int]$Loops = 1,
[Parameter(Mandatory = $False)]
[switch]$Report
[string]$Report
)

begin
Expand Down Expand Up @@ -1014,9 +1014,8 @@ function Invoke-EgressAssess
function Write-Report
{
Write-Verbose "[*] Building Report"
Write-Output "----------Egress-Assess Report----------"
$ReportFile = "C:\Egress-Assess\report.txt"
Write-Output "Report File = $ReportFile"
Write-Verbose "----------Egress-Assess Report----------"
Write-Verbose "Report File = $Report"
$EAreport = [ordered]@{
"Server"=$IP
"Datatype"=$datatype.toUpper()
Expand All @@ -1026,12 +1025,20 @@ function Invoke-EgressAssess
"Time (seconds)"=[Math]::Round($(($endTime-$startTime).totalseconds),2)
"Date" = Get-Date
}
if((Test-Path -path $ReportFile) -eq $False)
try
{
New-Item "C:\Egress-Assess" -Type Directory -Force
$null > $ReportFile
} else {}
Write-Output $EAreport | Format-Table | Tee-Object -file $ReportFile -Append
if((Test-Path -path $Report) -eq $False)
{
Write-Verbose "[*] Writing new report file..."
$null > $Report
} else {}
Write-Output $EAreport | Format-Table | Tee-Object -file $Report -Append
}
catch
{
Write-Verbose "You do not have permission to write to this directory."
break
}
}

}
Expand Down Expand Up @@ -1080,7 +1087,7 @@ function Invoke-EgressAssess
#get end time
$endTime = (Get-Date)

if($Report -eq $true)
if($Report -gt 0)
{
Write-Report
} else {}
Expand Down

0 comments on commit 692915a

Please sign in to comment.