NT Question


i have set of component that add user to an nt machine, and i add user that are not in administrator group, but i can add him to administrator group on the fly, and when i have newly created this user and set him to administrator group i want to be able to refresh nt accounts / login on the fly, not logoff and logon again to the changes will take effect. So i ask you Experts good, is this possible?

Regards
Palli
palli011000Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rwilson032697Commented:
I don't think NT supports the notion of 'switch user' like unix/linux does...

Cheers,

Raymond.
0
palli011000Author Commented:
Can you ask anybody?, you are deeper in this either than me.

I think this is possible with undocumented functions
0
intheCommented:
be interesting to know what functions these programs are calling ;-):

http://www.ntfaq.com/ntfaq/util5.html
0
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

rwilson032697Commented:
Would be, wouldn't it!

Interesting to see win2k has RUNAS.EXE to run as another user - just what he wants! (If only...)

Cheers,

Raymond.
0
palli011000Author Commented:
Yes this program NUSe works very fine, i like to know how to do this in Delphi Code, mabe this is some API functions or .dll, can i build service with forms and edit boxes and more?
0
intheCommented:
probably do this using createprocessasuser() api..

no im fairly confident you dont wanna put forms in a service ..
else why not just create app that runs when services start by adding it to the registrys "runservices" key.
0
palli011000Author Commented:
What is that? RunServices
0
intheCommented:
it is key in registry where you write some pseudo name as a string and for its value write the full path to your program and then it starts as soon as windows starts (before the logon screen),this is how services are started.
if you need a code example of writing to the registry just shout.
open regedit.exe and go to:
hkey_local_machine
software - windows - currentversion - Runservices
then you see where i mean.
0
palli011000Author Commented:
this value is not available at my computer, can you show me how to do it in code add my program as service start or take it back (delete)

Thanks
Palli
0
intheCommented:
aw heck im being thck.
there is no runservices key in winnt
(this key exists for win9* only)
you'd be wanting the run key instead (this is where systray is started from)
before i post some code (for the run key)is this what you want :
for your program to start as soon as windows is started ?

0
palli011000Author Commented:
yes
0
intheCommented:
found a function in my paq:

It's easy enough to drag and drop your application to the Startup group to
make it run on Windows startup. But, if you wanted to do this
programmatically (at the end of your setup program for example), or if you
wanted to make your program run only the next time Windows start, following
function might come in handy:

procedure RunOnStartup(
  sProgTitle,
  sCmdLine    : string;
  bRunOnce    : boolean );
var
  sKey : string;
  reg  : TRegIniFile;
begin
  if( bRunOnce )then
    sKey := 'Once'
  else
    sKey := '';

  reg := TRegIniFile.Create( '' );
  reg.RootKey := HKEY_LOCAL_MACHINE;
  reg.WriteString(
    'Software\Microsoft'
    + '\Windows\CurrentVersion\Run'
    + sKey + #0,
    sProgTitle,
    sCmdLine );
  reg.Free;
end;


Usage:
sProgTitle
Name of your program. Generally speaking, this could be anything you want.
sCmdLine
This is the full path name to your executable program.
bRunOnce
Set this to True if you want to run your program just once. If this parameter
is False, your program will be executed every time Windows startsup.
Example:

RunOnStartup( 'Title of my program', 'MyProg.exe', False );

Regards Barry
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
palli011000Author Commented:
Palli is happy now!!! thanks to Barry
0
intheCommented:
im glad your happy ;-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.