engine Posted June 19, 2008 Posted June 19, 2008 (edited) This is my AutoIt Local account UDF. Is supposed to work on all MS OS from Windows 2000 trough Vista. LocalAccount.au3 Edited July 19, 2008 by engine mLipok 1 My contributions:Local account UDF Registry UDFs DriverSigning UDF Windows Services UDF [url="http://www.autoitscript.com/forum/index.php?showtopic=81880"][/url]
monoceres Posted June 19, 2008 Posted June 19, 2008 (edited) I've been looking for this for some time now. Nice job Edit: 1 thousand posts Edited June 19, 2008 by monoceres Broken link? PM me and I'll send you the file!
engine Posted June 20, 2008 Author Posted June 20, 2008 Thanks. If you find something you think isn't working as supposed, please let me know. My contributions:Local account UDF Registry UDFs DriverSigning UDF Windows Services UDF [url="http://www.autoitscript.com/forum/index.php?showtopic=81880"][/url]
ptrex Posted June 20, 2008 Posted June 20, 2008 @engine Very Nice !! 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
engine Posted June 23, 2008 Author Posted June 23, 2008 Following the tip from this post -> http://www.autoitscript.com/forum/index.ph...st&p=540659I updated the file. My intention is to have this UDF working for Windows 2000 too. However I am currently unable to test it under other than Windows XP.Regards. My contributions:Local account UDF Registry UDFs DriverSigning UDF Windows Services UDF [url="http://www.autoitscript.com/forum/index.php?showtopic=81880"][/url]
Colin Posted July 9, 2008 Posted July 9, 2008 This is great. I'll be using this on Windows Server 2003 so I'll let you know how it works there.
engine Posted July 10, 2008 Author Posted July 10, 2008 Thanks. Any feedback is welcome. My contributions:Local account UDF Registry UDFs DriverSigning UDF Windows Services UDF [url="http://www.autoitscript.com/forum/index.php?showtopic=81880"][/url]
Catdaddy Posted July 10, 2008 Posted July 10, 2008 Using this mostly in a Windows XP SP2 environment. Works like a charm. Had no problems creating, deleting or renaming local accounts. I build new systems for end users and this has been extremely reliable in helping to automate that process. Thank you for the excellent UDF.
Colin Posted July 10, 2008 Posted July 10, 2008 (edited) Update: Works fine in Windows Server 2k3. I'm specifically using the _AccountEnableProperty function to enable the Password never expires checkbox. Also, I would like to credit you in my being able to come up with a similar solution for IIS Management. I needed to check the Write flag in the Virtual Directory properties dialogue. I used your UDF as a starting point on how to translate Microsofts sample scripts for IIS into AutoIt. I would also like to credit smashly for linking me to this topic as well as the Microsoft script repository. I've been working on that little check box for months. I'm so happy it's over! Thank you for the help. I'll attach the UDF here for your amusement. Keep in mind, I only implemented the functionality for that one check box, although the way I structured it, additional Cases could be added for the other properties. I also didn't go all out like you did and translate the entire IIS section. Just the one regarding Virtual Directory's properties.IIsFtp.au3 Edited July 10, 2008 by Colin
engine Posted July 19, 2008 Author Posted July 19, 2008 Updated.Variables were being redeclared inside loops.Doesn't break script compatibility. My contributions:Local account UDF Registry UDFs DriverSigning UDF Windows Services UDF [url="http://www.autoitscript.com/forum/index.php?showtopic=81880"][/url]
Murjuk Posted May 27, 2011 Posted May 27, 2011 Hi, I am trying to run _AccountAddToGroup on PE windows but it does not work. What dependency does this script have?
Syed23 Posted September 9, 2011 Posted September 9, 2011 Hi Engine, I am using Windows 7 32 bit machine and i am trying to use the function _GroupEnumMembers. The script runs successfully but i am not getting any result even if i wait for more than 4 minutes. But the same time the function _GroupEnum works fine. Please let me know where i am making a mistake. #include"LocalAccount.au3" #include"Array.au3" $result = _GroupEnumMembers("Administrators") _ArrayDisplay($result) Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]
engine Posted March 23, 2012 Author Posted March 23, 2012 Hi Engine, I am using Windows 7 32 bit machine and i am trying to use the function _GroupEnumMembers. The script runs successfully but i am not getting any result even if i wait for more than 4 minutes. But the same time the function _GroupEnum works fine. Please let me know where i am making a mistake. #include"LocalAccount.au3" #include"Array.au3" $result = _GroupEnumMembers("Administrators") _ArrayDisplay($result) That script runs fine and fast on my machine. try running this script #include "LocalAccount.au3" #include <Array.au3> $result = _GroupEnumMembers("Administrators") MsgBox(0, "Error", @error) _ArrayDisplay($result) If you see error different from 0, you probably aren't going to get any result on that _ArrayDisplay, like for never. My contributions:Local account UDF Registry UDFs DriverSigning UDF Windows Services UDF [url="http://www.autoitscript.com/forum/index.php?showtopic=81880"][/url]
Syed23 Posted March 26, 2012 Posted March 26, 2012 That script runs fine and fast on my machine. try running this script #include "LocalAccount.au3" #include <Array.au3> $result = _GroupEnumMembers("Administrators") MsgBox(0, "Error", @error) _ArrayDisplay($result) If you see error different from 0, you probably aren't going to get any result on that _ArrayDisplay, like for never. i am getting an error message -2. Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]
orbs Posted January 29, 2015 Posted January 29, 2015 (edited) a small addition of mine: _GroupGetNameBySID() useful, for example, if you want to add an account to the local administrators group, but its name is not "Administrators", because your installation of Windows is in a non-English language. code adapted from here: http://blogs.technet.com/b/heyscriptingguy/archive/2005/11/02/how-can-i-determine-the-name-of-the-local-administrators-group.aspx here's an example script with the function included: Global Const $sLocalAdminGroup_SID = 'S-1-5-32-544' Global Const $sLocalAdminGroup_Name = _GroupGetNameBySID($sLocalAdminGroup_SID) If @error Then MsgBox(16, 'Error!', 'Cannot resolve the name of the local administrators group.') Else MsgBox(64, 'Success!', 'The name of the local administrators group is:' & @CR & $sLocalAdminGroup_Name) EndIf Func _GroupGetNameBySID($sSID, $sComputer = @ComputerName) Local $objSystem = ObjGet("winmgmts:{ImpersonationLevel=impersonate}!\\" & $sComputer & "\root\cimv2") Local $objGroupList = $objSystem.ExecQuery('Select * from Win32_Group Where Domain="' & $sComputer & '" And SID="' & $sSID & '"') For $objGroup In $objGroupList ; should be only a single result, anyway returns the first result found Return $objGroup.Name Next Return SetError(1, 0, '') EndFunc ;==>_GroupGetNameBySID note: not tested on remote computer. and, as said before - REALLY GREAT UDF! (3 years and not a single update is required!) Edited January 29, 2015 by orbs Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff
orbs Posted January 29, 2015 Posted January 29, 2015 another small contribution: _AccountShowInLogonScreen() lets you hide/unhide a user account from the Windows logon screen. Func _AccountShowInLogonScreen($sUserName, $bShow, $sComputer = @ComputerName) Local $sHKLM = 'HKLM' Switch @OSArch Case 'X86' $sHKLM = 'HKLM' Case 'X64' $sHKLM = 'HKLM64' Case Else Return SetError(1, 0, 0) EndSwitch If $sComputer <> @ComputerName Then $sHKLM = '\\' & $sComputer & '\' & $sHKLM If $bShow Then RegDelete($sHKLM & '\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList', $sUserName) Else RegWrite($sHKLM & '\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList', $sUserName, 'REG_DWORD', 0) EndIf If @error Then Return SetError(1, 0, 0) Return 1 EndFunc ;==>_AccountShowInLogonScreen note: not tested on remote computer. Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff
AdamUL Posted January 13, 2016 Posted January 13, 2016 I noticed that there were functions to set account and group information, but there were no functions to get this information. Here are two additional functions to resolve this issue. expandcollapse popup#include "LocalAccount.au3" #include <Array.au3> Global $aInfo = _AccountGetInfo("Administrator") ;~ Global $aInfo = _AccountGetInfo("Guest") _ArrayDisplay($aInfo) Global $sInfo = _GroupGetInfo("Administrators") ;~ Global $sInfo = _GroupGetInfo("Power Users") ;~ Global $sInfo = _GroupGetInfo("Remote Desktop Users") ;~ Global $sInfo = _GroupGetInfo("Users") MsgBox(0, "Test", $sInfo) ; #FUNCTION# ==================================================================================================================== ; ; Name...........: _AccountGetInfo ; Description ...: Gets information related to a local user account. ; Syntax.........: _AccountGetInfo($sUserName [, $sComputer]) ; $sUserName - Local user account name ; Parameters ....: $sComputer - [Optional] Computer name ; The local computer is default ; Return values .: Success - Returns 1D array ; Array[0] = Full Name ; Array[1] = Description ; Failure - Returns 0 and sets @error to -1 ; Author ........: AdamUL (Adam Lawrence) ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; ; ; =============================================================================================================================== Func _AccountGetInfo($sUserName, $sComputer = @ComputerName) Local $objIADsError = ObjEvent("AutoIt.Error", "objIADsErrFunc") #forceref $objIADsError Local $objUser = ObjGet("WinNT://" & $sComputer & "/" & $sUserName & ", user") If @error Then Return SetError(1, 0, 0) Local $aReturn[2] With $objUser $aReturn[0] = .FullName $aReturn[1] = .Description EndWith If @error Then Return SetError($IADsError, 0, $IADsError + 1) Return $aReturn EndFunc ;==> _AccountGetInfo ; #FUNCTION# ==================================================================================================================== ; ; Name...........: _GroupGetInfo ; Description ...: Gets information related to a local group. ; Syntax.........: _GroupGetInfo($sGroup [ ,$sComputer]) ; $sGroup - Local user group name ; Parameters ....: $sComputer - [Optional] Computer name ; The local computer is default ; Return values .: Success - Returns a string sescription of the local group ; Failure - Returns 0 and sets @error to -1 ; Author ........: AdamUL (Adam Lawrence) ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; ; ; =============================================================================================================================== Func _GroupGetInfo($sGroup, $sComputer = @ComputerName) Local $objIADsError = ObjEvent("AutoIt.Error", "objIADsErrFunc") #forceref $objIADsError Local $objGroup = ObjGet("WinNT://" & $sComputer & "/" & $sGroup & ", group") If @error Then Return SetError(1, 0, 0) Local $sReturn = $objGroup.Description If @error Then Return SetError($IADsError, 0, $IADsError + 1) Return $sReturn EndFunc ;==> _GroupGetInfo Adam
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