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!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...