|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
||||
|
||||
|
Query exchange server w/ WQL and Like/wilcard
ok, i'm at wits end here
i am trying to query exchange server using like, however i receive "Could not complete operation due to error 80041024" this is the code that has the error: Code:
Set SWbemLocator = CreateObject("WbemScripting.SWBemlocator")
Set objWMIService = SWBemlocator.ConnectServer _
("excchangeserver123", "root\MicrosoftExchangeV2","Domain\admin","123456789")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Exchange_Mailbox WHERE MailBoxDisplayName LIKE 'joe*'")
for each objItem in colItems
sResults = sResults & objItem.MailboxDisplayName & " " & objItem.StoreName & "<br>"
next
results.innerhtml = sResults
every google query i came upon when using the like statement and WQL(sql subset) needs to be xp...i have xp pro and server is 2003....i am totally lost as this code is presented everywhere but i am having problems tracking down the mistake...please advise...i'm going nuts code that does work with where statement but w/o like Code:
Set SWbemLocator = CreateObject("WbemScripting.SWBemlocator")
Set objWMIService = SWBemlocator.ConnectServer _
("excchangeserver123", "root\MicrosoftExchangeV2","Domain\admin","123456789")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Exchange_Mailbox WHERE MailboxDisplayName = 'joe'")
for each objItem in colItems
sResults = sResults & objItem.MailboxDisplayName & " " & objItem.StoreName & "<br>"
next
results.innerhtml = sResults
|
|
#2
|
||||
|
||||
|
WQL does support the LIKE keyword, but only if you use it correctly. The syntax in your match statement is wrong. Refer to the WQL Reference for usage information.
You are correct, LIKE is only available on Windows XP and newer.
__________________
Click the image if at any point you don't like my decision.Scripting problems? Windows questions? Ask the Windows Guru! |
|
#3
|
||||
|
||||
|
Quote:
sorry nilpo...i posted the wrong code..that one was an "experiment"/debug and i should have caught that to eliminate the obvious....i am using like with % Code:
Set SWbemLocator = CreateObject("WbemScripting.SWBemlocator")
Set objWMIService = SWBemlocator.ConnectServer _
("excchangeserver123", "root\MicrosoftExchangeV2","Domain\admin","123456789")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Exchange_Mailbox WHERE MailboxDisplayName LIKE '%joe%'")
for each objItem in colItems
sResults = sResults & objItem.MailboxDisplayName & " " & objItem.StoreName & "<br>"
next
results.innerhtml = sResults
any other way to query exchange? i'm trying to query for only particular recs....i can use w/o a where clause and use instr in the looped recordset to get the recs needing...however...i'd rather use a select qry that returns 14 recs vs 2000+...any other method besides WbemScripting.SWBemlocator?.... i don't have access att...but i have not tried a .vbs vs .hta i'm doing now......i don't see how this would change because of .hta unrestrictions....any thoughts? i was hoping you'd pop in thanks for your time Last edited by keep_it_simple : January 13th, 2008 at 11:44 AM. |
|
#4
|
||||
|
||||
|
Quote:
If your query is ok, then it may be something altogether different. You were asking about another method as opposed to using WbemScripting.SWBemlocator. Yes, there is. You can connect to WMI directly instead. Let me double check a few things with regards to Server 2003. I'll post back with some alternative code for you to try. I'll add some error-handling so we can have a little better idea where it's bugging out. Unfortunately, without access to your Exchange server I can't test the code myself. But I'm sure with a little patience, we'll get it. |
|
#5
|
||||
|
||||
|
Looks like you've got a thread going about this on Tek-Tips too.
![]() Do us favor and post a reply here if you do manage to get a solution there. |
![]() |
| Viewing: ASP Free Forums > System Administration > Windows Scripting > Query exchange server w/ WQL and Like/wilcard |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|
|