Nobody ha scritto:
> Which version of VB are you using?
VB6sp6 Enterprise Edition
> Since you are new to VB, I recommend that you use PsExec tool to run what
> you want interactively using "-i" command line option. Try this tool in a
[quoted text clipped - 6 lines]
> PsExec:
> http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx
I know psexec and its features :)
Unfortunately, I must implement my solution on -about- 50 workstations
and, because of corporate security policies, each workstation has its
own administrative account with, of course, a different password value
for each workstation.
Moreover, the "launching user" is obviously not an administrator and
must not know the elevated credentials, so the user has only to click on
the client side and not to know the implementation details :)
Our ICT team will install the server side and assign, machine by
machine, the proper administrative credentials inside dcomcnfg.
Maybe now the situation is clearer :)
> The API solution could be complicated for you. First you call
> WTSGetActiveConsoleSessionId(requires XP+), then WTSQueryUserToken(), then
> CreateProcessAsUser(). This is assuming that someone is actually logged in
> to the console. Also, the call to WTSQueryUserToken() could fail unless the
> caller is running as SYSTEM. I think Administrator is not enough.
Yes of course, there will be an unprivileged user logged interactively
on the console. That user should activate and use the client side to
invoke the elevated application through the server side.
> Yet another option is to use Task Scheduler which has a COM interface. Look
> in MSDN for "ITaskScheduler". I think that IScheduledWorkItem::Run can be
> used to run a task immediately, even if the task is disabled. If you want to
> run a task as SYSTEM, specify "SYSTEM" as the user id, and leave the
> password blank.
Yes...I know and already tried this kind a solution by creating a
Windows Service in VB.Net, assigning it the localsystem account as the
launching user and activating interaction checkbox. This solution works
because - whenever the service is started - the application shows on the
desktop of the currently logged user.
But...Because of the same corporate security policies, we couldn't run a
"custom service" as localsystem :(((
It looks like an application can be made interactive only if it runs as
localsystem...This doesn't fit my requirements :(
> For a VB6 sample, see "Using the Task Scheduler" sample at this link:
>
> http://www.mvps.org/emorcillo/en/code/vb6/index.shtml
I'll certainly surf this site, thanks!
Paul Clement - 28 Jan 2010 15:48 GMT
¤ Unfortunately, I must implement my solution on -about- 50 workstations
¤ and, because of corporate security policies, each workstation has its
¤ own administrative account with, of course, a different password value
¤ for each workstation.
¤ Moreover, the "launching user" is obviously not an administrator and
¤ must not know the elevated credentials, so the user has only to click on
¤ the client side and not to know the implementation details :)
¤
¤ Our ICT team will install the server side and assign, machine by
¤ machine, the proper administrative credentials inside dcomcnfg.
¤
¤ Maybe now the situation is clearer :)
Just to follow-up on this, can you use the LogonUser and ImpersonateLoggedOnUser API function calls
to temporarily elevate security in your code? Below is an example for ASP but it uses a VB 6.0
component containing code that you should be able to use in your application.
http://support.microsoft.com/kb/248187
Paul
~~~~
Microsoft MVP (Visual Basic)
Ataru - 28 Jan 2010 16:44 GMT
Paul Clement ha scritto:
> Just to follow-up on this, can you use the LogonUser and ImpersonateLoggedOnUser API function calls
> to temporarily elevate security in your code? Below is an example for ASP but it uses a VB 6.0
> component containing code that you should be able to use in your application.
I'll try, but if I'm not wrong LogonUser requires that you hardcode the
username and password and provide them to the function. Unfortunately,
this scenario does not fit my requirements :(((
Paul Clement - 28 Jan 2010 18:21 GMT
¤ Paul Clement ha scritto:
¤
¤ > Just to follow-up on this, can you use the LogonUser and ImpersonateLoggedOnUser API function calls
¤ > to temporarily elevate security in your code? Below is an example for ASP but it uses a VB 6.0
¤ > component containing code that you should be able to use in your application.
¤
¤ I'll try, but if I'm not wrong LogonUser requires that you hardcode the
¤ username and password and provide them to the function. Unfortunately,
¤ this scenario does not fit my requirements :(((
You don't have to hard-code the credentials. You can encrypt the credentials and store them
elsewhere (either the Registry or app config file) so that they are almost impossible to figure out.
Paul
~~~~
Microsoft MVP (Visual Basic)