Solved

VBscript Disable user

Posted on 2009-05-20
30
703 Views
Last Modified: 2012-05-07
Good Morning All

i have this script at the bottom that disables a user,removes memberships, and hides from exchange, i would like to add a confirmation box like so, if they click yes proceed with script if no end script , any ideas?

Disable user John Doe, JDOE, JDOE@ABC.COM. with Employee Number 12345
                            Yes   No
'This Script will disable and move a user, also remove memberships accept Domain Users and hide from Exchange Addressbook

On Error Resume Next

Const ADS_PROPERTY_DELETE = 4

Const E_ADS_PROPERTY_NOT_FOUND  = &h8000500D

 

While Username =""

UserName=InputBox ("Enter Username (samAccountName): ", "Account Disable")

IF LEN(Trim(UserName)) <=0 Then wscript.echo "A user account must be entered." 

wend
 

Incident=InputBox ("Enter Incident ID: ", "")

IF LEN(Trim(UserName)) <=0 Then wscript.echo "A Incident ID Must be Entered."
 

SET adoCon = CreateObject("ADODB.Connection")

SET adoCmd =   CreateObject("ADODB.Command")

adoCon.Provider = "ADsDSOObject"

adoCon.Open "Active Directory Provider"

SET adoCmd.ActiveConnection = adoCon

adoCmd.Properties("Page Size") = 1000

adoCmd.Properties("Timeout") = 30

adoCmd.Properties("Cache Results") = False

 

SET objRootDSE = GetObject("LDAP://RootDSE")

strDNSDomain = objRootDSE.Get("defaultNamingContext")

strFilter = "(&(sAMAccountType=805306368)(SAMAccountName=" & UserName & "))"

strFields = "distinguishedName, ADsPath"
 
 
 

'Change this OU Name
 

'strNewOUDN="OU=voIP,DC=mastec,DC=local"

strQuery = "<LDAP://" & strDNSDomain & ">;" & strFilter & ";" & strFields & ";subtree"

adoCmd.CommandText = strQuery

SET adoRec = adoCmd.Execute

If adoRec.EOF Then ' User not found in AD

			WScript.Echo "No Records Found"

			Else

		DO UNTIL adoRec.EOF

      SET objUser = GetObject(adoRec.Fields("ADsPath").Value)

      arrMemberOf = objUser.GetEx("memberOf")

      If Not Err.Number = E_ADS_PROPERTY_NOT_FOUND Then

            For Each Group in arrMemberOf

                  Set objGroup = GetObject("LDAP://" & Group) 

                  objGroup.PutEx ADS_PROPERTY_DELETE, "member", Array(adoRec.Fields("distinguishedName").Value)

                  objGroup.SetInfo

            Next
 
 

      End If
 

' command below reads what is in there and copies appends it to the incident
 

sMydata = objUser.info

sMydata = sMydata
 
 
 

objUser.info = sMydata & vbcrlf & Incident 

objUser.SetInfo

      objUser.AccountDisabled = TRUE

      objUser.HideFromAddressBook = True

      objUser.SetInfo

      SET objCont = GetObject("LDAP://" & strNewOUDN)

      objCont.MoveHere adoRec.Fields("ADsPath").Value, vbNullString

      Msgbox "Account disabled", vbInformation, "Confirmation"

      Msgbox "Did you Check Oracle?", vbInformation, "Confirmation"

      Msgbox "Did you Check Blackberry Account?", vbInformation, "Confirmation"

      adoRec.MoveNext

LOOP

adoRec.Close

SET adoRec = Nothing

adoCon.Close

SET adoCon = Nothing
 
 
 

end if

Open in new window

0
Comment
Question by:EfrenM
  • 18
  • 12
30 Comments
 
LVL 6

Accepted Solution

by:
Mark Pavlak earned 500 total points
ID: 24432641
Why dont you make the script a Sub and then use a msgbox to start it.  I tried to guess where the actual work began.  and I did not know or see the variables for the email and Emp ID, if you worte this then you should be able to ed the MsgBox fairly easily.  the DIm Sreturn is for the return value from the message box.  At line 34 it pulls the confirmation and the if statment below handles the work if VBok then do_Work () else quit
'This Script will disable and move a user, also remove memberships accept Domain Users and hide from Exchange Addressbook

On Error Resume Next

Dim sReturn

Const ADS_PROPERTY_DELETE = 4

