Archive

Archives pour 29/04/2010

Export des utilisateurs Blackberry

Exporter la liste des utilisateurs Blackberry avec Powershell.
Le principe est d’effectuer un query sur la base SQL du BES avec Powershell.

?View Code POWERSHELL
$SqlServer = "SRV00026"
$SqlCatalog = "BESMgmt"
$SqlQuery = "select userconfig.DisplayName,userconfig.MailboxSMTPAddr FROM UserConfig"
 
 
$SqlConnection = New-Object System.Data.SqlClient.SqlConnection
$SqlConnection.ConnectionString = "Server = $SqlServer; Database = $SqlCatalog; Integrated Security = True"
$SqlCmd = New-Object System.Data.SqlClient.SqlCommand
$SqlCmd.CommandText = $SqlQuery
$SqlCmd.Connection = $SqlConnection
$SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
$SqlAdapter.SelectCommand = $SqlCmd
$DataSet = New-Object System.Data.DataSet
$SqlAdapter.Fill($DataSet)
$SqlConnection.Close()
$DataSet.Tables[0]
Categories: Blackberry Tags: , ,