Archive

Exchange App Powershell scripts returns system.collections.arraylist

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

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

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

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

Motivator

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

0 Karma

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

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