Share via


Enabling and Disabling OWA, IMAP4 and POP3 in E2K3 via VBScript

I've had this request from a customer and aparently its something some people have problems with:

 

NOTE: Following programming examples is for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This sample code assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. This sample code is provided for the purpose of illustration only and is not intended to be used in a production environment.

 

'"""""""""""""""""""""""""""""""""""""""’                                                                                                                                        

'" ENABLEOWAIMAP4andPOP3.VBS

'"

'" Enables Exchange Server 2003 OWA, IMAP4 and POP3 for the specified OU in the default domain

'"

'" usage: cscript enableowaimappop

'"

'"""""""""""""""""""""""""""""""""""""""’

'‘ values for the ProtocolSettings Exchange attribute that can be modified.

'‘ HTTP§0§1§§§§§§ = disabled

'‘ HTTP§1§1§§§§§§ = enabled

'‘ IMAP4§0§1§4§ISO-8859-1§0§1§0§0 = disabled

'‘ IMAP4§1§1§4§ISO-8859-1§0§1§0§0 = enabled

'‘ POP3§0§1§4§ISO-8859-1§0§§§ = disabled

'‘ POP3§1§1§4§ISO-8859-1§0§§§ = enabled

'"""""""""""""""""""""""""""""""""""""""’

dim usrstring 

Set ObjOU=GetObject("LDAP://OU=IT,DC=mamado,DC=test,DC=com") 

For Each User in ObjOU 

usrstring = "LDAP://CN=" & user.get("cn") & ",OU=IT,DC=mamado,DC=test,DC=com" 

Set ObjUser=GetObject(usrstring) 

For Each protocolSettings in ObjUser.GetEx("protocolSettings") 

If Left(protocolSettings, 3) = "HTTP" Then 

ObjUser.PutEx 3, "protocolSettings", Array(protocolSettings) 

ObjUser.SetInfo 

End If 

Next 

ObjUser.PutEx 3, "protocolSettings", Array("HTTP§1§1§§§§§§", "IMAP4§1§1§4§ISO-8859-1§0§1§0§0", "POP3§1§1§4§ISO-8859-1§0§§§") 

ObjUser.SetInfo 

Next 

=========================

'"""""""""""""""""""""""""""""""""""""""’                                                                                                                                        

'" DISABLEOWAIMAP4andPOP3.VBS

'"

'" Disables Exchange Server 2003 OWA, IMAP4 and POP3 for the specified OU in the default domain

'"

'" usage: cscript disableowaimappop

'"

'"""""""""""""""""""""""""""""""""""""""’

'‘ values for the ProtocolSettings Exchange attribute that can be modified.

'‘ HTTP§0§1§§§§§§ = disabled

'‘ HTTP§1§1§§§§§§ = enabled

'‘ IMAP4§0§1§4§ISO-8859-1§0§1§0§0 = disabled

'‘ IMAP4§1§1§4§ISO-8859-1§0§1§0§0 = enabled

'‘ POP3§0§1§4§ISO-8859-1§0§§§ = disabled

'‘ POP3§1§1§4§ISO-8859-1§0§§§ = enabled

'"""""""""""""""""""""""""""""""""""""""’

dim usrstring 

Set ObjOU=GetObject("LDAP://OU=IT,DC=mamado,DC=test,DC=com")

For Each User in ObjOU

usrstring = "LDAP://CN=" & user.get("cn") & ",OU=IT,DC=mamado,DC=test,DC=com"

Set ObjUser=GetObject(usrstring)

ObjUser.Put "protocolSettings", Array("HTTP§0§1§§§§§§", "IMAP4§0§1§4§ISO-8859-1§0§1§0§0", "POP3§0§1§4§ISO-8859-1§0§§§")

ObjUser.SetInfo

Next