Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Fellow Monks, I've been in the windoze prison for some time now and I'm looking to escape! I have been forced to create a VBscript that creates AD accounts and the quickest way I could find a solution was to use VBscript (hence the windoze prison). Is there a way to do the same thing but in Perl instead? I only included the code that actually creates the accounts (this is the piece I'd rather have in Perl), any examples would be helpful, thanks!!
'------------------------------------------------------ ' Add piece to create users here Const ADS_PROPERTY_UPDATE = 2 Const ADS_PROPERTY_APPEND = 3 'Bind to OU Where new User will be placed (domain users) '----------------------------- Set objOU = GetObject("LDAP://OU=Domain Users,DC=HEADQUARTERS,DC=YOURC +OMPANY,DC=com") 'Create New User and set specific information '-------------------------------------------------- Set objUser = objOU.Create("User","cn=" & strName) objUser.Put "sAMAccountName", strNetId objUser.SetInfo objUser.AccountDisabled = False objUser.SetInfo objUser.SetPassword strPass objUser.Put "mail", strNetId & "" objUser.Put "givenName",strFName objUser.Put "sn", strLName objUser.Put "displayName",strName objUser.Put "userPrincipalName",strNetId & "" objUser.SetInfo ' Add that user to their respective global security group Set objGroup = GetObject("LDAP://cn=" & strUserDir & ",OU=Domain Users +,DC=HEADQUARTERS,DC=YOURCOMPANY,DC=com") objGroup.PutEx ADS_PROPERTY_APPEND, "member", _ Array("cn=" & strName & ",ou=domain users,dc=HEADQUARTERS,dc=YOURC +OMPANY,dc=com") objGroup.SetInfo ' Add that user to general users group Set objGroup = GetObject("LDAP://cn=General,cn=users,DC=HEADQUARTERS,D +C=YOURCOMPANY,DC=com") objGroup.PutEx ADS_PROPERTY_APPEND, "member", _ Array("cn=" & strName & ",ou=Domain Users,dc=HEADQUARTERS,dc=YOURC +OMPANY,dc=com") objGroup.SetInfo '--------------------------------------------------

In reply to convert VBscript to Perl by softworkz

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others taking refuge in the Monastery: (5)
    As of 2018-07-16 09:22 GMT
    Find Nodes?
      Voting Booth?
      It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

      Results (333 votes). Check out past polls.