Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 37a23c2

Browse files
authored
Update script - v1.5 🦫
1 parent d3bdfb9 commit 37a23c2

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

Powershell/Invoke-SCXWinRMEnumeration.ps1

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
4949
.NOTES
5050
Author: Blake Drumm
51-
Version: 1.4
51+
Version: 1.5
5252
Created: November 17th, 2023
5353
Modified: March 18th, 2024
5454
#>
@@ -540,15 +540,9 @@ function Invoke-SCXWinRMEnumeration
540540
# Output handling
541541
if ($OutputType -eq 'CSV')
542542
{
543-
if ($OutputType -match 'Text')
544-
{
545-
$ParentDirectory = Split-Path $OutputFile
546-
$OutputPath = "$ParentDirectory\$([System.IO.Path]::GetFileNameWithoutExtension($OutputFile)).csv"
547-
}
548-
else
549-
{
550-
$OutputPath = $OutputFile
551-
}
543+
$ParentDirectory = Split-Path $OutputFile
544+
$OutputPath = "$ParentDirectory\$([System.IO.Path]::GetFileNameWithoutExtension($OutputFile)).csv"
545+
552546
if ($results -match "Error for")
553547
{
554548
$results | Out-File -FilePath $OutputPath -ErrorAction Stop
@@ -565,15 +559,9 @@ function Invoke-SCXWinRMEnumeration
565559
}
566560
if ($OutputType -eq 'Text')
567561
{
568-
if ($OutputType -match 'CSV')
569-
{
570-
$ParentDirectory = Split-Path $OutputFile
571-
$OutputPath = "$ParentDirectory\$([System.IO.Path]::GetFileNameWithoutExtension($OutputFile)).txt"
572-
}
573-
else
574-
{
575-
$OutputPath = $OutputFile
576-
}
562+
$ParentDirectory = Split-Path $OutputFile
563+
$OutputPath = "$ParentDirectory\$([System.IO.Path]::GetFileNameWithoutExtension($OutputFile)).txt"
564+
577565
$results | Out-File -FilePath $OutputPath -ErrorAction Stop
578566
if (-NOT $PassThru)
579567
{

0 commit comments

Comments
 (0)