therks Posted April 25, 2005 Author Posted April 25, 2005 Okay so a few minutes became a few hours, but either way it's up now (Update in first post). My AutoIt Stuff | My Github
wfuehrer Posted April 25, 2005 Posted April 25, 2005 It's always the same ... You say: " Just a moment darling ...." and after some time you forgot her That's the hard live of programmes (hard for the darlings, too) :"> Wolfgang Führer
therks Posted April 25, 2005 Author Posted April 25, 2005 It's always the same ...You say: " Just a moment darling ...." and after some time you forgot her That's the hard live of programmes (hard for the darlings, too) :"><{POST_SNAPBACK}>Haha, I guess I could say I'm lucky I don't have a "darling."So how does the Domain field work for you Wolfgang? Is it all right? My AutoIt Stuff | My Github
JerichoJones Posted April 26, 2005 Posted April 26, 2005 Try NET USER and redirect it to a text file. The output can be a bit ugly. I think there must be a DLL call you can use though. How else would the OS do it?
JerichoJones Posted April 26, 2005 Posted April 26, 2005 Try NET USER and redirect it to a text file. The output can be a bit ugly. I think there must be a DLL call you can use though. How else would the OS do it? <{POST_SNAPBACK}>A little probing yielded:In NETAPI32.DLLNetUserEnumNET_API_STATUS NetUserEnum( LPCWSTR servername, DWORD level, DWORD filter, LPBYTE* bufptr, DWORD prefmaxlen, LPDWORD entriesread, LPDWORD totalentries, LPDWORD resume_handle);http://msdn.microsoft.com/library/default....netuserenum.asp
erifash Posted April 26, 2005 Posted April 26, 2005 *Edit: After playing with the registry monitor and some programs (TweakUI specifically) that list the users of the computer, I found it accessing this key, "HKLM\SAM\SAM\DOMAINS\Account\Users\Names\Administrator"Unfortunately, I can't seem to get past "HKLM\SAM\SAM," in either RegEdit, or AutoIt's Reg* commands.*Edit 2: I just noticed this from Registry Monitor:4:22:35.662 PM AutoIt3.exe:2592 OpenKey HKLM\SAM\SAM\DOMAINS\Account\Users\Names\Administrator ACCDENIED Access: 0x20019 FAMILY\rob<{POST_SNAPBACK}>I know how to get around that! A little thing nakuribon came up with:RunWait(@ComSpec & ' /c ' & 'at ' & @HOUR & ':' & @MIN + 1 & ' /interactive "regedit.exe"', "", @SW_HIDE)It opens regedit as the SYSTEM username so you can access past the SAM keys! My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver
therks Posted April 26, 2005 Author Posted April 26, 2005 A little probing yielded:In NETAPI32.DLLNetUserEnumNET_API_STATUS NetUserEnum( LPCWSTR servername, DWORD level, DWORD filter, LPBYTE* bufptr, DWORD prefmaxlen, LPDWORD entriesread, LPDWORD totalentries, LPDWORD resume_handle);http://msdn.microsoft.com/library/default....netuserenum.asp<{POST_SNAPBACK}>Nice find. I had found references to a function called "NetUserEnum" but nothing definitive. I'll look into this.I know how to get around that! A little thing nakuribon came up with:RunWait(@ComSpec & ' /c ' & 'at ' & @HOUR & ':' & @MIN + 1 & ' /interactive "regedit.exe"', "", @SW_HIDE)It opens regedit as the SYSTEM username so you can access past the SAM keys!<{POST_SNAPBACK}>"at" ? I'm not at home so I can't try this yet (this system uses WinME, yuck), but I've never seen the "at" command before... Thanks. My AutoIt Stuff | My Github
erifash Posted April 26, 2005 Posted April 26, 2005 Nice find. I had found references to a function called "NetUserEnum" but nothing definitive. I'll look into this."at" ? I'm not at home so I can't try this yet (this system uses WinME, yuck), but I've never seen the "at" command before... Thanks.<{POST_SNAPBACK}>the at command is listed when you type in "help"...AT Schedules commands and programs to run on a computer.Youre welcome! My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver
wfuehrer Posted April 27, 2005 Posted April 27, 2005 Hi! I'm back from a two day workshop of my company. I compiled the source and it seems to be good. Tomorrow - when i'm back in the office i will test it an give you a feedback. My home net is without domain controller .... Thanks ... Wolfgang Führer
wfuehrer Posted April 28, 2005 Posted April 28, 2005 Hi!Unfortunately, I can't seem to get past "HKLM\SAM\SAM," in either RegEdit, or AutoIt's Reg* commands.There are no more keys on our pc's unter this tree .....I tested the changings in our domain and it's working fine. Keep in mind not to start the program from a network share. After first login step (switching user) the share is no longer mapped and the restart of RunAs will fail. Thank you for the excellent work ... Wolfgang Führer
therks Posted April 29, 2005 Author Posted April 29, 2005 After first login step (switching user) the share is no longer mapped and the restart of RunAs will fail.Hmm. Maybe I can have a check for that... if you don't mind, see if a FileExists() returns the file as being there or not. I think I will have it check that, and if the file is not there then the Switch Users command will be disabled.Thank you for the excellent work ... Thank you for helping to test it. My AutoIt Stuff | My Github
therks Posted April 30, 2005 Author Posted April 30, 2005 (edited) Okay, I'm finally home for a while, so I can actually test some stuff...A little probing yielded:In NETAPI32.DLLNetUserEnumNET_API_STATUS NetUserEnum( LPCWSTR servername, DWORD level, DWORD filter, LPBYTE* bufptr, DWORD prefmaxlen, LPDWORD entriesread, LPDWORD totalentries, LPDWORD resume_handle);http://msdn.microsoft.com/library/default....netuserenum.asp<{POST_SNAPBACK}>I can't figure out how to get this to work.Currently, I'm trying this code, but it just keeps hard crashing AutoIt (windows error box, etc)$FILTER_TEMP_DUPLICATE_ACCOUNT = 0x0001 $var = DllCall('NetApi32.dll', 'str', 'NetUserEnum', _ 'str', '', _ 'int', 0, _ 'int', $FILTER_TEMP_DUPLICATE_ACCOUNT, _ 'ptr', 0, _ 'int', 100, _ 'int', 0, _ 'int', 0, _ 'int', 0)Any ideas? I'm a virtual know-nothing when it comes to DllCall. I know how to get around that! A little thing nakuribon came up with:RunWait(@ComSpec & ' /c ' & 'at ' & @HOUR & ':' & @MIN + 1 & ' /interactive "regedit.exe"', "", @SW_HIDE)It opens regedit as the SYSTEM username so you can access past the SAM keys!<{POST_SNAPBACK}>While this method is awesome (it completely opens up the SAM key) in one way, it's no good in another. It can take up to a full minute before the scheduled command would run. Waiting that long just to get a list of users is not a viable option. Thanks though. I need to see if I can get this information with RegRead in some other way...At the moment though, I'm liking this method the most:$usernames = '' $oDomain = ObjGet("WinNT://" & @ComputerName) For $oDomainItem In $oDomain If $oDomainItem.Class = "User" Then $usernames &= $oDomainItem.Name & @LF EndIf NextOnly problem is that it's fairly slow (about 2 seconds). Edited April 30, 2005 by Saunders My AutoIt Stuff | My Github
wfuehrer Posted May 6, 2005 Posted May 6, 2005 (edited) Hi!I'm working with this tool every day and have many entries.It would be nice to get a sorted history list to find the programs more easy.So i modified the _LoadHistory() Function:Func _LoadHistory() Global $s_MRUList = RegRead($s_RegKey & '\MRUList', '') Global $a_MRUList = StringSplit($s_MRUList, '') Global $a_HistoryItems[$a_MRUList[0]+ 1] $a_HistoryItems[0] = $a_MRUList[0] GuiCtrlSetData($gui_Main_va_OpenCmd, '') For $i = 1 To $a_MRUList[0] $s_RegRead = RegRead($s_RegKey & '\MRUList', $a_MRUList[$i]) If @error Or $s_RegRead = '' Then ContinueLoop EndIf $s_Alph = StringReplace($s_Alph, $a_MRUList[$i], '') $a_HistoryItems[$i] = StringReplace($s_RegRead, '|', '') ; ### here disabled ### ;GuiCtrlSetData($gui_Main_va_OpenCmd, $a_HistoryItems[$i], $a_HistoryItems[1]) Next ; ### order array ### _ArraySort($a_HistoryItems,0,1) For $i = 1 To $a_MRUList[0] GuiCtrlSetData($gui_Main_va_OpenCmd, $a_HistoryItems[$i], $a_HistoryItems[1]) NextEndFunc;<==_LoadHistoryYou have to insert the _ArraySort(), __ArrayQuickSort1D() and __ArrayQuickSort2D() functions from the Include folder, too. Edited May 6, 2005 by wfuehrer Wolfgang Führer
therks Posted May 7, 2005 Author Posted May 7, 2005 Well if that works for you, okay. But the way it worked before was just like the Run dialog. Whichever program you used most recently was put at the top. You know what I was thinking of implementing, was a sort of Favorites/Bookmarks menu. Something you could add as many entries as you wanted to (the history is currently limited to 26 entries). How does that sound? My AutoIt Stuff | My Github
wfuehrer Posted May 8, 2005 Posted May 8, 2005 Hi! The idea of an Favorites/Bookmark menu is great. It would be nice to have a possibility to give a bookmark a name to shorten the full path entry. But i thing that's some work to enhance the structure and adding an extra dialog for the input of an ordinary name. I'm working as admin in a domain and have a lot of tools which i have to start with "Runas ..." to get the necessary permissions. Your tool simplify my daily work with userhelp and server administration. Wolfgang Führer
therks Posted May 9, 2005 Author Posted May 9, 2005 Ah it wouldn't be too much work. An extra menu here, a button there, etc. Gives me something else to do. I've been working on this program very slowly off and on for months, now that it's basically done, I don't know what to do. I'll fool around with it when I get the chance. I just got my work schedule for the next two weeks and it turns out I won't have a whole lot of free time. My AutoIt Stuff | My Github
Lou Posted January 31, 2008 Posted January 31, 2008 Hello,Thank you for sharing your script.I did a runas script with another approach :http://www.autoitscript.com/forum/index.ph...c=62677&hl=It helps you creating runas shortcuts in the start menu.GreetingsLou
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