Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: echo Y & net user

  1. #1
    Senior Member
    Join Date
    Mar 2002
    Posts
    442

    echo Y & net user

    del *.*
    asks are you sure

    echo Y|del *.*
    echo's Y to the question of the following command

    net user God 123456789012345
    asks are you sure you want long password

    echo Y|net user God 123456789012345
    gives an error 'No Valid Response Was Provided'

    how can I make a password, greater than 15 characters, into a new account using the 'net' command, without it asking me 'are you sure you want to do the command you just typed?'

  2. #2
    Just a Virtualized Geek MrLinus's Avatar
    Join Date
    Sep 2001
    Location
    Redondo Beach, CA
    Posts
    7,323
    I thought that LanManager only allowed passwords up to 15 characters (one of those ugly legacy things)?
    Goodbye, Mittens (1992-2008). My pillow will be cold without your purring beside my head
    Extra! Extra! Get your FREE copy of Insight Newsletter||MsMittens' HomePage

  3. #3
    Master-Jedi-Pimps0r & Moderator thehorse13's Avatar
    Join Date
    Dec 2002
    Location
    Washington D.C. area
    Posts
    2,885
    True enough, MsMitts, however, rather than generating a real hash, Windows 2000 and XP assign the same string constant for all passwords longer than 15 characters for their LM hash. The command, in theory, should work fine.

    Entrop, just for giggles, try this: (notice the carrot before the pipe)

    net user username password ^| echo Y
    Our scars have the power to remind us that our past was real. -- Hannibal Lecter.
    Talent is God given. Be humble. Fame is man-given. Be grateful. Conceit is self-given. Be careful. -- John Wooden

  4. #4
    Senior Member
    Join Date
    Mar 2002
    Posts
    442
    echo Blah 123456789012345^|echo Y
    echo Blah 123456789012345 ^|echo Y

    It prints the syntax of the command. Same as if I used the wrong syntax.

    "The correct syntax of this command is . . . blah blah"


    LanMan only does allow <15 but for local user accounts, which is what the script is for, allows up to 127 characters. I want to be able to echo the variable in as a password and allow the script to continue to run without user input; it is part of a larger automated script.

    the script pulls the username and password from another program that printf'd it to a file.
    Code:
    .
    .
    .
    set           ="%USER%"
    set           ="%PASS%"
    echo Y|net user "%USER%" "%PASS%" /ADD
    net localgroup "%GROUP%" "%USER%" /ADD
    .
    .
    .
    I am just getting hung up on this single stupid little part.

    The entire script requires no user input, and having a big batch file pop up and ask the user to push 'Y' then return would be an enormous hassle and is not possible.

  5. #5
    Now, RFC Compliant! Noia's Avatar
    Join Date
    Jan 2002
    Posts
    1,210
    you can use:
    echo Y &gt;&gt; somefile.txt
    net user God 123456789012345 &lt;&lt; somefile.txt

    I'v used this in auto-format-install floppies to get it to auto-format the disk.
    With all the subtlety of an artillery barrage / Follow blindly, for the true path is sketchy at best. .:Bring OS X to x86!:.
    Og ingen kan minnast dei linne drag i dronningas andlet den fagre dag Då landet her kvilte i heilag fred og alle hadde kjærleik å elske med.

  6. #6
    Senior Member
    Join Date
    Mar 2002
    Posts
    442
    echo Y &gt; blah.txt
    checked blah.txt, only consists only of Y
    net user blah 123456789012345 /ADD&lt;blah.txt
    'No Valid Response was provided'
    net user blah 123456789012345 /ADD &lt; blah.txt
    'No Valid Response was provided'
    net user blah 123456789012345 /ADD&lt;&lt;blah.txt
    '&lt;&lt;' was unexpected at this time
    net user blah 123456789012345 /ADD &lt;&lt; blah.txt
    '&lt;&lt;' was unexpected at this time

    I swear I am going to hunt down and kill whoever perverted the easy world of dos with this m$ $hit. Anyone know a phone number to one of the programmers over there in redmond ? it can be used as a therapy type thing; stress relief

  7. #7
    Senior Member IKnowNot's Avatar
    Join Date
    Jan 2003
    Posts
    792
    my only thought would be something like

    net user "%USER%" "%PASS%" /YES /ADD

    sorry, that might be

    net user "%USER%" "%PASS%" /ADD /YES

    " And maddest of all, to see life as it is and not as it should be" --Miguel Cervantes

  8. #8
    Master-Jedi-Pimps0r & Moderator thehorse13's Avatar
    Join Date
    Dec 2002
    Location
    Washington D.C. area
    Posts
    2,885
    It prints the syntax of the command. Same as if I used the wrong syntax.

    "The correct syntax of this command is . . . blah blah"
    Crap. Oh well. It was a long shot.

    LanMan only does allow &lt;15 but for local user accounts, which is what the script is for, allows up to 127 characters.
    Yep, I was only talking about the password length, not the account length.

    I'm going to start digging for a solution because now I'm bothered that it's not working.



    --TH13
    ***EDIT***

    OK, I tried two things. The first is I disabled LMHashes in the registry. HKLM\system\currentcontrolset\control\lsa and changed the nolmhash value to 1.

    Next I rebooted and went back to the command prompt.

    Here is what I see:

    C:\WINDOWS\system32>echo Y | net user test 123456789123456789 /add
    The password entered is longer than 14 characters. Computers
    with Windows prior to Windows 2000 will not be able to use
    this account. Do you want to continue this operation? (Y/N) [Y]:
    Hmmm, my theory of the message being tied to LMhash being enabled was instantly killed. I went back and set the value to zero again. (then rebooted)

    I then decided to pass the "Y" after the command thinking that it would bang it to the OS when the nag message appeared. Now, I simply added the | echo Y to the end of the statement and here is what I got:

    C:\WINDOWS\system32>net user test 123456789123456789 /add | echo Y
    Y
    C:\WINDOWS\system32>
    Then I checked to see if the account was really there.

    C:\WINDOWS\system32>net user

    User accounts for \\HORSE

    -------------------------------------------------------------------------------
    Administrator test TheHorse13
    The command completed successfully.

    C:\WINDOWS\system32>[/
    Looks like you're in business!!! What do they say about trying the easy things first? w00t!!

    PS
    In your script, you'll have to add a CRLF so that the "Y" is actually entered and processed.



    Our scars have the power to remind us that our past was real. -- Hannibal Lecter.
    Talent is God given. Be humble. Fame is man-given. Be grateful. Conceit is self-given. Be careful. -- John Wooden

  9. #9
    Senior Member
    Join Date
    Mar 2002
    Posts
    442
    That looks good so far thehorse13, but how do an /r /n into a batch file ?

    The script works in that it enters Y into the question, but how can I force the script to accept that as the answer, or tell the batch file to hit enter; /r /n doesn't work in dos, and it would be ugly to have to do a start /wait c++prog.exe just to hit enter.

    As I said before, having the user hit [enter] is not a possibility.
    *the entire script runs through a cmdow window, which is completely invisible to the user*

  10. #10
    Master-Jedi-Pimps0r & Moderator thehorse13's Avatar
    Join Date
    Dec 2002
    Location
    Washington D.C. area
    Posts
    2,885
    AHA!!!


    C:\WINDOWS\system32>net user test 123456789123456789 /add /y
    The command completed successfully.


    C:\WINDOWS\system32>

    This is *exactly* what you are looking for.
    Our scars have the power to remind us that our past was real. -- Hannibal Lecter.
    Talent is God given. Be humble. Fame is man-given. Be grateful. Conceit is self-given. Be careful. -- John Wooden

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •