Re: Sort results from ExchangeV2
Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance
Dale wrote:
I'm generating a weekly report of users that exceed a set size limit on
the mailbox. I can get the query to return only mailboxes larger than
the set size, but if I request the collection sorted it becomes empty.
What am I doing wrong? Does ExchangeV2 not allow sorting? This query
works if you remove the 'ORDER BY Size DESC' clause.
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & _
"\ROOT\MicrosoftExchangeV2")
Set colItems = objWMIService.ExecQuery _
("Select MailboxDisplayName,Size from Exchange_Mailbox WHERE Size >
400000 ORDER BY Size DESC")
Thanks in advance for any help.
Hi,
WQL is a (small) subset of SQL, and "ORDER BY" is not implemented.
SQL for WMI
http://msdn.microsoft.com/library/en-us/wmisdk/wmi/sql_for_wmi.asp
You need to handle the sorting yourself:
ADO disconnected record set example as well as WSF file that uses
JScript array sort from a VBScript example here:
http://groups.google.co.uk/groups?selm=3E46392C.DE597514%40hydro.com
Alternatively, if you have only have up to a few hundred elements:
A QuickSort routine
http://groups.google.co.uk/groups?selm=3BE9E905.AFED21B4%40hydro.com
Bubble sort:
http://groups.google.co.uk/groups?selm=%23VMk1YAaBHA.1412%40tkmsftngp05
--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx
.
Relevant Pages
- Re: security center
... but you can query the PC's via WMI (Windows Management Instrumentation) scripting. ... The below script is for the local computer, and would need to be modified to determine all PC's on your network/domain and then query each computer individually and report when there is a problem. ... (microsoft.public.windowsxp.security_admin) - Re: WMI & ADSI
... > WMI to query the domain role of each computer object. ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ... (microsoft.public.win32.programmer.wmi) - Re: Order By in Query
... of WMI for Exchange ... Exchange_Mailbox Order By MailboxDisplayName", ... I get an error for the above query ... torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ... (microsoft.public.win32.programmer.wmi) - Re: WMI Problem
... So while I am banging my head on WMI, ... > there a way to query the domain for all machines currently logged on, ... > better yet all machines whose names start with 'WKS_' that arelogged on? ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ... (microsoft.public.scripting.wsh) - Re: Find Date Mailbox Created
... We may be able to use this attribute to query. ... messing with security descriptors the timestamp does not appear to ... mailbox by assigning rights at the root of the ... (microsoft.public.exchange.admin) |
|