Announcement

Collapse
No announcement yet.

scipt to ask for input

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • scipt to ask for input

    okay mine is sort of hard. i ahve a script that disable a user account in AD and hides from directory.

    i am trying to get an input box and then have that put in script so it is universal and i can use it for anyone that needs disabled ...where i just put in the name. here is the script i am using .



    Const ADS_UF_ACCOUNTDISABLE = 2

    Set objUser = GetObject _
    ("LDAP://cn=fall guy,cn= users,dc=test,dc=local")
    intUAC = objUser.Get("userAccountControl")

    objUser.Put "userAccountControl", intUAC OR ADS_UF_ACCOUNTDISABLE
    objUser.SetInfo

    objUser.HideFromAddressBook = True
    objUser.SetInfo


    it works fine if i change fall guy name to the name i want but i would rather just have an input box and it put the result there and run ... any help would be great .

  • #2
    Re: scipt to ask for input

    Copy and save this into a text file and save as a .vbs file extension. By entering the display name in the Input Box, the value entered in the Input Box is used as the CN. This has been highlighted in red text.

    If no value is entered in the input box, a message will be displayed 'No Display Name Entered', you may modify these to meet your needs by modifying the bold text

    I have just tested this in a virtual server Windows Server 2003 Enterprise Edition with Service Pack 1 and the user object is successfully disabled, as Microsoft Exchange is not installed I have been unable to test enabling the option to hide from address book but this should work.

    Please test the script prior to using in a production environment.

    StrobjUser = InputBox("Enter Display Name:")
    If StrobjUser ="" Then
    WScript.Echo "No Display Name Entered"
    Else
    Const ADS_UF_ACCOUNTDISABLE = 2
    Set objUser = GetObject _
    ("LDAP://cn=" & StrobjUser &",cn= users,dc=test,dc=local")
    intUAC = objUser.Get("userAccountControl")
    objUser.Put "userAccountControl", intUAC OR ADS_UF_ACCOUNTDISABLE
    objUser.SetInfo
    objUser.HideFromAddressBook = True
    objUser.SetInfo
    End If
    MCSA 2000/2003

    Comment

    Working...
    X