centralpressure Posted September 24, 2009 Share Posted September 24, 2009 So I have 30 computers that I have inherited. I need to run a program as the admin, however the person who set all of these computers up gave different usernames to all 30, but used the same password. The first 6 characters are all the same, but the last few change, basically numerically increasing. Is it possible for me to write a script that determines which user account is the administrator? There will only be one. Thanks for any suggestions. P.S. these are all non-networked systems with LAN and wireless disabled, with limited user accounts, save the one administrator. Link to comment Share on other sites More sharing options...
CodyBarrett Posted September 25, 2009 Share Posted September 25, 2009 if you KNOW the usernames... make a file with the names.... or if its numerically increasing use a For To Loop [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 25, 2009 Share Posted September 25, 2009 List current users on the local machine: NET USER There are fancier ways, but the idea is that it is not hard for even a non-admin to get a list of user accounts on the machine. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
centralpressure Posted September 25, 2009 Author Share Posted September 25, 2009 List current users on the local machine: NET USER There are fancier ways, but the idea is that it is not hard for even a non-admin to get a list of user accounts on the machine. Thanks for the responses. How do you use "NET USER" I can't seem to find it in the help file? As far as writing a if loop to numberically increase the user, how would I match the user name for the admin? Again thanks for the input. Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 25, 2009 Share Posted September 25, 2009 Thanks for the responses. How do you use "NET USER" I can't seem to find it in the help file?As far as writing a if loop to numberically increase the user, how would I match the user name for the admin? Again thanks for the input.It's a shell command, run it from a command line to see the output. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
DW1 Posted September 25, 2009 Share Posted September 25, 2009 You could also use WMI. Thanks to Autoit Scriptomatic for this one: #include<array.au3> $UserArray = Users() _ArrayDisplay($UserArray) Func Users() $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_UserAccount", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then Local $return[1] $return[0] = 0 For $objItem In $colItems $return[0] += 1 ReDim $return[UBound($return) + 1] $return[UBound($return) - 1] = $objItem.Name Next Return $return Else SetError(1) Return 0 EndIf EndFunc ;==>Users AutoIt3 Online Help 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