PHP Put list from Powershell into Array
Posted
by
Mezzan
on Stack Overflow
See other posts from Stack Overflow
or by Mezzan
Published on 2012-06-26T03:11:49Z
Indexed on
2012/06/26
3:15 UTC
Read the original article
Hit count: 134
Code:
$exchangesnapin = "Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010";
$output = shell_exec('powershell '.$exchangesnapin.';"get-mailboxdatabase" 2>&1');
echo( '<pre>' );
echo( $output );
echo( '</pre>' );
Result:
Name Server Recovery ReplicationType
---- ------ -------- ---------------
Mailbox Database 0651932265 EGCVMADTEST False None
Mailbox Database 0651932266 EGCVMADTEST False None
I tried with
echo( $output[1] );
The result was only a letter 'N'. I believe its taking the Name column but one character at a time.
$output[1] is 'N', $output[2] is 'a'.
Is there any way I can get the mailbox list into array?
© Stack Overflow or respective owner