Sql into powershell

techdrive used Ask the Experts™
Greetings I am using Logparser which I believe is in SQL. I have the command in SQL that runs but I was needing help either directing this back to exchange powershell  or should I get the info I need in powershell first.

logparser.exe "SELECT User-email,client-software,client-software-version as Version,client-mode,client-ip,protocol from "D:\logs\RCA*.LOG"  WHERE (operation='Connect') OR Client-Mode LIKE '%mode' GROUP BY User-email,client-software,Version,client-mode,client-ip,protocol ORDER BY User-email" -i:CSV -nSkipLines:4 -o:CSV > c:\path

The info I need in powershell is foreach {get-mailbox $_ } | select primarysmtpaddress, organizationalunit

Please help we are running exchange 2013 and I am sing logparser 2.2
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Kudos for using LPS.

Try this:

Import-Csv lpsoutput.csv | ForEach-Object {
    Get-Mailbox $_.User-email | Select-Object PrimarySmtpAddress,OrganizationalUnit

Open in new window

Not sure what kind of output you're looking for


thank you sir

techdrive, I'm happy to hear I was able to assist.  If you found my contribution to this post valuable, please select the 'Accept Solution' link under my answer.  Thank you.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial