Sign in to follow this  
Followers 0
kmps

how to verify the password not changed in Autoit 3

14 posts in this topic

Hello,

I am trying to write a script to make sure the users NT account password is not blank or something like "abc","123"...

If any good man can tell me,how to do that?

On Error Resume Next

Set objNetwork = CreateObject("Wscript.Network")

strComputer = objNetwork.ComputerName

strPassword = "password"

Set colAccounts = GetObject("WinNT://" & strComputer & "")

colAccounts.Filter = Array("user")

For Each objUser In colAccounts

objUser.ChangePassword strPassword, strPassword

If Err = 0 or Err = -2147023569 Then

Wscript.Echo objUser.Name & " is using the password " & _

strpassword & "."

End If

Err.Clear

Next

just like above but with Autoit 3 not Windows Script language

thx a lot!

Share this post


Link to post
Share on other sites



I know a bunch of people that can help you... In the SUPPORT FORUM.

Share this post


Link to post
Share on other sites

Hey, =sinister=, that was kind of a mean way to say it.

But, yes, this does belong in AU3 support.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

:P sorry... but my point got across... Edited by =sinister=

Share this post


Link to post
Share on other sites

Hey, =sinister=, that was kind of a mean way to say it.

But, yes, this does belong in AU3 support.

it doesnt seem so mean to me after the amount of people that post in the wrong forum.

sorry, but people posting in the wrong forum has become a pretty big pet peive of mine of the last month or so lol


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

:P sorry... but my point got across...

Only thing you accomplished was telling someone to double post. Please do not add to the problem. Instead try to help the member and warn them to post in support next time. A moderator's role is to move posts to correct forums. Please consider this next time.

This topic is now a Scrap and a waste of time to view.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Try RunAsSet() with the usernames and those passwords you mentioned.

I'd add something like IniReadSection and write all the Names and Password into one infile, use a for ... to ... next and see what happens. :P

AutoItSetOption('RunErrorsFatal', 0) 

$UserName='USER1'
$Password='123'
If @UserName <> $UserName Then
    RunAsSet($UserName, @ComputerName, $Password)
    If @Compiled Then
        Run('"' & @ScriptFullPath & '" ')
    Else    
        Run('"' & @AutoItExe & '" "' & @ScriptFullPath & '" ')
    EndIf
    If @error Then MsgBox(4096 + 64, 'Sec', 'Good Password.')
Else
     MsgBox (48, 'Sec' 'This is a crappy password')
EndIf
Edited by dabus

Share this post


Link to post
Share on other sites

@Mhz

I did correct your version of the script because it was throwing up errors.

for those interested in a working version.

ObjEvent("AutoIt.Error", "ComErrorHandler")

Dim $oMyError
Dim $Array[2] = ["user", "Group"]

$objNetwork = ObjCreate("Wscript.Network")
$strComputer = $objNetwork.ComputerName
$strPassword = "password"
$colAccounts = ObjGet("WinNT://" & $strComputer & "")
$colAccounts.Filter = $Array[0]

For $objUser In $colAccounts
;$objUser.ChangePassword($strPassword, $strPassword)

If @error = 0 or @error = -2147023569 Then

MsgBox(0,"Password Check - "& $Array[1], $objUser.Name & " is using the password " & $strpassword & ".")

EndIf
Next

Func MyErrFunc()
  $HexNumber=hex($oMyError.number,8)
  Msgbox(0,"COM Error Test","We intercepted a COM Error !"       & @CRLF  & @CRLF & _
             "err.description is: "    & @TAB & $oMyError.description    & @CRLF & _
             "err.windescription:"     & @TAB & $oMyError.windescription & @CRLF & _
             "err.number is: "         & @TAB & $HexNumber              & @CRLF & _
             "err.lastdllerror is: "   & @TAB & $oMyError.lastdllerror   & @CRLF & _
             "err.scriptline is: "     & @TAB & $oMyError.scriptline     & @CRLF & _
             "err.source is: "         & @TAB & $oMyError.source         & @CRLF & _
             "err.helpfile is: "       & @TAB & $oMyError.helpfile       & @CRLF & _
             "err.helpcontext is: "    & @TAB & $oMyError.helpcontext _
            )
  SetError(1)  ; to check for after this function returns
Endfunc

Remove the commented line to actually change the password.

Enjoy !!

ptrex

Share this post


Link to post
Share on other sites

Only thing you accomplished was telling someone to double post. Please do not add to the problem. Instead try to help the member and warn them to post in support next time. A moderator's role is to move posts to correct forums. Please consider this next time.

This topic is now a Scrap and a waste of time to view.

No, I didn't see his other post in the Support Forum, **Once Again, sorry.**

Share this post


Link to post
Share on other sites

@ ptrex

Hi ! Is it possible to retrieve the password of a user with $objUser like this by example :

$objUser.Password

This does not work but is it possible ?

Thanks !


Olivier, from France.Free Wake On LAN script

Share this post


Link to post
Share on other sites

No, you are unable to retrieve a users password as has been mentioned by the MS Scripting Guy. I left the change password here which does error with com if you get the password wrong, but does not error if you get it right. If you set the script to look for users with a password of "Password" then, the script will tell you upon success who has that password. The script does not affect users passwords, as changing a password to what it is already is not hurting anyone.

Share this post


Link to post
Share on other sites

@ ptrex

Hi ! Is it possible to retrieve the password of a user with $objUser like this by example :

$objUser.Password

This does not work but is it possible ?

Thanks !

Oliver,

Windows Security is lax, but not that lax - what would be the point of having a password if it was easily accessed?

The original articles I think the previous posters were referring to is probably http://www.microsoft.com/technet/scriptcen...05/hey1006.mspx.

Have a read at http://www.microsoft.com/technet/scriptcen...les/sg1103.mspx as well.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0