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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

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

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...