Converting a string to a hex output

Welcome Forums General PowerShell Q&A Converting a string to a hex output

This topic contains 4 replies, has 2 voices, and was last updated by

 
Participant
1 year, 6 months ago.

  • Author
    Posts
  • #70023

    Participant
    Points: 0
    Rank: Member

    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

    Participant
    Points: 160
    Helping Hand
    Rank: 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

    Participant
    Points: 0
    Rank: Member

    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

    Participant
    Points: 0
    Rank: Member

    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

    Participant
    Points: 0
    Rank: Member

    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!

The topic ‘Converting a string to a hex output’ is closed to new replies.