Const E_ADS_PROPERTY_NOT_FOUND  = &h8000500D

 

While Username =""

UserName=InputBox ("Enter Username (samAccountName): ", "Account Disable")

IF LEN(Trim(UserName)) <=0 Then wscript.echo "A user account must be entered." 

wend

 

 
 

 

 

Incident=InputBox ("Enter Incident ID: ", "")

IF LEN(Trim(UserName)) <=0 Then wscript.echo "A Incident ID Must be Entered."

 

SET adoCon = CreateObject("ADODB.Connection")

SET adoCmd =   CreateObject("ADODB.Command")

adoCon.Provider = "ADsDSOObject"

adoCon.Open "Active Directory Provider"

SET adoCmd.ActiveConnection = adoCon

adoCmd.Properties("Page Size") = 1000

adoCmd.Properties("Timeout") = 30

adoCmd.Properties("Cache Results") = False

 

SET objRootDSE = GetObject("LDAP://RootDSE")

strDNSDomain = objRootDSE.Get("defaultNamingContext")

strFilter = "(&(sAMAccountType=805306368)(SAMAccountName=" & UserName & "))"

strFields = "distinguishedName, ADsPath"

 

 sReturn = MsgBox ("Are you sure you want to disable: " & Username& " ?",vbOK)

  If sReturn = vbOK Then 'if this isnt working sub 1 for VBok

  	Do_Work()

  Else

  	WScript.Quit

  End if

 

'Change this OU Name

 Sub Do_Work ()

'strNewOUDN="OU=voIP,DC=mastec,DC=local"

strQuery = "<LDAP://" & strDNSDomain & ">;" & strFilter & ";" & strFields & ";subtree"

adoCmd.CommandText = strQuery

SET adoRec = adoCmd.Execute

If adoRec.EOF Then ' User not found in AD

			WScript.Echo "No Records Found"

			Else

		DO UNTIL adoRec.EOF

      SET objUser = GetObject(adoRec.Fields("ADsPath").Value)

      arrMemberOf = objUser.GetEx("memberOf")

      If Not Err.Number = E_ADS_PROPERTY_NOT_FOUND Then

            For Each Group in arrMemberOf

                  Set objGroup = GetObject("LDAP://" & Group) 

                  objGroup.PutEx ADS_PROPERTY_DELETE, "member", Array(adoRec.Fields("distinguishedName").Value)

                  objGroup.SetInfo

            Next

 

 

      End If

 

' command below reads what is in there and copies appends it to the incident

 

sMydata = objUser.info

sMydata = sMydata

 

 

 

objUser.info = sMydata & vbcrlf & Incident 

objUser.SetInfo

      objUser.AccountDisabled = TRUE

      objUser.HideFromAddressBook = True

      objUser.SetInfo

      SET objCont = GetObject("LDAP://" & strNewOUDN)

      objCont.MoveHere adoRec.Fields("ADsPath").Value, vbNullString

      Msgbox "Account disabled", vbInformation, "Confirmation"

      Msgbox "Did you Check Oracle?", vbInformation, "Confirmation"

      Msgbox "Did you Check Blackberry Account?", vbInformation, "Confirmation"

      adoRec.MoveNext

LOOP

adoRec.Close

SET adoRec = Nothing

adoCon.Close

SET adoCon = Nothing

 

 

 

end If

End Sub

Open in new window

0
 
LVL 2

Author Closing Comment

by:EfrenM
ID: 31583513
well its a frankenstein, still learning vbscript, just started on VB also =\   not sure what the end sub does hehe, but it worked thnx a mill i will keep praticing with the code you provided =]
0
 
LVL 6

Expert Comment

by:Mark Pavlak
ID: 24433356
What I did was isolate the actual work you are doing to the Users account by putting it in a sub routine.  Subs are declared by
sub MYSUB ()
code......
end sub
Then using the msgBox as a function and vbOK button (which reuturns a value based on what you click) and set it to a variable.  Once the variable value was set I used an IF Else to handle it apporiately.  Glad it worked 1st time around.  
0
 
LVL 2

Author Comment

by:EfrenM
ID: 24433681
hehe spoke to soon it doesnt move to the Sub Do_Work () i believe, the cancel works prefect
0
 
LVL 6

Expert Comment

by:Mark Pavlak
ID: 24433713
Easy look on line 34 change the vbOk to a 1 like the comment stated.  If it still doesnt work dont worry you already gave me the points I WILL GET IT TO WORK, promise
0
 
