Splunk Dev

Powershell scripting

MikeBertelsen
Communicator

Just starting to look at this but any help here is appreciated.
A coworker asked me the following:
Mike, I was trying to work on a PowerShell script I wanted to be able to query Splunk. I pulled open one of my old queries that is being utilized now as automated process to start testing and it appears even when I run that known working script I get I believe connection errors.

Invoke-HTTPPost : Exception calling "GetRequestStream" with "0" argument(s): "The operation has timed out"
At C:\Users\marks\Documents\WindowsPowerShell\Modules\Splunk\Splunk-Core\Splunk-Core.psm1:591 char:62
+ "POST" { $xml = Invoke-HTTPPost ...
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invoke-HTTPPost

Get-SplunkAuthToken : [Get-SplunkAuthToken] :: No value returned from Server [servernamehere]
At C:\Users\marks\Documents\WindowsPowerShell\Modules\Splunk\Splunk-Authentication\Splunk-Authentication.psm1:127 char:21
+ $AuthTokenObject = Get-SplunkAuthToken @GetSplunkAuthTokenParams
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Get-SplunkAuthToken

Invoke-HTTPPost : Exception calling "GetRequestStream" with "0" argument(s): "The operation has timed out"
At C:\Users\marks\Documents\WindowsPowerShell\Modules\Splunk\Splunk-Core\Splunk-Core.psm1:579 char:62
+ "POST" { $xml = Invoke-HTTPPost ...
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invoke-HTTPPost

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Thanks for the Memories! Splunk University, .conf25, and our Community

Thank you to everyone in the Splunk Community who joined us for .conf25, which kicked off with our iconic ...

Data Persistence in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. What happens if the OpenTelemetry collector ...

Introducing Splunk 10.0: Smarter, Faster, and More Powerful Than Ever

Now On Demand Whether you're managing complex deployments or looking to future-proof your data ...