All Apps and Add-ons

Exchange App Powershell scripts returns system.collections.arraylist

andykiely
Path Finder

Not all of my exchange app dashboards are returning data, when looking into the powershell scripts I've found when run maunally they output the following:

[PS] C:\Program Files\SplunkUniversalForwarder\etc\apps\TA-Exchange-2007-MailboxStore\bin\powershell>.\get-databasestats.ps1
System.Collections.ArrayList
System.Collections.ArrayList
System.Collections.ArrayList
System.Collections.ArrayList
System.Collections.ArrayList
[PS] C:\Program Files\SplunkUniversalForwarder\etc\apps\TA-Exchange-2007-MailboxStore\bin\powershell>

I would have expected to see data returned to the screen. Has anyone else had this at all?

Cheers
Andy

1 Solution

OL
Communicator

Hi Andy,

The problem is probably related to the version of powershell you are using.

In your scripts, you should have, towards the end, something like this:

   [string]::join(" ", $Output)

This is the format for powershell version 2.
If you are using powershell v3, you should replace it with the following:

   [string]::join(" ", @($Output))

Hope it helps.

Olivier

View solution in original post

OL
Communicator

Hi Andy,

The problem is probably related to the version of powershell you are using.

In your scripts, you should have, towards the end, something like this:

   [string]::join(" ", $Output)

This is the format for powershell version 2.
If you are using powershell v3, you should replace it with the following:

   [string]::join(" ", @($Output))

Hope it helps.

Olivier

halr9000
Motivator

For the record, I reviewed the WMF 3.0 release notes and don't see a breaking change documented that applies to this case, so... shrug

0 Karma

halr9000
Motivator

We'll make sure this gets fixed in splunkbase, thanks OL.

0 Karma

ahall_splunk
Splunk Employee
Splunk Employee

OL is correct - the Exchange and AD apps both deal with Powershell Version 2. Another (more global) way of doing it is to alter the exchangepowershell.bat script and add "-version 2" to the powershell execution arguments.

0 Karma

andykiely
Path Finder

Hi Olivier,

This edit does bring back data from our exchange server and is now pulling data into Splunk.

Thanks
Andy

0 Karma
Get Updates on the Splunk Community!

Introduction to Splunk Observability Cloud - Building a Resilient Hybrid Cloud

Introduction to Splunk Observability Cloud - Building a Resilient Hybrid Cloud  In today’s fast-paced digital ...

Observability protocols to know about

Observability protocols define the specifications or formats for collecting, encoding, transporting, and ...

Take Your Breath Away with Splunk Risk-Based Alerting (RBA)

WATCH NOW!The Splunk Guide to Risk-Based Alerting is here to empower your SOC like never before. Join Haylee ...