Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

IMPERSONATE script

2 views
Skip to first unread message

Ian Matthews

unread,
Sep 13, 2002, 10:29:11 AM9/13/02
to
Is there a script already written that will allow for
activities to be processed under an Admin account?

I want to remove some icons added by SP3 for W2K from the
ALL USERS profile and I thought the best way to handle
that is via a logon script. About 80% of my users are
RESTRICTED USERs and as such can not make changes to the
ALL USERS profile.

Microsoft Direct Access support suggested the
following .JS:

oShell = Wscript.CreateObject("WScript.Shell");
CmdResult = oShell.run
("runas /user:username", "yourbatchtodelitemsfromALLUSERS",
" ",2,false);
wscript.sleep 1000;
Shell.AppActivate "C:\WINNT\System32\runas.exe";
oShell.sendkeys "password~";
oShell = Nothing;

but I was unable to get it to work after many attempts and
minor revisions. Some VB scripting buddies indicated that
this .JS would not work in a logon script environment and
they thought it was designed for a web page. They
suggested using VBScript IMPERSONATE would be a better way
to go but I have never written VBScript and I thought it
likely already exists somewhere.

FYI, I used to write a fair amount of VFPro and .BAT
scriping but do not know much about VBScript or JScript.

Any assistance would be greatly appreciated.

Ian Matthews
MCSE2001, IPD, BComm

Jean-Christophe Pirmolin

unread,
Sep 13, 2002, 10:46:22 AM9/13/02
to
Hello,

This VBcode works for me...

Note that your password is in clear in the script...

dim wshShell
set wshShell=CreateObject("Wscript.Shell")
wshShell.run("runas /u:domain\administrator x:\executable.exe")
Wscript.Sleep 100
wshShell.AppActivate "Runas"
Wscript.Sleep 300
wshShell.SendKeys "adminpassword"
Wscript.Sleep 100
wshShell.SendKeys "~"
Wscript.Sleep 100

"Ian Matthews" <imat...@arcis.com> wrote in message
news:10e2e01c25b31$ed4d33a0$3aef2ecf@TKMSFTNGXA09...

Ian Matthews

unread,
Sep 13, 2002, 3:32:31 PM9/13/02
to
THANK YOU!!!!

I have been trying to get a script worked out for 2.5
WEEKS! I knew the sample code must be close but I just
don't know enough scripting to fix it.

THANX!!!!
PS I owe you a beer or something equivalent. Keep my
email and if you are ever in Calgary (i.e. Stampede?) drop
me a line.

>.
>

DigitalFootprint.net

unread,
Oct 3, 2002, 7:22:37 PM10/3/02
to
We offer a software solution allows you to login with different user
accounts without logging off the current user. It has a command line
interface that allows you to specify user, password and target file.

This could be used to spawn new processes such as setup programs.

Our demo can be downloaded at

www.digitalfootprint.net

or

search for Akey on zdnet.com


Works in 95, 98, ME, NT 2000 or XP


"Ian Matthews" <imat...@arcis.com> wrote in message news:<1084e01c25b5c$4daf05f0$2ae2...@phx.gbl>...

0 new messages