Mitch03 Posted April 29, 2008 Share Posted April 29, 2008 (edited) Hi! I'm trying to convert some KixTart scripts to AutoIt. I would like to get the password age of the current user like the macro "@PWAGE" in Kix. Is it possible? Thanx for you time! Edited April 29, 2008 by Mitch03 Link to comment Share on other sites More sharing options...
weaponx Posted April 29, 2008 Share Posted April 29, 2008 Is this supposed to retireve the result from the local account or active directory? Link to comment Share on other sites More sharing options...
rasim Posted April 29, 2008 Share Posted April 29, 2008 Hmm... i tryed, but unsuccessful $USER_MODALS_INFO_0 = DllStructCreate("dword;dword;dword;dword;dword") $aRet = DllCall("Netapi32.dll", "int", "NetUserModalsGet", "ptr", 0, "dword", 0, _ "ptr", DllStructGetPtr($USER_MODALS_INFO_0)) ConsoleWrite("DllReturn = " & $aRet[0] & @LF) ConsoleWrite("DllStruct = " & DllStructGetData($USER_MODALS_INFO_0, 2) & @LF) DllCall("Netapi32.dll", "int", "NetApiBufferFree", "ptr", DllStructGetPtr($USER_MODALS_INFO_0))MSDN Link to comment Share on other sites More sharing options...
Squirrely1 Posted April 29, 2008 Share Posted April 29, 2008 I found this VBScript on the forum - supposedly gets the current password policies: expandcollapse popup' This code displays the current settings for the password ' and account lockout policies. ' --------------------------------------------------------------- ' From the book "Windows Server Cookbook" by Robbie Allen ' Publisher: O'Reilly Media ' ISBN: 0-596-00633-0 ' Book web site: http://rallenhome.com/books/winsckbk/code.html ' --------------------------------------------------------------- ' ------ SCRIPT CONFIGURATION ------ strDomain = "<DomainDN>" ' e.g. rallencorp.com ' ------ END CONFIGURATION --------- set objRootDSE = GetObject("LDAP://" & strDomain & "/RootDSE") set objDomain = GetObject("LDAP://" & _ objRootDSE.Get("defaultNamingContext") ) ' Hash containing the domain password and lockout policy attributes ' as keys and the units (e.g. minutes) as the values set objDomAttrHash = CreateObject("Scripting.Dictionary") objDomAttrHash.Add "lockoutDuration", "minutes" objDomAttrHash.Add "lockoutThreshold", "attempts" objDomAttrHash.Add "lockoutObservationWindow", "minutes" objDomAttrHash.Add "maxPwdAge", "minutes" objDomAttrHash.Add "minPwdAge", "minutes" objDomAttrHash.Add "minPwdLength", "characters" objDomAttrHash.Add "pwdHistoryLength", "remembered" objDomAttrHash.Add "pwdProperties", " " ' Iterate over each attribute and print it for each strAttr in objDomAttrHash.Keys if IsObject( objDomain.Get(strAttr) ) then set objLargeInt = objDomain.Get(strAttr) if objLargeInt.LowPart = 0 then value = 0 else value = Abs(objLargeInt.HighPart * 2^32 + objLargeInt.LowPart) value = int ( value / 10000000 ) value = int ( value / 60 ) end if else value = objDomain.Get(strAttr) end if WScript.Echo strAttr & " = " & value & " " & objDomAttrHash(strAttr) next 'Constants from DOMAIN_PASSWORD_INFORMATION Set objDomPassHash = CreateObject("Scripting.Dictionary") objDomPassHash.Add "DOMAIN_PASSWORD_COMPLEX", &h1 objDomPassHash.Add "DOMAIN_PASSWORD_NO_ANON_CHANGE", &h2 objDomPassHash.Add "DOMAIN_PASSWORD_NO_CLEAR_CHANGE", &h4 objDomPassHash.Add "DOMAIN_LOCKOUT_ADMINS", &h8 objDomPassHash.Add "DOMAIN_PASSWORD_STORE_CLEARTEXT", &h16 objDomPassHash.Add "DOMAIN_REFUSE_PASSWORD_CHANGE", &h32 ' The PwdProperties attribute requires special processing because ' it is a flag that holds multiple settings. for each strFlag In objDomPassHash.Keys if objDomPassHash(strFlag) and objDomain.Get("PwdProperties") then WScript.Echo " " & strFlag & " is enabled" else WScript.Echo " " & strFlag & " is disabled" end If next Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
ptrex Posted April 30, 2008 Share Posted April 30, 2008 @all Maybe this can get you all going. $strComputer = "." $userName = @UserName $objWMIService = ObjGet("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2") $colItems = $objWMIService.ExecQuery ("Select * from Win32_NetworkLoginProfile where caption = '" & StringUpper($userName) &"'") For $objItem in $colItems Consolewrite ("Password Age: " & int($objItem.PasswordAge) & " - DD/HH/MM/SS" & @CR) Next regards ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
rasim Posted April 30, 2008 Share Posted April 30, 2008 ptrexWorks fine! Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now