Splunk Search

| metadata with powershell Search-Splunk command

dchallis2017
New Member

I am trying to run the following search, which works fine from the regular Splunk search UI, but not in the Powershell interface...

| metadata type=hosts earliest=-1d

Using the Search_Splunk command I get...

Error in 'metadata' command: This command must be the first command of a search

If I remove the | the script completes without error but no data is returned, unlike in the UI where I get 600+ records.

Any clue as to what I am doing wrong? Greatly appreciate any assistance you can provide.

Thanks, Dan

0 Karma
Get Updates on the Splunk Community!

See your relevant APM services, dashboards, and alerts in one place with the updated ...

As a Splunk Observability user, you have a lot of data you have to manage, prioritize, and troubleshoot on a ...

Index This | What goes away as soon as you talk about it?

May 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this month’s ...

What's New in Splunk Observability Cloud and Splunk AppDynamics - May 2025

This month, we’re delivering several new innovations in Splunk Observability Cloud and Splunk AppDynamics ...