Skip to content

Commit

Permalink
Update script - v1.5 🦫
Browse files Browse the repository at this point in the history
  • Loading branch information
blakedrumm authored Mar 19, 2024
1 parent d3bdfb9 commit 37a23c2
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions Powershell/Invoke-SCXWinRMEnumeration.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
.NOTES
Author: Blake Drumm
Version: 1.4
Version: 1.5
Created: November 17th, 2023
Modified: March 18th, 2024
#>
Expand Down Expand Up @@ -540,15 +540,9 @@ function Invoke-SCXWinRMEnumeration
# Output handling
if ($OutputType -eq 'CSV')
{
if ($OutputType -match 'Text')
{
$ParentDirectory = Split-Path $OutputFile
$OutputPath = "$ParentDirectory\$([System.IO.Path]::GetFileNameWithoutExtension($OutputFile)).csv"
}
else
{
$OutputPath = $OutputFile
}
$ParentDirectory = Split-Path $OutputFile
$OutputPath = "$ParentDirectory\$([System.IO.Path]::GetFileNameWithoutExtension($OutputFile)).csv"

if ($results -match "Error for")
{
$results | Out-File -FilePath $OutputPath -ErrorAction Stop
Expand All @@ -565,15 +559,9 @@ function Invoke-SCXWinRMEnumeration
}
if ($OutputType -eq 'Text')
{
if ($OutputType -match 'CSV')
{
$ParentDirectory = Split-Path $OutputFile
$OutputPath = "$ParentDirectory\$([System.IO.Path]::GetFileNameWithoutExtension($OutputFile)).txt"
}
else
{
$OutputPath = $OutputFile
}
$ParentDirectory = Split-Path $OutputFile
$OutputPath = "$ParentDirectory\$([System.IO.Path]::GetFileNameWithoutExtension($OutputFile)).txt"

$results | Out-File -FilePath $OutputPath -ErrorAction Stop
if (-NOT $PassThru)
{
Expand Down

0 comments on commit 37a23c2

Please sign in to comment.