有没有办法通过Exchange PowerShell查询谁是activesync / bb用户?

powershell blackberry active-directory exchange-server-2007 activesync

6967 观看

6回复

5127 作者的声誉

有没有办法查询Exchange 2007以区分谁是使用powershell交换插件的活动同步或黑莓用户?

作者: phill 的来源 发布者: 2008 年 12 月 3 日

回应 (6)


0

7056 作者的声誉

您可以查询以查看哪些邮箱已启用必要的权限 - 就像您可以看到哪些邮箱已启用OWA一样。这实际上并不能告诉你谁在使用这种能力,只有谁可以使用。

作者: Don Jones 发布者: 03.12.2008 08:52

1

1965 作者的声誉

决定

BBES通常使用可以访问所有邮箱的服务帐户来执行此操作。您将需要查看BBES服务器本身以找出哪些用户是活动的,而不是AD或Exchange。因为BBES是由数据库支持的,所以只需深入了解dbo.UserStats表,看看有什么。

作者: slipsec 发布者: 04.12.2008 12:25

0

5127 作者的声誉

我确实从这个网站上找到了这个vbscript。http://blogs.technet.com/mjimenez/archive/2007/07/30/how-do-i-programmatically-disable-enable-microsoft-exchange-active-sync-for-all-of-my-mobile- users.aspx

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''
'' DISABLEEAS.VBS
''
'' Disables Exchange Server 2003 Active Sync for the specified OU in the default domain
''
'' usage: cscript disableeas
''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

' Below are the values for the msExchOmaAdminWirelessEnable Exchange attribute that can be modified.
' 5 = disable EAS and keep OMA enabled.(default)
' 7 = disable all mobile features.
' 0 = enable all mobile features. (not recommended)


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'' Create log file instance
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

On Error Resume Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objLogFile = objFSO.OpenTextFile("c:\disableeas.log", 2, True, 0)
If Err.Number <> 0 Then
  ' Attempt to create a log file failed. 
  On Error GoTo 0
  objLogFile.WriteLine "ERROR: Failed to create a log file.Program execution halted."
  WScript.Echo "ERROR: Failed to create a log file. Program execution halted."
  WScript.Quit
  objLogFile.Close
  Set objFSO = Nothing
Else
  ' Successfully Created Disableeas.log file. Restore normal error handling.
  On Error GoTo 0
  objLogFile.WriteLine "disableeas.log created successfully"
End If


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'' Determine DNS domain name
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Set objRootDSE = GetObject("LDAP://rootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
strBaseOU = "" 'SPECIFY AND ORGANIZATIONAL UNIT NAME HERE. FOR EXAMPLE 'OU=Production
If Err.Number <> 0 Then
  ' Attempt to bind to Active Directory Failed.
  On Error GoTo 0
  objLogFile.WriteLine "ERROR: Binding to Active Directory Failed. Program execution halted."
  WScript.Echo "ERROR: Binding to Active Directory Failed. Program execution halted."
  WScript.Quit
  objLogFile.Close
  Set objFSO = Nothing
Else
  ' Active Directory bind successful
  On Error GoTo 0
  objLogFile.WriteLine "Binding to Active Directory successful"
End If 


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'' Setup ADO for Active Directory
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Set objCommand = CreateObject("ADODB.Command")
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
objCommand.ActiveConnection = objConnection
If Err.Number <> 0 Then
  ' Attempt to search Active Directory Failed.
  On Error GoTo 0
  objLogFile.WriteLine "ERROR: ADO Setup for Active Directory Failed. Program execution halted."
  WScript.Echo "ERROR: ADO Setup for Active Directory Failed. Program execution halted."
  WScript.Quit
  objLogFile.Close
  Set objFSO = Nothing
Else
  ' ADO Active Directory setup successful
  On Error GoTo 0
  objLogFile.WriteLine "Active Directory setup successful"
End If 

' Test whether an OU is specified.
If strBaseOU <> "" Then
 strBase="<LDAP://" & strBaseOU & "," & strDNSDomain & ">"
Else strBase="<LDAP://" & strDNSDomain & ">"
End If
'strBase="<LDAP://" & strDNSDomain & ">"
wscript.echo strBase


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'' Search for users with defined filters
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

strFilter = "(&(objectCategory=person)(objectClass=user)(!msExchOmaAdminWirelessEnable=5)(mail=*)(userAccountControl=66048))"
strAttributes = "distinguishedName"
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
objCommand.CommandText = strQuery
objCommand.Properties("Page Size") = 100
objCommand.Properties("Timeout") = 30
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
If Err.Number <> 0 Then
  ' Attempt to search within defined parameters failed.
  On Error GoTo 0
  objLogFile.WriteLine "Attempt to search within defined parameters failed. Program execution halted."
  WScript.Echo "ERROR: Attempt to search within defined parameters failed. Program execution halted."
  WScript.Quit
  objLogFile.Close
  Set objFSO = Nothing
Else
  ' Active Directory bind successful
  On Error GoTo 0
  objLogFile.WriteLine "Search within defined parameters was successful"
End If 


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'' Enuerate all users
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Do Until objRecordSet.EOF
  strDN = objRecordSet.Fields("distinguishedName")
  Set objUser = GetObject("LDAP://" & strDN)
   On Error Resume Next
   objUser.Get("msExchOmaAdminWirelessEnable")
   On Error GoTo 0
    objUser.Put "msExchOmaAdminWirelessEnable", "5"
    objUser.SetInfo
       If Err.Number <> 0 Then
        On Error GoTo 0
 objLogFile.Writeline "ERROR: Unfortunately, the required mobile attribute generated an error can could not be set. Program execution halted."
        WScript.Echo "ERROR: Unfortunately, the required mobile attribute generated an error can could not be set. Program execution halted."
        Wscript.Quit
        objLogFile.Close
        Set objFSO = Nothing
       Else
        On Error GoTo 0
        objLogFile.Writeline "User mobile properties successfully modified: " & objUser.Name
     Wscript.Echo "User mobile properties successfully modified: " & objUser.Name
       End If
 '  End If
  objRecordSet.MoveNext
Loop

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'' Clean up
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

objLogFile.WriteLine "End Program"
Wscript.Echo "End Program"

objLogFile.Close

我希望有一种方法可以由用户而不是ou来做到这一点。

作者: phill 发布者: 11.12.2008 04:26

0

5127 作者的声誉

我发现powershell中有一个cmdlet,它描述了activesync是否在线。

如果你运行> get-casmailbox | 获得会员

我注意到列表中有一个ActiveSyncEnabled属性

作者: phill 发布者: 17.12.2008 09:17

1

0 作者的声誉

试试这个吧。

Get-CASMailbox -resultsize unlimited | Where-Object {$_.ActiveSyncEnabled -eq "True" } | Select-Object SamAccountName,ActiveSyncEnabled

作者: Edward 发布者: 24.02.2009 05:22
32x32