alopez2
asked on
How to export data from PowerShell script?
Can someone please show me how to export the data from the PowerShell script below to a file? I cannot for the life of me get it done. Only a blank file is produced.
Have also tried the export-csv cmndlet with same results.
The data comes up on the screen just fine.
Running the script on an Exchange 2013 server.
Thx,
--------------------
$Mbx = Get-CASMailbox -Filter {HasActiveSyncDevicePartne rship -Eq $true -And -not DisplayName -like "CAS_{*"}; $mbx | foreach {$name = $_.name; $device = get-MobileDeviceStatistics -mailbox $_.identity; $device | foreach {write-host $name, $_.devicemodel, $_.devicephonenumber, $_.deviceid, $_.FirstSyncTime, $_.LastSuccessSync} | out-file -filepath C:\Temp\ActiveSyncDeviceIn foTake1.tx t -inputobject $Mbx -encoding ASCII -append -width 120 }
Have also tried the export-csv cmndlet with same results.
The data comes up on the screen just fine.
Running the script on an Exchange 2013 server.
Thx,
--------------------
$Mbx = Get-CASMailbox -Filter {HasActiveSyncDevicePartne
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you both. oBdA, your script worked perfectly. Will close out the case. Thank you.
ASKER
Script worked great. Thank you!
alopez2, what your script does?
Get-CASMailbox -Filter {HasActiveSyncDevicePartne
Do you see anything?