LVL 2

Author Comment

by:EfrenM
ID: 24433730
no luck, :(  and thnx
0
 
LVL 6

Expert Comment

by:Mark Pavlak
ID: 24433744
Does the cancel work?
0
 
LVL 2

Author Comment

by:EfrenM
ID: 24433749
i am guessing it does, let me change it to a echo to confirm
0
 
LVL 2

Author Comment

by:EfrenM
ID: 24433760
yea the cancel is working
0
 
LVL 2

Author Comment

by:EfrenM
ID: 24433767
i changed the  do_work to a echo and it also works
0
 
LVL 6

Expert Comment

by:Mark Pavlak
ID: 24433773
Try this I just verified that it enters do_Work
'This Script will disable and move a user, also remove memberships accept Domain Users and hide from Exchange Addressbook

On Error Resume Next

Dim sReturn

Const ADS_PROPERTY_DELETE = 4

Const E_ADS_PROPERTY_NOT_FOUND  = &h8000500D

 

While Username =""

UserName=InputBox ("Enter Username (samAccountName): ", "Account Disable")

IF LEN(Trim(UserName)) <=0 Then wscript.echo "A user account must be entered." 

wend

 

 

 

 

 

Incident=InputBox ("Enter Incident ID: ", "")

IF LEN(Trim(UserName)) <=0 Then wscript.echo "A Incident ID Must be Entered."

 

SET adoCon = CreateObject("ADODB.Connection")

SET adoCmd =   CreateObject("ADODB.Command")

adoCon.Provider = "ADsDSOObject"

adoCon.Open "Active Directory Provider"

SET adoCmd.ActiveConnection = adoCon

adoCmd.Properties("Page Size") = 1000

adoCmd.Properties("Timeout") = 30

adoCmd.Properties("Cache Results") = False

 

SET objRootDSE = GetObject("LDAP://RootDSE")

strDNSDomain = objRootDSE.Get("defaultNamingContext")

strFilter = "(&(sAMAccountType=805306368)(SAMAccountName=" & UserName & "))"

strFields = "distinguishedName, ADsPath"

 

 sReturn = MsgBox ("Are you sure you want to disable: " & Username& " ?",vbOK)

  If sReturn = 1 Then 

  	Do_Work()

  Else

  	WScript.Quit

  End if

 

'Change this OU Name

 Sub Do_Work ()

'strNewOUDN="OU=voIP,DC=mastec,DC=local"
 

strQuery = "<LDAP://" & strDNSDomain & ">;" & strFilter & ";" & strFields & ";subtree"

adoCmd.CommandText = strQuery

SET adoRec = adoCmd.Execute

If adoRec.EOF Then ' User not found in AD

			WScript.Echo "No Records Found"

			Else

		DO UNTIL adoRec.EOF

      SET objUser = GetObject(adoRec.Fields("ADsPath").Value)

      arrMemberOf = objUser.GetEx("memberOf")

      If Not Err.Number = E_ADS_PROPERTY_NOT_FOUND Then

            For Each Group in arrMemberOf

                  Set objGroup = GetObject("LDAP://" & Group) 

                  objGroup.PutEx ADS_PROPERTY_DELETE, "member", Array(adoRec.Fields("distinguishedName").Value)

                  objGroup.SetInfo

            Next

 

 

      End If

 

' command below reads what is in there and copies appends it to the incident

 

sMydata = objUser.info

sMydata = sMydata

 

 

 

objUser.info = sMydata & vbcrlf & Incident 

objUser.SetInfo

      objUser.AccountDisabled = TRUE

      objUser.HideFromAddressBook = True

      objUser.SetInfo

      SET objCont = GetObject("LDAP://" & strNewOUDN)

      objCont.MoveHere adoRec.Fields("ADsPath").Value, vbNullString

      Msgbox "Account disabled", vbInformation, "Confirmation"

      Msgbox "Did you Check Oracle?", vbInformation, "Confirmation"

      Msgbox "Did you Check Blackberry Account?", vbInformation, "Confirmation"

      adoRec.MoveNext

LOOP

adoRec.Close

SET adoRec = Nothing

adoCon.Close

SET adoCon = Nothing

 

 

 

end If

End Sub
 

'' SIG '' Begin signature block

'' SIG '' MIIJxAYJKoZIhvcNAQcCoIIJtTCCCbECAQExCzAJBgUr

'' SIG '' DgMCGgUAMGcGCisGAQQBgjcCAQSgWTBXMDIGCisGAQQB

'' SIG '' gjcCAR4wJAIBAQQQTvApFpkntU2P5azhDxfrqwIBAAIB

'' SIG '' AAIBAAIBAAIBADAhMAkGBSsOAwIaBQAEFATZ0TdPJSE3

'' SIG '' VXwelun/amYop5rnoIIHLjCCA04wggK3oAMCAQICAQow

'' SIG '' DQYJKoZIhvcNAQEFBQAwgc4xCzAJBgNVBAYTAlpBMRUw

'' SIG '' EwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNh

'' SIG '' cGUgVG93bjEdMBsGA1UEChMUVGhhd3RlIENvbnN1bHRp

'' SIG '' bmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2Vy

'' SIG '' dmljZXMgRGl2aXNpb24xITAfBgNVBAMTGFRoYXd0ZSBQ

'' SIG '' cmVtaXVtIFNlcnZlciBDQTEoMCYGCSqGSIb3DQEJARYZ

'' SIG '' cHJlbWl1bS1zZXJ2ZXJAdGhhd3RlLmNvbTAeFw0wMzA4

'' SIG '' MDYwMDAwMDBaFw0xMzA4MDUyMzU5NTlaMFUxCzAJBgNV

'' SIG '' BAYTAlpBMSUwIwYDVQQKExxUaGF3dGUgQ29uc3VsdGlu

'' SIG '' ZyAoUHR5KSBMdGQuMR8wHQYDVQQDExZUaGF3dGUgQ29k

'' SIG '' ZSBTaWduaW5nIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GN

'' SIG '' ADCBiQKBgQDGuLknYK8L45FpZdt+je2R5qrxvtXt/m3U

'' SIG '' LH/RcHf7JplXtN0/MLjcIepojYGS/C5LkTWEIPLaSrq0

'' SIG '' /ObaiPIgxSGSCUeVoAkcpnm+sUwd/PGKblTSaaHxTJM6

'' SIG '' Qf591GR7Y0X3YGAdMR2k6dMPi/tuJiSzqP/l5ZDUtMLc

'' SIG '' UGCuWQIDAQABo4GzMIGwMBIGA1UdEwEB/wQIMAYBAf8C

'' SIG '' AQAwQAYDVR0fBDkwNzA1oDOgMYYvaHR0cDovL2NybC50

'' SIG '' aGF3dGUuY29tL1RoYXd0ZVByZW1pdW1TZXJ2ZXJDQS5j

'' SIG '' cmwwHQYDVR0lBBYwFAYIKwYBBQUHAwIGCCsGAQUFBwMD

'' SIG '' MA4GA1UdDwEB/wQEAwIBBjApBgNVHREEIjAgpB4wHDEa

'' SIG '' MBgGA1UEAxMRUHJpdmF0ZUxhYmVsMi0xNDQwDQYJKoZI

'' SIG '' hvcNAQEFBQADgYEAdrKc7hOfG/YtNJKURXM03I5rLlz8

'' SIG '' TH2J68No8deZDy4dF8i1Fou+zYoFBvIZSToDWwXJII5t

'' SIG '' UuF2gaDDZYoiZ+QcU1M3Rr+81y/re57QFEVsQCEI4l11

'' SIG '' dmYwHvTfgoovvfOiDL8d258UoppyN02wd0joSj8JzlUZ

'' SIG '' LO/mByThr+wwggPYMIIDQaADAgECAhB85OxeaEhr//bp

'' SIG '' 99NY8m8pMA0GCSqGSIb3DQEBBQUAMFUxCzAJBgNVBAYT

'' SIG '' AlpBMSUwIwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAo

'' SIG '' UHR5KSBMdGQuMR8wHQYDVQQDExZUaGF3dGUgQ29kZSBT

'' SIG '' aWduaW5nIENBMB4XDTA4MDYwNTAwMDAwMFoXDTA5MDUz

'' SIG '' MDIzNTk1OVowgaAxCzAJBgNVBAYTAlVTMRcwFQYDVQQI

'' SIG '' Ew5Ob3J0aCBDYXJvbGluYTEXMBUGA1UEBxMORWxpemFi

'' SIG '' ZXRoIENpdHkxKDAmBgNVBAoTH0dhdGV3YXkgRmluYW5j

'' SIG '' aWFsIEhvbGRpbmdzIEluYy4xCzAJBgNVBAsTAklUMSgw

'' SIG '' JgYDVQQDEx9HYXRld2F5IEZpbmFuY2lhbCBIb2xkaW5n

'' SIG '' cyBJbmMuMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB

'' SIG '' CgKCAQEA1asfrPULdZzPm7QfWBbbg+QXqtJBXAe2BDne

'' SIG '' tIBRGkTKPXqiruEvC4gahuHiLXWRFviusVNCMynbbDLo

'' SIG '' /UzUKflSXJIabAknmCYBPEgn7j9O6xhdWRPNb11TV2Wu

'' SIG '' rR9+EuiZ1EXNMmtKqMrtJEtoqe+Bsu//mQuhCjsHhMne

'' SIG '' mvXs6P5/F+YqcAlAwsQgOnqmMo/KbHZ/rPYrI6fB7zMq

'' SIG '' thWo6fdhMG0y6XKkvGxhB9MsmwVSSm0H66H7l04N15MS

'' SIG '' EJLDuUeF9KJATZ1b7MTayXOgnO+jbs8GiiS3aG0YJfHB

'' SIG '' 4EjuaLyyZ3zrrI/fvcoVMMaXrVMwLdFj9Q4lToI01wID

'' SIG '' AQABo4HYMIHVMAwGA1UdEwEB/wQCMAAwPgYDVR0fBDcw

'' SIG '' NTAzoDGgL4YtaHR0cDovL2NybC50aGF3dGUuY29tL1Ro

'' SIG '' YXd0ZUNvZGVTaWduaW5nQ0EuY3JsMB8GA1UdJQQYMBYG

'' SIG '' CCsGAQUFBwMDBgorBgEEAYI3AgEWMB0GA1UdBAQWMBQw

'' SIG '' DjAMBgorBgEEAYI3AgEWAwIHgDAyBggrBgEFBQcBAQQm

'' SIG '' MCQwIgYIKwYBBQUHMAGGFmh0dHA6Ly9vY3NwLnRoYXd0

'' SIG '' ZS5jb20wEQYJYIZIAYb4QgEBBAQDAgQQMA0GCSqGSIb3

'' SIG '' DQEBBQUAA4GBAHZiwWiiv64tSVDSiryF/MMP18u+Yzo6

'' SIG '' OkswDfk/dlCXOnp8HDGyNafT9ABsDfJziBD4ror0mXxi

'' SIG '' 0HzqG6NB2yKm3CWMXaZVYJmtKz2bs9NrQOJDfEEuPTwS

'' SIG '' 3TegCxFk5OLdIlQmwevsf92b3dZRIpAuxDNDnVKXmg9F

'' SIG '' ySSEG6XLMYICAjCCAf4CAQEwaTBVMQswCQYDVQQGEwJa

'' SIG '' QTElMCMGA1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0

'' SIG '' eSkgTHRkLjEfMB0GA1UEAxMWVGhhd3RlIENvZGUgU2ln

'' SIG '' bmluZyBDQQIQfOTsXmhIa//26ffTWPJvKTAJBgUrDgMC

'' SIG '' GgUAoHAwEAYKKwYBBAGCNwIBDDECMAAwGQYJKoZIhvcN

'' SIG '' AQkDMQwGCisGAQQBgjcCAQQwHAYKKwYBBAGCNwIBCzEO

'' SIG '' MAwGCisGAQQBgjcCARYwIwYJKoZIhvcNAQkEMRYEFDAv

'' SIG '' EbnEya+RC2Hg2eUUnsEg+pGGMA0GCSqGSIb3DQEBAQUA

'' SIG '' BIIBALlGlVsM4KvUIxYLt/G0jmHiRm82kjXTTG75Iioy

'' SIG '' NKQssxlr+6/5JWw7RGszwtw0A+EoAWeKIFLcWRpRSITa

'' SIG '' 3tJ/nm1/SNBwPtWX057tZr8/dA+ornhYYbmgUYtLHr2S

'' SIG '' gX2tncWQQKymw/qLWoMTnYuuH5OpsCkELolKWuiM9oC+

'' SIG '' gYdMhOGyfEv13t0zs8k4AO9WZddCR+azoyeoMZ9m24aJ

'' SIG '' R6BxyEbl3bR+bA4g3u7UoixehEWOVK5o4nS4giqtuiO5

'' SIG '' Wwf0VvwMNtd0Ph0VSjc5pXE3s0WSIAMSGeI/w0mieOWn

'' SIG '' AjDg7+LLBDljp23iWpM7wiEIXG+Uv5fL1cQqGAs=

'' SIG '' End signature block

Open in new window

0
 
LVL 2

Author Comment

by:EfrenM
ID: 24433814
hmm your right, if i put wscript.echo under the do_work it runs it, so im guessing the rest of my script is getting cancled out some how.
0
 
LVL 6

Expert Comment

by:Mark Pavlak
ID: 24433911
Maybe I split the sub off too soon?  Echo off your vaiables espically the one for the SamAccount name If they are empty you may need to Dim them so they become global.
0
 
LVL 2

Author Comment

by:EfrenM
ID: 24434393
i dont think the results from the text box are being sent to
strFilter = "(&(sAMAccountType=805306368)(SAMAccountName=" & username & "))"
0
 
LVL 6

Expert Comment

by:Mark Pavlak
ID: 24434569
Did it work beofre I did the encapsulation?  I wouldnt think so since that is outside of the statement.  What all is this script Suppose to do.  It is written differently than I would have wrote it.  I may be able to re-write the whole thing.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 2

Author Comment

by:EfrenM
ID: 24434631
no need to rewrite the whole thing =]~,

