Jump to content

Exchange with CDOEXM


 Share

Recommended Posts

I am using AutoIT 3.1.1.27 to translate a vbs script that pulls information from exchange.

I currently have this which works great untill the StorageGroups part.

Storage groups should contain a list of the URLs to the Storage Groups but when I print it out it contains only a zero and the FOR LOOP syas I need a variable of type "object".

I tried treating it as an array but it did not work either.

Since all the onther information is being pulled exactly like in vb I'm not sure why this code does not work.

.

$iExs =  ObjCreate("CDOEXM.ExchangeServer")
$isg =  ObjCreate("CDOEXM.StorageGroup")

if @error then 
    Msgbox (0,"","error getting object. Error code: " & @error)
endif
$iExs.DataSource.Open('exchange')

  Msgbox(0, "Exchange Test",$iExs.Name)
  Msgbox(0, "Exchange Test",$iExs.ExchangeVersion)
  Msgbox(0, "Exchange Test",$iExs.DirectoryServer)
  Msgbox(0, "Exchange Test",$iExs.StorageGroups)
  
  For $storegroup in $iExs.StorageGroups
      Msgbox(0, "Exchange Test",$storegroup)
      $isg.DataSource.Open($storegroup)
  Next

In vb it looks like this:

Set iExs   = CreateObject ("CDOEXM.ExchangeServer")
 Set isg    = CreateObject ("CDOEXM.StorageGroup")

 iExs.DataSource.Open strServerName

 e "Exchange attributes for server " & strServerName

 e "Name = "                     & iExs.Name
 e "ExchangeVersion = "       & iExs.ExchangeVersion
 e "DirectoryServer = "       & iExs.DirectoryServer
 e "DaysBeforeLogFileRemoval = " & iExs.DaysBeforeLogFileRemoval
 e "MessageTrackingEnabled = "   & iExs.MessageTrackingEnabled
 e "SubjectLoggingEnabled = "   & iExs.SubjectLoggingEnabled
 e "Servertype = "             & sServerType (iExs.ServerType)
 e ""

 For Each storegroup In iExs.StorageGroups
  e "StorageGroup Attributes"
  e "Distinguished Name = " & storegroup

...

Long live AutoIT!

Edited by ybouan
Link to comment
Share on other sites

I am using AutoIT 3.1.1.27 to translate a vbs script that pulls information from exchange.

I currently have this which works great untill the StorageGroups part.

Storage groups should contain a list of the URLs to the Storage Groups but when I print it out it contains only a zero and the FOR LOOP syas I need a variable of type  "object".

...

Long live AutoIT!

<{POST_SNAPBACK}>

Hello ybouan,

Sorry for the late answer. It took me some time to obtain access to an exchange server with enough rights (a normal user does not have access to the StorageGroups).

It seems that the COM method "$theServer.StorageGroups" returns an 'COM-Array' type that has a undocumented flag activated.

Since I don't know what this specific flag means, I modified AutoIt so it will just ignore this flag.

I submitted the modified code to jpm, who will (hopefully) merge it with the next beta version.

Thanks for showing this bug!

Regards,

-Sven

Link to comment
Share on other sites

I am using AutoIT 3.1.1.27 to translate a vbs script that pulls information from exchange.

....

Long live AutoIT!

<{POST_SNAPBACK}>

ybouan,

Could you test your script again with the newest beta version v3.1.1.28 ?

Regards,

-Sven

Link to comment
Share on other sites

ybouan,

Could you test your script again with the newest beta version v3.1.1.28 ?

Regards,

-Sven

<{POST_SNAPBACK}>

Tested it and it works great. Thank you so much!

This is huge!!!!

I may soon have a test server here.

May be I can get you permissions for futur tests...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...