Advertisement
Advertisement
| 04.15.2008 at 12:13PM PDT, ID: 23324893 | Points: 400 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: |
'My Code:
-----------
Option Explicit
On Error Resume Next
Dim strWarning, strStopSend
' get input
strDomainName = InputBox ("Enter Domain Name")
' *** CONNECT TO AD
Const ADS_PROPERTY_CLEAR = 1
'**** Loop: READ EXCEL SHEET LINES ***
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("C:\UserLocator.xls")
objExcel.Visible = True
i = 2
Do Until objExcel.Cells(i, 1).Value = ""
strUserName = objExcel.Cells(i,1) + ", SERVER=" + objExcel.Cells(i,2)
Set objDomain = GetObject("WinNT://" & strDomainName)
objDomain.Filter = Array("User")
blnFound = False
For Each objUser in objDomain
If objUser.Name = strUserName Then
blnFound = True
Exit For
End If
Next
If blnFound = True Then
strWarning = Str(Int(objExcel.Cells(i,3) + 100000))
strStopSend = Str(Int(objExcel.Cells(i,3) + 200000))
Else
objExcel.Cells(i,2) = "FALSE"
End If
i = i + 1
Loop
'Close Objects
Set objADHelper = Nothing
Set objOU = Nothing
objConnection.Close
|
| Microsoft |
| Apple |
| Internet |
| Gamers |
| Digital Living |
| Virus & Spyware |
| Hardware |
| Software |
| ITPro |
| Developer |
| Storage |
| OS |
| Database |
| Security |
| Programming |
| Web Development |
| Networking |
| Other |
| Community Support |
| 04.16.2008 at 05:17PM PDT, ID: 21373124 |
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: |
strComputer = "."
' get input
strDomainName = InputBox ("Enter Domain Name")
' *** CONNECT TO AD
Const ADS_PROPERTY_CLEAR = 1
'**** Loop: READ EXCEL SHEET LINES ***
Set objExcel = CreateObject("Excel.Application")
Const xlUp = -4162
Set objWorkbook = objExcel.Workbooks.Open("C:\UserLocator.xls")
objExcel.Visible = True
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & _
"\ROOT\MicrosoftExchangeV2")
For intRow = 2 To objWorkbook.Cells(65536, "A").End(xlUp).Row
Set colItems = objWMIService.ExecQuery _
("SELECT MailBoxDisplayName,Size FROM Exchange_Mailbox WHERE MailBoxDisplayName='" & objWorkbook.Cells(intRow, "A").Value & "'")
If colItems.Count > 0 Then
For Each objItem in colItems
objOutputFile.Writeline objItem.MailboxDisplayName & "," & objItem.Size
Next
Else
objExcel.Cells(intRow, "B") = "FALSE"
End If
Next
Set objWMIService = Nothing
Set colItems = Nothing
MsgBox "Done"
|
| 04.16.2008 at 05:20PM PDT, ID: 21373134 |
| 04.17.2008 at 05:03AM PDT, ID: 21376098 |
| 04.17.2008 at 07:10AM PDT, ID: 21377228 |
| 04.17.2008 at 05:21PM PDT, ID: 21382478 |
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: |
Option Explicit
'On Error Resume Next
Dim strWarning, strStopSend, strDNSDomain, objRootDSE, strServerName, strContainer, strDomainName
Dim objConnection, objCommand, RootDSE, objExcel, objWorkbook, blnFound
strServerName = "Servername"
strContainer = ",CN=test,dc=test,dc=net"
' get input
strDomainName = InputBox ("Enter Domain Name")
' *** CONNECT TO AD
'Active Directory (AD) Domain ⬠Binds To The Current Domain
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
Set RootDSE = GetObject("LDAP://rootDSE")
strDomainName = RootDSE.Get("DefaultNamingContext")
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
'**** Loop: READ EXCEL SHEET LINES ***
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("C:\temp\UserLocator.xls")
objExcel.Visible = True
i = 2
Do Until objExcel.Cells(i, 1).Value = ""
'strUserName = objExcel.Cells(i,1) + ", SERVER=" + objExcel.Cells(i,2)
If objUser.Name = strUserName Then
strUserName = objExcel.Cells(i,1) + ", SERVER=" + objExcel.Cells(i,2)
Set objDomain = GetObject("WinNT://" & strDomainName)
objDomain.Filter = Array("User")
blnFound = False
For Each objUser in objDomain
If objUser.Name = strUserName Then
blnFound = True
Exit For
End If
Next
If blnFound = True Then
strWarning = Str(Int(objExcel.Cells(i,3) + 100000))
strStopSend = Str(Int(objExcel.Cells(i,3) + 200000))
strServerName = "servername"
strContainer = ", CN=test, dc=test, dc=net"
' get the target mailbox
what = "LDAP://" & strServerName & "/CN=" & strUserName & strContainer
Set objMailbox = GetObject(what)
objMailbox.Put "mDBStorageQuota", strWarning
objMailbox.Put "mDBOverQuotaLimit", strStopSend
'objMailbox.Put "mDBOverHardQuotaLimit", prohibitSendReceiveLimit+10
objMailbox.SetInfo
Else
objExcel.Cells(i,2) = "FALSE"
End If
End If
i = i + 1
Loop
'Close Objects
objConnection.Close
|
| 04.17.2008 at 06:37PM PDT, ID: 21382716 |
| 04.17.2008 at 06:44PM PDT, ID: 21382734 |
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: |
Option Explicit
'On Error Resume Next
Dim strWarning, strStopSend, strDNSDomain, objRootDSE, strServerName, strContainer, strDomainName
Dim objConnection, objCommand, RootDSE, objExcel, objWorkbook, blnFound, i
strServerName = "Servername"
strContainer = ",CN=test,dc=test,dc=net"
' get input
strDomainName = InputBox ("Enter Domain Name")
' *** CONNECT TO AD
'Active Directory (AD) Domain ⬠Binds To The Current Domain
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
Set RootDSE = GetObject("LDAP://rootDSE")
strDomainName = RootDSE.Get("DefaultNamingContext")
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
'**** Loop: READ EXCEL SHEET LINES ***
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("C:\temp\UserLocator.xls")
objExcel.Visible = True
i = 2
Do Until objExcel.Cells(i, 1).Value = ""
'nickName = objExcel.Cells(i,1) + ", SERVER=" + objExcel.Cells(i,2)
If objUser.Name = nickName Then
nickName = objExcel.Cells(i,1) + ", SERVER=" + objExcel.Cells(i,2)
Set objDomain = GetObject("WinNT://" & strDomainName)
objDomain.Filter = Array("User")
blnFound = False
For Each objUser in objDomain
If objUser.Name = nickName Then
blnFound = True
Exit For
End If
Next
If blnFound = True Then
strWarning = Str(Int(objExcel.Cells(i,3) + 100000))
strStopSend = Str(Int(objExcel.Cells(i,3) + 200000))
strServerName = "servername"
strContainer = ", CN=test, dc=test, dc=net"
' get the target mailbox
what = "LDAP://" & strServerName & "/CN=" & nickName & strContainer
Set objMailbox = GetObject(what)
objMailbox.Put "mDBStorageQuota", strWarning
objMailbox.Put "mDBOverQuotaLimit", strStopSend
'objMailbox.Put "mDBOverHardQuotaLimit", prohibitSendReceiveLimit+10
objMailbox.SetInfo
Else
objExcel.Cells(i,2) = "FALSE"
End If
End If
i = i + 1
Loop
'Close Objects
objConnection.Close
|
| 04.17.2008 at 07:13PM PDT, ID: 21382846 |
| 04.17.2008 at 07:20PM PDT, ID: 21382868 |
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: |
Option Explicit
'On Error Resume Next
Dim strWarning, strStopSend, strDNSDomain, objRootDSE, strServerName, strContainer, strDomainName
Dim objConnection, objCommand, RootDSE, objExcel, objWorkbook, blnFound, i
strServerName = "Servername"
strContainer = ",CN=test,dc=test,dc=net"
' get input
strDomainName = InputBox ("Enter Domain Name")
' *** CONNECT TO AD
'Active Directory (AD) Domain ⬠Binds To The Current Domain
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
Set RootDSE = GetObject("LDAP://rootDSE")
strDomainName = RootDSE.Get("DefaultNamingContext")
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
'**** Loop: READ EXCEL SHEET LINES ***
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("C:\temp\UserLocator.xls")
objExcel.Visible = True
i = 2
Set objDomain = GetObject("WinNT://" & strDomainName)
objDomain.Filter = Array("User")
Do Until objExcel.Cells(i, 1).Value = ""
nickName = objExcel.Cells(i,1) + ", SERVER=" + objExcel.Cells(i,2)
blnFound = False
For Each objUser in objDomain
If objUser.Name = nickName Then
blnFound = True
Exit For
End If
Next
If blnFound = True Then
strWarning = Str(Int(objExcel.Cells(i,3) + 100000))
strStopSend = Str(Int(objExcel.Cells(i,3) + 200000))
strServerName = "servername"
strContainer = ", CN=test, dc=test, dc=net"
' get the target mailbox
what = "LDAP://" & strServerName & "/CN=" & nickName & strContainer
Set objMailbox = GetObject(what)
objMailbox.Put "mDBStorageQuota", strWarning
objMailbox.Put "mDBOverQuotaLimit", strStopSend
'objMailbox.Put "mDBOverHardQuotaLimit", prohibitSendReceiveLimit+10
objMailbox.SetInfo
Else
objExcel.Cells(i,2) = "FALSE"
End If
End If
i = i + 1
Loop
'Close Objects
objConnection.Close
|
| 04.17.2008 at 07:41PM PDT, ID: 21382947 |
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: |
Option Explicit
'On Error Resume Next
Dim strWarning, strStopSend, strDNSDomain, objRootDSE, strServerName, strContainer, strWinNTDomain, strDomainName
Dim objConnection, objCommand, RootDSE, objExcel, objWorkbook, blnFound, i
strServerName = "Servername"
strContainer = ",CN=test,dc=test,dc=net"
' get input
Set objNetwork = CreateObject("WScript.Network")
strWinNTDomain = objNetwork.UserDomain
'strWinNTDomain = InputBox ("Enter Domain Name")
' *** CONNECT TO AD
'Active Directory (AD) Domain ⬠Binds To The Current Domain
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
Set RootDSE = GetObject("LDAP://rootDSE")
strDomainName = RootDSE.Get("DefaultNamingContext")
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
'**** Loop: READ EXCEL SHEET LINES ***
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("C:\temp\UserLocator.xls")
objExcel.Visible = True
i = 2
Set objDomain = GetObject("WinNT://" & strWinNTDomain)
objDomain.Filter = Array("User")
Do Until objExcel.Cells(i, 1).Value = ""
nickName = objExcel.Cells(i,1) + ", SERVER=" + objExcel.Cells(i,2)
blnFound = False
For Each objUser in objDomain
If objUser.Name = nickName Then
blnFound = True
Exit For
End If
Next
If blnFound = True Then
strWarning = Str(Int(objExcel.Cells(i,3) + 100000))
|