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!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...