Converting a string to a hex output

This topic contains 4 replies, has 2 voices, and was last updated by  Brandon 5 months, 2 weeks ago.

  • Author
    Posts
  • #70023

    Brandon
    Participant

    Hi all!

    I am need of quite a bit of help, I am trying to write a script that takes a plain text field from a CSV file and converts it to HEX so that I can take that HEX string and put it in field in Active Directory. The attribute that I want to fill requires the text to be entered in either HEX, Decimal, Octal, or Binary
    Can anyone help me with that? I am super new to this whole thing and I haven't been able to find anything on google so I don't know if its even possible!

  • #70024

    Rob Simmers
    Participant

    Can you specify what AD attribute you are trying to manipulate? AD cmdlets may already manipulate the attribute properly versus you attempting to manually modify the attribute value.

  • #70027

    Brandon
    Participant

    I am using the New-adUser cmdlet to modify the UserPassword Attribute using the -otherAttributes "field" I guess you could call it.

    IE.)
    $Hexpass = $_.Userpassword + whatever I need to do to convert it to hex
    New-aduser -Identity $_.Samaccountname -Otherattributes @{'UserPassword' = $Hexpass}

    Just to note the userpassword field is two letters followed by 4 numbers like ab1234

  • #70030

    Brandon
    Participant

    I have not actually tried to create an account yet using just what I already have.
    I know that the New-Aduser and the Set-aduser don't attributes for the UserPassword attribute and thats why I need to use the -Otherattribues = @{'UserPassword' = $hexpass}

  • #70035

    Brandon
    Participant

    False Alarm, False Alarm....

    It Appears as though even though I have to use the -otherattribute field in the new-aduser cmdlet and point it to the plain text field of a CSV file it does require me to convert it to HEX or any of the above in order to enter it into AD.

    Thanks for the reality check!

You must be logged in to reply to this topic.