Thanks so far people, but.. There is one problem though; The script calling this function was designed to prevent logging on to the network by non company PC's like PC's from contractors or private laptops from employees.
Since policies are not applied untill after the logon script, it is possible that the shell/explorer has already started before the RunOnce key was written, which means the RunOnce will execute the next time people use the PC instead of immediately..

If for example people log on to their PC while the network cable is out of the laptop, they are logged on locally. If they put the network cable in while working locally, they automatically log on and the logon script executes (if the credentials are kept the same). Same problem with RunOnce in that case.

Now I've tried a couple of shutdown, reboot, and logoff tools, and also the functions that Rundll provides, but none of them seem to be able to kill the logon script and logoff or reboot thus preventing logging on to the domain. Any ideas?

The closest I came to a solution was either using a delay program which calls Rundll after x seconds, or shutting down the kernel using a kernel386 command. The delay function isn't all that because the logon script has different forms depending on account and group membership, and the speed of the PC also plays a part in determining the number of seconds. Shuting down the kernel works OK on '98 (nice shutdown), but on '95 the computer hangs...

I'm almost out of options?...

I'll give shutdown.exe a g tomorrow, as well as the '4' and '6' parameters of the Rundll command's. I've only tried '0'... I'll let you know what happens...

[ 07 November 2001: Message edited by: Jeroen ]

_________________________
Regards, Jeroen. There are two ways to write error-free programs. Only the third one works.