Advertisement
| 10.24.2008 at 01:13PM PDT, ID: 23845955 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
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: |
Call Run_SetManager
Function Run_SetManager
set conn = CreateObject("ADODB.Connection")
set rsExch = CreateObject("ADODB.Recordset")
set rsADUsr = CreateObject("ADODB.Recordset")
set rsADMGR = CreateObject("ADODB.Recordset")
Set oCmd = CreateObject("ADODB.Command")
Set oCmd1 = CreateObject("ADODB.Command")
conn.Open "Data Source=Active Directory Provider;Provider=ADsDSOObject"
uname = inputbox("Enter the FULL NAME of the user to modify:", "Enter Username")
If uname = "exit" Or uname = "" Or uname = "Exit" Then
Exit Function
End If
if uname <> "" then
strADOQuery = "SELECT adspath, manager, title from 'LDAP://pathtodomain'' WHERE objectCategory='person' AND objectClass='user' AND name = '" & uname & "'"
oCmd.ActiveConnection = conn
oCmd.Properties("SearchScope") = 2
oCmd.CommandText = strADOQuery
set rsADUsr = oCmd.Execute
if rsADUsr.RecordCount = 0 then msgbox "Username not found."
if rsADUsr.RecordCount > 1 then msgbox "Multiple names found. This script can't help you."
if rsADUsr.RecordCount = 1 then
set usr = GetObject(rsADUsr.Fields("ADsPath"))
if isnull(rsADUsr.Fields("manager")) = true then current = ""
if isnull(rsADUsr.Fields("manager")) = false then current = rsADUsr.Fields("manager")
URL = inputbox("DO NOT PRESS CANCEL. PRESSING CANCEL WILL ERASE THIS ATTRIBUTE." & vbcrlf & vbcrlf & "Change Manager for " & uname & " to:", "Change Manager")
strADOQueryMGR = "SELECT adspath from 'LDAP://pathtodc' WHERE objectCategory='person' AND objectClass='user' AND name = '" & URL & "'"
oCmd1.ActiveConnection = conn
oCmd1.Properties("SearchScope") = 2
oCmd1.CommandText = strADOQueryMGR
set rsADMGR = oCmd1.Execute
if rsADMGR.RecordCount = 0 then msgbox "Manager not found."
if rsADMGR.RecordCount > 1 then msgbox "Multiple managers found. This script can't help you."
if rsADMGR.RecordCount = 1 Then
set usrmgr = rsADMGR.Fields("adspath")
end if
if usrmgr <> "" then usr.put "manager", usrmgr
if usrmgr = "" then usr.Putex 1, "manager", ""
usr.SetInfo
msgbox "Manager Update Successful"
set usr = nothing
end if
end If
conn.close
set ocmd = nothing
set ocmd1 = nothing
set rsExch = nothing
set rsADUsr = Nothing
set rsADMGR = nothing
set conn = nothing
End Function
|
Advertisement