Skip to content

Commit 508911c

Browse files
authored
Update script 📫
1 parent df78dbe commit 508911c

1 file changed

Lines changed: 6 additions & 17 deletions

File tree

Powershell/Invoke-SCXWinRMEnumeration.ps1

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ param
6464
[Parameter(HelpMessage = 'You can provide the credentials to utilize for the WinRM commands.')]
6565
[PSCredential]$Credential,
6666
[Parameter(HelpMessage = 'Output type for the results. Valid values are CSV and Text.')]
67-
[ValidateSet('CSV', 'Text')]
68-
[string[]]$OutputType,
67+
[ValidateSet('CSV', 'Text', 'None')]
68+
[string[]]$OutputType = 'None',
6969
[Parameter(HelpMessage = 'Output file path for the results.')]
7070
[string]$OutputFile,
7171
[Parameter(HelpMessage = 'Do not Write-Host and pass through the Object data.')]
@@ -90,25 +90,14 @@ function Invoke-SCXWinRMEnumeration
9090
[Parameter(HelpMessage = 'You can provide the credentials to utilize for the WinRM commands.')]
9191
[PSCredential]$Credential,
9292
[Parameter(HelpMessage = 'Output type for the results. Valid values are CSV and Text.')]
93-
[ValidateSet('CSV', 'Text')]
94-
[string[]]$OutputType,
93+
[ValidateSet('CSV', 'Text', 'None')]
94+
[string[]]$OutputType = 'None',
9595
[Parameter(HelpMessage = 'Output file path for the results.')]
9696
[string]$OutputFile,
9797
[Parameter(HelpMessage = 'Do not Write-Host and pass through the Object data.')]
9898
[switch]$PassThru
9999
)
100100

101-
if ($OutputFile -and -not $OutputType)
102-
{
103-
Write-Warning "The -OutputType parameter is required."
104-
return
105-
}
106-
elseif (-NOT $OutputFile -and $OutputType)
107-
{
108-
Write-Warning "The -OutputFile parameter is required."
109-
return
110-
}
111-
112101
if ($AuthenticationMethod -eq '' -or -NOT $AuthenticationMethod)
113102
{
114103
try
@@ -266,15 +255,15 @@ function Invoke-SCXWinRMEnumeration
266255
Write-Host "$OutputPath" -ForegroundColor Yellow
267256
}
268257
}
269-
else
258+
if ($OutputType -ne 'Text' -and $OutputType -ne 'CSV')
270259
{
271260
$results
272261
}
273262
return
274263
}
275264
if ($Servers -or $ComputerName -or $Password)
276265
{
277-
Invoke-SCXWinRMEnumeration -ComputerName $ComputerName -Credential:$Credential -UserName $UserName -Password $Password -AuthenticationMethod $AuthenticationMethod -Classes $Classes -EnumerateAllClasses:$EnumerateAllClasses -OutputType $OutputType -OutputFile $OutputFile -PassThru:$PassThru
266+
Invoke-SCXWinRMEnumeration -ComputerName $ComputerName -Credential:$Credential -UserName $UserName -Password $Password -AuthenticationMethod $AuthenticationMethod -Classes $Classes -EnumerateAllClasses:$EnumerateAllClasses -OutputType:$OutputType -OutputFile $OutputFile -PassThru:$PassThru
278267
}
279268
else
280269
{

0 commit comments

Comments
 (0)