AutoIt Forums: RunAs - AutoIt Forums

Jump to content

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

RunAs Application Launcher Rate Topic: -----

#21 User is offline   RobSaunders 

  • I'm flammable too!
  • PipPipPipPipPipPipPip
  • Group: Full Members
  • Posts: 2,123
  • Joined: 03-June 04
  • Location:BC, Canada

Posted 25 April 2005 - 08:15 PM

Okay so a few minutes became a few hours, but either way it's up now (Update in first post).

#22 User is offline   wfuehrer 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 60
  • Joined: 02-January 05
  • Location:Germany

Posted 25 April 2005 - 08:40 PM

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) :">

#23 User is offline   RobSaunders 

  • I'm flammable too!
  • PipPipPipPipPipPipPip
  • Group: Full Members
  • Posts: 2,123
  • Joined: 03-June 04
  • Location:BC, Canada

Posted 25 April 2005 - 10:59 PM

wfuehrer, on Apr 25 2005, 11:40 AM, said:

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)  :">


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?

#24 User is offline   JerichoJones 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 27
  • Joined: 27-February 05

Posted 26 April 2005 - 07:57 PM

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? :ermm:

#25 User is offline   JerichoJones 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 27
  • Joined: 27-February 05

Posted 26 April 2005 - 08:04 PM

JerichoJones, on Apr 26 2005, 02:57 PM, said:

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?  :ermm:


A little probing yielded:

In NETAPI32.DLL
NetUserEnum

NET_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

#26 User is offline   erifash 

  • autoit - think free
  • PipPipPipPip
  • Group: Full Members
  • Posts: 517
  • Joined: 20-October 04

Posted 26 April 2005 - 10:46 PM

Saunders, on Apr 22 2005, 06:11 PM, said:

*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:
[ code='text' ]    ( Popup )
4:22:35.662 PM    AutoIt3.exe:2592    OpenKey    HKLM\SAM\SAM\DOMAINS\Account\Users\Names\Administrator    ACCDENIED    Access: 0x20019 FAMILY\rob



I know how to get around that! :idea: A little thing nakuribon came up with:

[ code='text' ]    ( Popup )
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!

#27 User is offline   RobSaunders 

  • I'm flammable too!
  • PipPipPipPipPipPipPip
  • Group: Full Members
  • Posts: 2,123
  • Joined: 03-June 04
  • Location:BC, Canada

Posted 26 April 2005 - 10:52 PM

JerichoJones, on Apr 26 2005, 11:04 AM, said:

A little probing yielded:

In NETAPI32.DLL
NetUserEnum

NET_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


Nice find. I had found references to a function called "NetUserEnum" but nothing definitive. I'll look into this.

erifash, on Apr 26 2005, 01:46 PM, said:

I know how to get around that!  :idea:  A little thing nakuribon came up with:

[ code='text' ]    ( Popup )
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!


"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.

#28 User is offline   erifash 

  • autoit - think free
  • PipPipPipPip
  • Group: Full Members
  • Posts: 517
  • Joined: 20-October 04

Posted 26 April 2005 - 11:00 PM

Saunders, on Apr 26 2005, 04:52 PM, said:

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.


the at command is listed when you type in "help"...

Quote

AT          Schedules commands and programs to run on a computer.


Youre welcome! :)

#29 User is offline   wfuehrer 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 60
  • Joined: 02-January 05
  • Location:Germany

Posted 27 April 2005 - 07:39 PM

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 ... :)

#30 User is offline   wfuehrer 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 60
  • Joined: 02-January 05
  • Location:Germany

Posted 28 April 2005 - 09:09 AM

Hi!

Saunders, on Apr 23 2005, 01:11 AM, said:

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 :king: for the excellent work ... :D

#31 User is offline   RobSaunders 

  • I'm flammable too!
  • PipPipPipPipPipPipPip
  • Group: Full Members
  • Posts: 2,123
  • Joined: 03-June 04
  • Location:BC, Canada

Posted 29 April 2005 - 01:20 AM

wfuehrer, on Apr 28 2005, 12:09 AM, said:

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.

Quote

Thank you  :king:  for the excellent work ...  :D


Thank you for helping to test it.

#32 User is offline   RobSaunders 

  • I'm flammable too!
  • PipPipPipPipPipPipPip
  • Group: Full Members
  • Posts: 2,123
  • Joined: 03-June 04
  • Location:BC, Canada

Posted 30 April 2005 - 11:44 PM

Okay, I'm finally home for a while, so I can actually test some stuff...

JerichoJones, on Apr 26 2005, 11:04 AM, said:

A little probing yielded:

In NETAPI32.DLL
NetUserEnum

NET_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

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)
[ code='text' ]    ( Popup )
$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. :(




erifash, on Apr 26 2005, 01:46 PM, said:

I know how to get around that!  :idea:  A little thing nakuribon came up with:

[ code='text' ]    ( Popup )
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!

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:
[ code='text' ]    ( Popup )
$usernames = '' $oDomain = ObjGet("WinNT://" & @ComputerName) For $oDomainItem In $oDomain  If $oDomainItem.Class = "User" Then   $usernames &= $oDomainItem.Name & @LF  EndIf Next

Only problem is that it's fairly slow (about 2 seconds).

This post has been edited by Saunders: 01 May 2005 - 12:01 AM


#33 User is offline   wfuehrer 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 60
  • Joined: 02-January 05
  • Location:Germany

Posted 06 May 2005 - 10:10 AM

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:

Quote

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])
Next
EndFunc;<==_LoadHistory


You have to insert the _ArraySort(), __ArrayQuickSort1D() and __ArrayQuickSort2D() functions from the Include folder, too.

This post has been edited by wfuehrer: 06 May 2005 - 11:21 AM


#34 User is offline   RobSaunders 

  • I'm flammable too!
  • PipPipPipPipPipPipPip
  • Group: Full Members
  • Posts: 2,123
  • Joined: 03-June 04
  • Location:BC, Canada

Posted 07 May 2005 - 08:20 PM

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?

#35 User is offline   wfuehrer 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 60
  • Joined: 02-January 05
  • Location:Germany

Posted 08 May 2005 - 02:10 PM

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.

#36 User is offline   RobSaunders 

  • I'm flammable too!
  • PipPipPipPipPipPipPip
  • Group: Full Members
  • Posts: 2,123
  • Joined: 03-June 04
  • Location:BC, Canada

Posted 09 May 2005 - 01:40 AM

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.

#37 User is offline   Lou 

  • Newbie
  • Group: Members
  • Posts: 4
  • Joined: 26-January 08

Posted 31 January 2008 - 09:42 PM

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.

Greetings

Lou

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users