i did notice if i input the user manually it works, so from what i understand so far the results are getting lost.
strFilter = "(&(sAMAccountType=805306368)(SAMAccountName=" & "JDOE" & "))"
0
 
LVL 6

Expert Comment

by:Mark Pavlak
ID: 24435094
try editing line 3 to
dim sReturn,username
0
 
LVL 2

Author Comment

by:EfrenM
ID: 24435399
no luck :( wonder how i can call it hmmm
0
 
LVL 6

Expert Comment

by:Mark Pavlak
ID: 24435498
under line 8 add
wscript.echo username
then run the script so that you can see if it passing the value back.  Ifit does there on the first line under sub do_Work add the same thing to make sure it is holding when the Sub is entered
0
 
LVL 2

Author Comment

by:EfrenM
ID: 24435525
hmm it is passing it, after the sub
0
 
LVL 6

Expert Comment

by:Mark Pavlak
ID: 24435575
is the value the same if you statically enter it ie jDoe
0
 
LVL 2

Author Comment

by:EfrenM
ID: 24435655
i am thinking it might not be connecting to the server.
0
 
LVL 2

Author Comment

by:EfrenM
ID: 24435873
i think i have a idea whats going on

strFilter = "(&(sAMAccountType=805306368)(SAMAccountName=" & UserName & "))" looks for
UserName=InputBox ("Enter Username (samAccountName): ", "Account Disable")

and since it is not in the sub section doesnt find it, atleast thats what i am thinking
0
 
LVL 2

Author Comment

by:EfrenM
ID: 24435924
omg i am so sorry, it does work. i just didnt notice that it did because my popups did not pop up , sorry ill give you exctra points for your help thou,
0
 
LVL 2

Author Comment

by:EfrenM
ID: 24436070
nvm all it was the Sub Do_Work move it above the Set Objroot, see code below
now it picks up the information, wonder why my popup boxes are not working hehe, thats fine ill just add them after the end sub
 Sub Do_Work

'''''''''''''''''

SET objRootDSE = GetObject("LDAP://RootDSE")

strDNSDomain = objRootDSE.Get("defaultNamingContext")

strFilter = "(&(sAMAccountType=805306368)(SAMAccountName=" & UserName & "))"

strFields = "distinguishedName, ADsPath"

Open in new window

0
 
LVL 6

Expert Comment

by:Mark Pavlak
ID: 24436079
Yeah that might help.  So is it working now?
0
 
LVL 2

Author Comment

by:EfrenM
ID: 24436145
yea it is working, had to add my pop-ups at the end thou hehe, they wont run in the sub
0
 
LVL 2

Author Comment

by:EfrenM
ID: 24436297
hey quick question,
what do you use to write vb? notepad? if you know of any good ones please let me knoew =]
0
 
LVL 6

Expert Comment

by:Mark Pavlak
ID: 24436659
I use PrimalScript by Sapien Technologies.  It is expensive $399 a copy, but it has alot of good features like colorcoding variables, autocomplete on objects, and Line grouping.
0
 
LVL 2

Author Comment

by:EfrenM
ID: 24436665
nice, yea i was googling and saw the suggested that alot.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now