Visual Basic Classic
--
Questions
--
Followers
Top Experts
Disable OWA (Outlook web access) for all users in the file.
I have a txt file in which i have the Nt logins of users.I just want to remove (Disable) the OWA that they have.Is there a way a script can do this for these specific users.
Regards
Sharath
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
http://support.microsoft.com/kb/830188
Regards,
Rob.
'==================
Const ADS_PROPERTY_CLEAR = 1
Const ADS_PROPERTY_UPDATE = 2
Const ADS_PROPERTY_APPEND = 3
Const ADS_PROPERTY_DELETE = 4
Set objRootDSE = GetObject("LDAP://RootDSE"
Set objUser = GetObject("LDAP://CN=TestU
For Each protocolSettings in ObjUser.GetEx("protocolSet
If Left(protocolSettings, 4) = "HTTP" Then
objUser.PutEx ADS_PROPERTY_DELETE, "protocolSettings", Array(protocolSettings)
objUser.SetInfo
End If
Next
objUser.PutEx ADS_PROPERTY_APPEND, "protocolSettings", Array("HTTP§0§1§§§§§§")
objUser.SetInfo
MsgBox "Done"
'==================
Regards,
Rob.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
https://www.experts-exchange.com/questions/23119848/Computers-inward-outward-Any-software-which-can-do-this-Or-a-script-to-take-the-input-from-a-HTA-fiule-and-store-on-an-excel-sheet.html
https://www.experts-exchange.com/questions/23118691/Script-to-login-to-a-website-and-pass-the-data-and-get-the-results-to-a-file.html
https://www.experts-exchange.com/questions/23118647/Create-a-report-file-of-all-the-shared-folders-in-a-machine-with-each-extension-as-header-and-the-count-of-objects-in-it.html
https://www.experts-exchange.com/questions/23118432/Change-the-security-setting-for-all-computers-in-an-OU.html
--------------------------
Windows Script Host
--------------------------
Script: C:\OWA access deny.vbs
Line: 8
Char: 1
Error: 0x80005000
Code: 80005000
Source: (null)
--------------------------
OK
--------------------------
Regards,
Rob.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Set objUser = GetObject("LDAP://CN=Shara
Still get this error..
--------------------------
Windows Script Host
--------------------------
Script: C:\OWA access deny.vbs
Line: 9
Char: 1
Error: The directory property cannot be found in the cache.
Code: 8000500D
Source: Active Directory
--------------------------
OK
--------------------------
Regards,
Rob.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
'==================
Const ADS_PROPERTY_CLEAR = 1
Const ADS_PROPERTY_UPDATE = 2
Const ADS_PROPERTY_APPEND = 3
Const ADS_PROPERTY_DELETE = 4
Set objRootDSE = GetObject("LDAP://RootDSE"
Set objUser = GetObject("LDAP://CN=TestU
objSettings = objUser.GetEx("protocolSet
If IsArray(objSettings) = True Then
For Each protocolSettings In objSettings
If Left(protocolSettings, 4) = "HTTP" Then
objUser.PutEx ADS_PROPERTY_DELETE, "protocolSettings", Array(protocolSettings)
objUser.SetInfo
End If
Next
Else
MsgBox "Cannot retrieve protocolSettings"
End If
objUser.PutEx ADS_PROPERTY_APPEND, "protocolSettings", Array("HTTP§0§1§§§§§§")
objUser.SetInfo
MsgBox "Done"
'==================
Regards,
Rob.
Rob.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
'==================
strInputFile = "Users_To_Disable_OWA.txt"
Const intForReading = 1
Set objFSO = CreateObject("Scripting.Fi
Set objNetwork = CreateObject("WScript.Netw
Const ADS_PROPERTY_CLEAR = 1
Const ADS_PROPERTY_UPDATE = 2
Const ADS_PROPERTY_APPEND = 3
Const ADS_PROPERTY_DELETE = 4
Set objInputFile = objFSO.OpenTextFile(strInp
While Not objInputFile.AtEndOfStream
strLogin = objInputFile.ReadLine
strNTName = objNetwork.UserDomain & "\" & strLogin
strObjectType = "user" ' Can be "user", "group", or "computer"
strInputFormat = "NTLoginName" ' Can be "NTLoginName" or "DisplayName"
strUserDN = Get_DistinguishedName_From
If strUserDN <> "ERROR" Then
'MsgBox "adsPath of " & strNTName & ":" & VbCrLf & "LDAP://" & strUserDN
Set objUser = GetObject("LDAP://" & strUserDN)
objSettings = objUser.GetEx("protocolSet
If IsArray(objSettings) = True Then
For Each protocolSettings In objSettings
If Left(protocolSettings, 4) = "HTTP" Then
objUser.PutEx ADS_PROPERTY_DELETE, "protocolSettings", Array(protocolSettings)
objUser.SetInfo
End If
Next
Else
'MsgBox "Cannot retrieve protocolSettings"
End If
objUser.PutEx ADS_PROPERTY_APPEND, "protocolSettings", Array("HTTP§0§1§§§§§§")
objUser.SetInfo
Else
MsgBox "There was an error returning the DistinguishedName attribute of " & strNTName
End If
Wend
objInputFile.Close
Set objInputFile = Nothing
MsgBox "Done"
Function Get_DistinguishedName_From
' Source: http://www.rlmueller.net/NameTranslateFAQ.htm#What%20is%20NameTranslate
' Constants for the NameTranslate object.
' INIT Method Parameters
' To search a specific domain that is not the local one
Const ADS_NAME_INITTYPE_DOMAIN = 1 ' Use objTrans.Init ADS_NAME_INITTYPE_DOMAIN, "MyDomain.com"
' To search a specific domain controller in the local domain
Const ADS_NAME_INITTYPE_SERVER = 2 ' Use objTrans.Init ADS_NAME_INITTYPE_SERVER, "MyServer"
' To search through local domain - should be mainly used
Const ADS_NAME_INITTYPE_GC = 3 ' Use objTrans.Init ADS_NAME_INIITTYPE_GC, ""
If LCase(strObjectType) = "computer" Then
If Right(strName, 1) <> "$" Then strName = strName & "$"
End If
' SET and GET Method Parameters
Const ADS_NAME_TYPE_1779 = 1
Const ADS_NAME_TYPE_CANONICAL = 2
Const ADS_NAME_TYPE_NT4 = 3
Const ADS_NAME_TYPE_DISPLAY = 4
Const ADS_NAME_TYPE_DOMAIN_SIMPL
Const ADS_NAME_TYPE_ENTERPRISE_S
Const ADS_NAME_TYPE_GUID = 7
Const ADS_NAME_TYPE_UNKNOWN = 8
Const ADS_NAME_TYPE_USER_PRINCIP
Const ADS_NAME_TYPE_CANONICAL_EX
Const ADS_NAME_TYPE_SERVICE_PRIN
Const ADS_NAME_TYPE_SID_OR_SID_H
' Use the NameTranslate object to convert the NT user name to the
' Distinguished Name required for the LDAP provider.
Set objTrans = CreateObject("NameTranslat
' Initialize NameTranslate by locating the Global Catalog.
objTrans.Init ADS_NAME_INITTYPE_GC, ""
boolError = False
If LCase(strInputFormat) = "displayname" Then
' Use the Set method to specify the Display Name of the object name.
On Error Resume Next
objTrans.Set ADS_NAME_TYPE_DISPLAY, strName
If Err.Number <> 0 Then boolError = True
On Error GoTo 0
Else ' assume it is the NTName
' Use the Set method to specify the NT format of the object name.
On Error Resume Next
objTrans.Set ADS_NAME_TYPE_NT4, strName
If Err.Number <> 0 Then boolError = True
On Error GoTo 0
End If
If boolError = False Then
' Use the Get method to retrieve the RPC 1779 Distinguished Name.
strUserDN = objTrans.Get(ADS_NAME_TYPE
Else
strUserDN = "ERROR"
End If
' Escape any "/" characters with backslash escape character.
' All other characters that need to be escaped will be escaped.
strUserDN = Replace(strUserDN, "/", "\/")
Get_DistinguishedName_From
End Function
'==================
Regards,
Rob.
--------------------------
--------------------------
There was an error returning the DistinguishedName attribute of Dev\john
--------------------------
OK
--------------------------






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
>> I have a txt file in which i have the Nt logins of users
Oh well, if you have the Display Name in the file, change this bit:
strLogin = objInputFile.ReadLine
strNTName = objNetwork.UserDomain & "\" & strLogin
strObjectType = "user" ' Can be "user", "group", or "computer"
strInputFormat = "NTLoginName" ' Can be "NTLoginName" or "DisplayName"
strUserDN = Get_DistinguishedName_From
to this:
strDisplayName = objInputFile.ReadLine
strObjectType = "user" ' Can be "user", "group", or "computer"
strInputFormat = "DisplayName" ' Can be "NTLoginName" or "DisplayName"
strUserDN = Get_DistinguishedName_From
Regards,
Rob.
In the first single user script i had to mention the firstname and lastname. So i thought it would be the same..
I did the changes and tried but i get this message..
--------------------------
--------------------------
There was an error returning the DistinguishedName attribute of
--------------------------
OK
--------------------------
'==================
Const ADS_PROPERTY_CLEAR = 1
Const ADS_PROPERTY_UPDATE = 2
Const ADS_PROPERTY_APPEND = 3
Const ADS_PROPERTY_DELETE = 4
Set objRootDSE = GetObject("LDAP://RootDSE"
Set objUser = GetObject("LDAP://CN=TestU
objSettings = objUser.GetEx("protocolSet
If IsArray(objSettings) = True Then
For Each protocolSettings In objSettings
If Left(protocolSettings, 4) = "HTTP" Then
objUser.PutEx ADS_PROPERTY_DELETE, "protocolSettings", Array(protocolSettings)
objUser.SetInfo
End If
Next
Else
MsgBox "Cannot retrieve protocolSettings"
End If
objUser.PutEx ADS_PROPERTY_APPEND, "protocolSettings", Array("HTTP§0§1§§§§§§")
objUser.SetInfo
MsgBox "Done"
'==================
Worked great on my login name and even retested it now..For others it does not work...
Firstname and lastname for my login it disable OWA access...






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
The only reason we specified your full name in the CN= part of the manual query, is because the display name is what is required when connecting directly to an LDAP object like that. When you want to use the NT Login name, we need to use a search function, which I have inlcluded in the other script.
Try it out with your NT Login, it should find your Distinguished Name.
Regards,
Rob.
--------------------------
Windows Script Host
--------------------------
Script: C:\Owa access deny for all users.vbs
Line: 23
Char: 13
Error: The directory property cannot be found in the cache.
Code: 8000500D
Source: Active Directory
--------------------------
OK
--------------------------
I have NTlogins in the txt file
Rob.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
'==================
strInputFile = "Users_To_Disable_OWA.txt"
Const intForReading = 1
Set objFSO = CreateObject("Scripting.Fi
Set objNetwork = CreateObject("WScript.Netw
Const ADS_PROPERTY_CLEAR = 1
Const ADS_PROPERTY_UPDATE = 2
Const ADS_PROPERTY_APPEND = 3
Const ADS_PROPERTY_DELETE = 4
Set objInputFile = objFSO.OpenTextFile(strInp
While Not objInputFile.AtEndOfStream
strLogin = objInputFile.ReadLine
strNTName = objNetwork.UserDomain & "\" & strLogin
strObjectType = "user" ' Can be "user", "group", or "computer"
strInputFormat = "NTLoginName" ' Can be "NTLoginName" or "DisplayName"
strUserDN = Get_DistinguishedName_From
If strUserDN <> "ERROR" Then
'MsgBox "adsPath of " & strNTName & ":" & VbCrLf & "LDAP://" & strUserDN
Set objUser = GetObject("LDAP://" & strUserDN)
objUser.Put "msExchOmaAdminWirelessEna
objUser.SetInfo
Else
MsgBox "There was an error returning the DistinguishedName attribute of " & strNTName
End If
Wend
objInputFile.Close
Set objInputFile = Nothing
MsgBox "Done"
Function Get_DistinguishedName_From
' Source: http://www.rlmueller.net/NameTranslateFAQ.htm#What%20is%20NameTranslate
' Constants for the NameTranslate object.
' INIT Method Parameters
' To search a specific domain that is not the local one
Const ADS_NAME_INITTYPE_DOMAIN = 1 ' Use objTrans.Init ADS_NAME_INITTYPE_DOMAIN, "MyDomain.com"
' To search a specific domain controller in the local domain
Const ADS_NAME_INITTYPE_SERVER = 2 ' Use objTrans.Init ADS_NAME_INITTYPE_SERVER, "MyServer"
' To search through local domain - should be mainly used
Const ADS_NAME_INITTYPE_GC = 3 ' Use objTrans.Init ADS_NAME_INIITTYPE_GC, ""
If LCase(strObjectType) = "computer" Then
If Right(strName, 1) <> "$" Then strName = strName & "$"
End If
' SET and GET Method Parameters
Const ADS_NAME_TYPE_1779 = 1
Const ADS_NAME_TYPE_CANONICAL = 2
Const ADS_NAME_TYPE_NT4 = 3
Const ADS_NAME_TYPE_DISPLAY = 4
Const ADS_NAME_TYPE_DOMAIN_SIMPL
Const ADS_NAME_TYPE_ENTERPRISE_S
Const ADS_NAME_TYPE_GUID = 7
Const ADS_NAME_TYPE_UNKNOWN = 8
Const ADS_NAME_TYPE_USER_PRINCIP
Const ADS_NAME_TYPE_CANONICAL_EX
Const ADS_NAME_TYPE_SERVICE_PRIN
Const ADS_NAME_TYPE_SID_OR_SID_H
' Use the NameTranslate object to convert the NT user name to the
' Distinguished Name required for the LDAP provider.
Set objTrans = CreateObject("NameTranslat
' Initialize NameTranslate by locating the Global Catalog.
objTrans.Init ADS_NAME_INITTYPE_GC, ""
boolError = False
If LCase(strInputFormat) = "displayname" Then
' Use the Set method to specify the Display Name of the object name.
On Error Resume Next
objTrans.Set ADS_NAME_TYPE_DISPLAY, strName
If Err.Number <> 0 Then boolError = True
On Error GoTo 0
Else ' assume it is the NTName
' Use the Set method to specify the NT format of the object name.
On Error Resume Next
objTrans.Set ADS_NAME_TYPE_NT4, strName
If Err.Number <> 0 Then boolError = True
On Error GoTo 0
End If
If boolError = False Then
' Use the Get method to retrieve the RPC 1779 Distinguished Name.
strUserDN = objTrans.Get(ADS_NAME_TYPE
Else
strUserDN = "ERROR"
End If
' Escape any "/" characters with backslash escape character.
' All other characters that need to be escaped will be escaped.
strUserDN = Replace(strUserDN, "/", "\/")
Get_DistinguishedName_From
End Function
'==================
Regards,
Rob.
Basically, from here:
http://www.msxfaq.de/tools/grp2exinet.4.0.vbs.txt
It seems that there are four elements to protocolSettings, and if they don't exist, you need to create them, so hopefully I have it right.
'==================
strInputFile = "Users_To_Disable_OWA.txt"
Const intForReading = 1
Set objFSO = CreateObject("Scripting.Fi
Set objNetwork = CreateObject("WScript.Netw
Const ADS_PROPERTY_CLEAR = 1
Const ADS_PROPERTY_UPDATE = 2
Const ADS_PROPERTY_APPEND = 3
Const ADS_PROPERTY_DELETE = 4
Const conExInetOWAoff = "HTTP§0§1§§§§§§"
Const conExInetOWAon = "HTTP§1§1§§§§§§"
Set objInputFile = objFSO.OpenTextFile(strInp
While Not objInputFile.AtEndOfStream
strLogin = objInputFile.ReadLine
strNTName = objNetwork.UserDomain & "\" & strLogin
strObjectType = "user" ' Can be "user", "group", or "computer"
strInputFormat = "NTLoginName" ' Can be "NTLoginName" or "DisplayName"
strUserDN = Get_DistinguishedName_From
ReDim arrProtocolSettings(3)
' The first array element of protocolSettings (element id 0), is for POP3
' The third array element of protocolSettings (element id 1), is for IMAP4
' The third array element of protocolSettings (element id 2), is for OWA
' The fourth array element of protocolSettings (element id 3), is for MAPI cache
If strUserDN <> "ERROR" Then
'MsgBox "adsPath of " & strNTName & ":" & VbCrLf & "LDAP://" & strUserDN
Set objUser = GetObject("LDAP://" & strUserDN)
On Error Resume Next
arrSettings = objUser.GetEx("protocolSet
If Err.Number = 0 Then
On Error GoTo 0
' Copy the existing settings
For intSetting = 0 To 3
arrProtocolSettings(intSet
Next
' Reset the OWA element
arrProtocolSettings(2) = conExInetOWAoff
Else
Err.Clear
On Error GoTo 0
' Leave the other protocols empty and just populate the OWA element
arrProtocolSettings(2) = conExInetOWAoff
End If
objUser.PutEx ADS_PROPERTY_APPEND, "protocolSettings", arrProtocolSettings
objUser.SetInfo
Else
MsgBox "There was an error returning the DistinguishedName attribute of " & strNTName
End If
Wend
objInputFile.Close
Set objInputFile = Nothing
MsgBox "Done"
Function Get_DistinguishedName_From
' Source: http://www.rlmueller.net/NameTranslateFAQ.htm#What%20is%20NameTranslate
' Constants for the NameTranslate object.
' INIT Method Parameters
' To search a specific domain that is not the local one
Const ADS_NAME_INITTYPE_DOMAIN = 1 ' Use objTrans.Init ADS_NAME_INITTYPE_DOMAIN, "MyDomain.com"
' To search a specific domain controller in the local domain
Const ADS_NAME_INITTYPE_SERVER = 2 ' Use objTrans.Init ADS_NAME_INITTYPE_SERVER, "MyServer"
' To search through local domain - should be mainly used
Const ADS_NAME_INITTYPE_GC = 3 ' Use objTrans.Init ADS_NAME_INIITTYPE_GC, ""
If LCase(strObjectType) = "computer" Then
If Right(strName, 1) <> "$" Then strName = strName & "$"
End If
' SET and GET Method Parameters
Const ADS_NAME_TYPE_1779 = 1
Const ADS_NAME_TYPE_CANONICAL = 2
Const ADS_NAME_TYPE_NT4 = 3
Const ADS_NAME_TYPE_DISPLAY = 4
Const ADS_NAME_TYPE_DOMAIN_SIMPL
Const ADS_NAME_TYPE_ENTERPRISE_S
Const ADS_NAME_TYPE_GUID = 7
Const ADS_NAME_TYPE_UNKNOWN = 8
Const ADS_NAME_TYPE_USER_PRINCIP
Const ADS_NAME_TYPE_CANONICAL_EX
Const ADS_NAME_TYPE_SERVICE_PRIN
Const ADS_NAME_TYPE_SID_OR_SID_H
' Use the NameTranslate object to convert the NT user name to the
' Distinguished Name required for the LDAP provider.
Set objTrans = CreateObject("NameTranslat
' Initialize NameTranslate by locating the Global Catalog.
objTrans.Init ADS_NAME_INITTYPE_GC, ""
boolError = False
If LCase(strInputFormat) = "displayname" Then
' Use the Set method to specify the Display Name of the object name.
On Error Resume Next
objTrans.Set ADS_NAME_TYPE_DISPLAY, strName
If Err.Number <> 0 Then boolError = True
On Error GoTo 0
Else ' assume it is the NTName
' Use the Set method to specify the NT format of the object name.
On Error Resume Next
objTrans.Set ADS_NAME_TYPE_NT4, strName
If Err.Number <> 0 Then boolError = True
On Error GoTo 0
End If
If boolError = False Then
' Use the Get method to retrieve the RPC 1779 Distinguished Name.
strUserDN = objTrans.Get(ADS_NAME_TYPE
Else
strUserDN = "ERROR"
End If
' Escape any "/" characters with backslash escape character.
' All other characters that need to be escaped will be escaped.
strUserDN = Replace(strUserDN, "/", "\/")
Get_DistinguishedName_From
End Function
'==================
Regards,
Rob.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
--------------------------
Windows Script Host
--------------------------
Script: C:\OWA deny.vbs
Line: 46
Char: 7
Error: Unspecified error
Code: 80004005
Source: Active Directory
--------------------------
OK
--------------------------
https://www.experts-exchange.com/questions/23126904/Excel-has-machine-names-on-colum-Q-need-to-get-the-Operating-system-and-service-pack-on-colum-AJ-and-AK.html
https://www.experts-exchange.com/questions/23126865/Hta-file-to-get-all-details-from-ADS-needs-to-be-included-with-more-deata.html
https://www.experts-exchange.com/questions/23126679/Entered-data-in-excel-sheet-need-to-retrieve-from-Ads.html
https://www.experts-exchange.com/questions/23125245/How-can-i-qury-the-machines-uptime-in-a-ie-window.html
https://www.experts-exchange.com/questions/23119848/Computers-inward-outward-Any-software-which-can-do-this-Or-a-script-to-take-the-input-from-a-HTA-fiule-and-store-on-an-excel-sheet.html
https://www.experts-exchange.com/questions/23118691/Script-to-login-to-a-website-and-pass-the-data-and-get-the-results-to-a-file.html
https://www.experts-exchange.com/questions/23118432/Change-the-security-setting-for-all-computers-in-an-OU.html
https://www.experts-exchange.com/questions/23089494/I-have-the-printer-ip's-in-a-excel-sheet-can-i-know-the-toner-percentage.html
Sorry to post so many...There are some which are already commented by you and some thats already solved by you but needs to extend the capability...

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
'==================
strInputFile = "Users_To_Disable_OWA.txt"
Const intForReading = 1
Set objFSO = CreateObject("Scripting.Fi
Set objNetwork = CreateObject("WScript.Netw
Const ADS_PROPERTY_CLEAR = 1
Const ADS_PROPERTY_UPDATE = 2
Const ADS_PROPERTY_APPEND = 3
Const ADS_PROPERTY_DELETE = 4
Const conExInetOWAoff = "HTTP§0§1§§§§§§"
Const conExInetOWAon = "HTTP§1§1§§§§§§"
Set objInputFile = objFSO.OpenTextFile(strInp
While Not objInputFile.AtEndOfStream
strLogin = objInputFile.ReadLine
strNTName = objNetwork.UserDomain & "\" & strLogin
strObjectType = "user" ' Can be "user", "group", or "computer"
strInputFormat = "NTLoginName" ' Can be "NTLoginName" or "DisplayName"
strUserDN = Get_DistinguishedName_From
If strUserDN <> "ERROR" Then
'MsgBox "adsPath of " & strNTName & ":" & VbCrLf & "LDAP://" & strUserDN
Set objUser = GetObject("LDAP://" & strUserDN)
On Error Resume Next
arrSettings = objUser.GetEx("protocolSet
If Err.Number = 0 Then
On Error GoTo 0
For Each protocolSettings In objSettings
If Left(protocolSettings, 4) = "HTTP" Then
objUser.PutEx ADS_PROPERTY_DELETE, "protocolSettings", Array(protocolSettings)
objUser.SetInfo
End If
Next
Else
Err.Clear
On Error GoTo 0
'MsgBox "Cannot retrieve protocolSettings"
End If
objUser.PutEx ADS_PROPERTY_APPEND, "protocolSettings", Array(conExInetOWAon)
objUser.SetInfo
Else
MsgBox "There was an error returning the DistinguishedName attribute of " & strNTName
End If
Wend
objInputFile.Close
Set objInputFile = Nothing
MsgBox "Done"
Function Get_DistinguishedName_From
' Source: http://www.rlmueller.net/NameTranslateFAQ.htm#What%20is%20NameTranslate
' Constants for the NameTranslate object.
' INIT Method Parameters
' To search a specific domain that is not the local one
Const ADS_NAME_INITTYPE_DOMAIN = 1 ' Use objTrans.Init ADS_NAME_INITTYPE_DOMAIN, "MyDomain.com"
' To search a specific domain controller in the local domain
Const ADS_NAME_INITTYPE_SERVER = 2 ' Use objTrans.Init ADS_NAME_INITTYPE_SERVER, "MyServer"
' To search through local domain - should be mainly used
Const ADS_NAME_INITTYPE_GC = 3 ' Use objTrans.Init ADS_NAME_INIITTYPE_GC, ""
If LCase(strObjectType) = "computer" Then
If Right(strName, 1) <> "$" Then strName = strName & "$"
End If
' SET and GET Method Parameters
Const ADS_NAME_TYPE_1779 = 1
Const ADS_NAME_TYPE_CANONICAL = 2
Const ADS_NAME_TYPE_NT4 = 3
Const ADS_NAME_TYPE_DISPLAY = 4
Const ADS_NAME_TYPE_DOMAIN_SIMPL
Const ADS_NAME_TYPE_ENTERPRISE_S
Const ADS_NAME_TYPE_GUID = 7
Const ADS_NAME_TYPE_UNKNOWN = 8
Const ADS_NAME_TYPE_USER_PRINCIP
Const ADS_NAME_TYPE_CANONICAL_EX
Const ADS_NAME_TYPE_SERVICE_PRIN
Const ADS_NAME_TYPE_SID_OR_SID_H
' Use the NameTranslate object to convert the NT user name to the
' Distinguished Name required for the LDAP provider.
Set objTrans = CreateObject("NameTranslat
' Initialize NameTranslate by locating the Global Catalog.
objTrans.Init ADS_NAME_INITTYPE_GC, ""
boolError = False
If LCase(strInputFormat) = "displayname" Then
' Use the Set method to specify the Display Name of the object name.
On Error Resume Next
objTrans.Set ADS_NAME_TYPE_DISPLAY, strName
If Err.Number <> 0 Then boolError = True
On Error GoTo 0
Else ' assume it is the NTName
' Use the Set method to specify the NT format of the object name.
On Error Resume Next
objTrans.Set ADS_NAME_TYPE_NT4, strName
If Err.Number <> 0 Then boolError = True
On Error GoTo 0
End If
If boolError = False Then
' Use the Get method to retrieve the RPC 1779 Distinguished Name.
strUserDN = objTrans.Get(ADS_NAME_TYPE
Else
strUserDN = "ERROR"
End If
' Escape any "/" characters with backslash escape character.
' All other characters that need to be escaped will be escaped.
strUserDN = Replace(strUserDN, "/", "\/")
Get_DistinguishedName_From
End Function
'==================
Regards,
Rob.
--------------------------
Windows Script Host
--------------------------
Script: C:\OWA deny.vbs
Line: 29
Char: 19
Error: Object not a collection
Code: 800A01C3
Source: Microsoft VBScript runtime error
--------------------------
OK
--------------------------
'==================
strInputFile = "Users_To_Disable_OWA.txt"
Const intForReading = 1
Set objFSO = CreateObject("Scripting.Fi
Set objNetwork = CreateObject("WScript.Netw
Const ADS_PROPERTY_CLEAR = 1
Const ADS_PROPERTY_UPDATE = 2
Const ADS_PROPERTY_APPEND = 3
Const ADS_PROPERTY_DELETE = 4
Const conExInetOWAoff = "HTTP§0§1§§§§§§"
Const conExInetOWAon = "HTTP§1§1§§§§§§"
Set objInputFile = objFSO.OpenTextFile(strInp
While Not objInputFile.AtEndOfStream
strLogin = objInputFile.ReadLine
strNTName = objNetwork.UserDomain & "\" & strLogin
strObjectType = "user" ' Can be "user", "group", or "computer"
strInputFormat = "NTLoginName" ' Can be "NTLoginName" or "DisplayName"
strUserDN = Get_DistinguishedName_From
If strUserDN <> "ERROR" Then
'MsgBox "adsPath of " & strNTName & ":" & VbCrLf & "LDAP://" & strUserDN
Set objUser = GetObject("LDAP://" & strUserDN)
On Error Resume Next
arrSettings = objUser.GetEx("protocolSet
If Err.Number = 0 Then
Err.Clear
For Each protocolSettings In objSettings
If Err.Number <> 0 Then Exit For
If Left(protocolSettings, 4) = "HTTP" Then
objUser.PutEx ADS_PROPERTY_DELETE, "protocolSettings", Array(protocolSettings)
objUser.SetInfo
End If
Next
On Error GoTo 0
Else
Err.Clear
On Error GoTo 0
'MsgBox "Cannot retrieve protocolSettings"
End If
objUser.PutEx ADS_PROPERTY_APPEND, "protocolSettings", Array(conExInetOWAon)
objUser.SetInfo
Else
MsgBox "There was an error returning the DistinguishedName attribute of " & strNTName
End If
Wend
objInputFile.Close
Set objInputFile = Nothing
MsgBox "Done"
Function Get_DistinguishedName_From
' Source: http://www.rlmueller.net/NameTranslateFAQ.htm#What%20is%20NameTranslate
' Constants for the NameTranslate object.
' INIT Method Parameters
' To search a specific domain that is not the local one
Const ADS_NAME_INITTYPE_DOMAIN = 1 ' Use objTrans.Init ADS_NAME_INITTYPE_DOMAIN, "MyDomain.com"
' To search a specific domain controller in the local domain
Const ADS_NAME_INITTYPE_SERVER = 2 ' Use objTrans.Init ADS_NAME_INITTYPE_SERVER, "MyServer"
' To search through local domain - should be mainly used
Const ADS_NAME_INITTYPE_GC = 3 ' Use objTrans.Init ADS_NAME_INIITTYPE_GC, ""
If LCase(strObjectType) = "computer" Then
If Right(strName, 1) <> "$" Then strName = strName & "$"
End If
' SET and GET Method Parameters
Const ADS_NAME_TYPE_1779 = 1
Const ADS_NAME_TYPE_CANONICAL = 2
Const ADS_NAME_TYPE_NT4 = 3
Const ADS_NAME_TYPE_DISPLAY = 4
Const ADS_NAME_TYPE_DOMAIN_SIMPL
Const ADS_NAME_TYPE_ENTERPRISE_S
Const ADS_NAME_TYPE_GUID = 7
Const ADS_NAME_TYPE_UNKNOWN = 8
Const ADS_NAME_TYPE_USER_PRINCIP
Const ADS_NAME_TYPE_CANONICAL_EX
Const ADS_NAME_TYPE_SERVICE_PRIN
Const ADS_NAME_TYPE_SID_OR_SID_H
' Use the NameTranslate object to convert the NT user name to the
' Distinguished Name required for the LDAP provider.
Set objTrans = CreateObject("NameTranslat
' Initialize NameTranslate by locating the Global Catalog.
objTrans.Init ADS_NAME_INITTYPE_GC, ""
boolError = False
If LCase(strInputFormat) = "displayname" Then
' Use the Set method to specify the Display Name of the object name.
On Error Resume Next
objTrans.Set ADS_NAME_TYPE_DISPLAY, strName
If Err.Number <> 0 Then boolError = True
On Error GoTo 0
Else ' assume it is the NTName
' Use the Set method to specify the NT format of the object name.
On Error Resume Next
objTrans.Set ADS_NAME_TYPE_NT4, strName
If Err.Number <> 0 Then boolError = True
On Error GoTo 0
End If
If boolError = False Then
' Use the Get method to retrieve the RPC 1779 Distinguished Name.
strUserDN = objTrans.Get(ADS_NAME_TYPE
Else
strUserDN = "ERROR"
End If
' Escape any "/" characters with backslash escape character.
' All other characters that need to be escaped will be escaped.
strUserDN = Replace(strUserDN, "/", "\/")
Get_DistinguishedName_From
End Function
'==================
Regards,
Rob.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
--------------------------
Microsoft Active Directory - Exchange Extension
--------------------------
The specified directory service attribute or value already exists.
Facility: LDAP Provider
ID no: 8007200d
Microsoft Active Directory - Exchange Extension
--------------------------
OK
--------------------------
objUser.PutEx ADS_PROPERTY_APPEND, "protocolSettings", Array(conExInetOWAon)
to this
objUser.PutEx ADS_PROPERTY_APPEND, "protocolSettings", Array(conExInetOWAoff)
and see if that enables it.
Regards,
Rob.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Regards,
Rob.
http://www.computerperformance.co.uk/ScriptsGuy/adsi.zip
extract it to your C:\Windows\System32 folder, run
regsvr32 adsiedit.dll
then run
adsiedit.msc
BE CAREFUL WITH THIS. ONLY EDIT THE ATTRIBUTE YOU WANT TO EDIT.
On the left, go through DOMAIN --> DC=groups,DC=co,DC=uk --> then browse through your OUs until you get to your CN account.
Right-click your CN=Sharath Remi account, and click Properties.
On the "Attribute Editor" tab, scroll down and double-click on protocolSettings
Click any HTTP entry, and click Remove, then click OK, and close ADSIEdit.
Now, hopefully, you can go back to your account in the ordinary ADUC and re-enable OWA.
Regards,
Rob.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Just to clarify, after fixing the issue by using ADSIEdit, are you able to enable and disable OWA normally via the ADUC console? If so, then great. As I don't have Exchange, and can't see the protocolSettings property, can I get you to enable OWA, use ADSIEdit to browse to the protocolSettings attribute and take a screenshot of the values in it. Then, disable OWA from ADUC, and take another screenshot in ADSIEdit, then, remove the OWA protocol completely via ADUC and take another screenshot of ADSIEdit. I would like to see what the values do after these changes.
Regards,
Rob.
I did as mentioned but enabled or disabled i have the same position
Disable and Enabled its the same...

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
HTTP§0§1§§§§§§
and enabled should be:
HTTP§1§1§§§§§§
Note the zero and one difference. Maybe there's another setting.....
Rob.
I just ran it.Got a Done box.Just giving it some time to replicate if required...
I have mentioned the NTlogin in the txt file.Is that right?






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
If strSettings = "" Then
strSettings = conExInetOWAon
Else
strSettings = strSettings & ";" & conExInetOWAon
End If
to this:
If strSettings = "" Then
strSettings = conExInetOWAoff
Else
strSettings = strSettings & ";" & conExInetOWAoff
End If
I had "on" there, instead of "off".
Regards,
Rob.
https://www.experts-exchange.com/questions/24789733/Vbs-or-Batch-script-that-can-check-6-Services-on-each-machine-while-startup-and-log-the-status.html
https://www.experts-exchange.com/questions/24779786/Uninstall-Winrar-remotely-Via-a-script-on-a-set-of-computer-names-in-a-txt-file.html
https://www.experts-exchange.com/questions/24735987/Find-Message-restriction-members-within-them-Active-directory.html

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Visual Basic Classic
--
Questions
--
Followers
Top Experts
Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.