Page 1 of 2 12>
Topic Options
#126511 - 2004-09-10 03:34 PM cannot import reg file using SU.exe, why???
expodium Offline
Fresh Scripter

Registered: 2004-07-14
Posts: 35
hi all,

who can tell me why i cant import my reg file with SU.exe?
The error result tell me it is succesfully but when i go see in the registry, i dont see the new key.

my script :

Break on

$SuUsername="userid"
$SuPassword="password"
RunSuAs("c:\winnt\system32\regedit.exe /s c:\1.reg")
? @SERROR

sleep 10
;=======================================================================================================================
Function RunSuAs($CommandLine)
$Devpath="\ntreskit\Su.exe"
If Exist($Devpath)
SetL "SU_DOMAIN=FRITZEU"
SetL "SU_PASSWORD=$SuPassword"
SetL "SU_USERNAME=$SuUsername"
SetL "SU_COMMANDLINE=$CommandLine"
EndIf
EndFunction

many many thanks in advance for who can help me

regards,

patrick

Top
#126512 - 2004-09-10 03:37 PM Re: cannot import reg file using SU.exe, why???
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
What kinda keys you trying to import in the reg file, HKLM or HKCU or Both ?
Top
#126513 - 2004-09-10 03:43 PM Re: cannot import reg file using SU.exe, why???
expodium Offline
Fresh Scripter

Registered: 2004-07-14
Posts: 35
i try to import a HKLM key

1.reg :

[HKEY_LOCAL_MACHINE\SOFTWARE\testenv]
"test"=dword:00000000

i try to import this with a user logged on without admin rights but try to import it with su.exe.

The strange thing is that the error say "succesfully".

thanks for lokking to my problem.

Regards,

expodium

Top
#126514 - 2004-09-10 03:46 PM Re: cannot import reg file using SU.exe, why???
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Unless I'm missing something - I can't see where your actually running SU, you setup a shell command-line here:

$Devpath="\ntreskit\Su.exe"

And I see your establishing the env vars, but I don't see you actually running the su proggy.

-Shawn

Top
#126515 - 2004-09-10 04:00 PM Re: cannot import reg file using SU.exe, why???
expodium Offline
Fresh Scripter

Registered: 2004-07-14
Posts: 35
yes, sorry for that. It have to be "c:\winnt\system32\su.exe"

but still, everithing the same. It give succesfully but dont see the new key in registry.

Regards,

Patrick

Top
#126516 - 2004-09-10 04:03 PM Re: cannot import reg file using SU.exe, why???
expodium Offline
Fresh Scripter

Registered: 2004-07-14
Posts: 35
i change the code so that he use SU.exe. (yeah, really something wrong with code today, its friday )

$Devpath="c:\winnt\system32\Su.exe"
$SuUsername="userid"
$SuPassword="password"
RunSuAs("$Devpath c:\winnt\system32\regedit.exe /s c:\1.reg")
? @SERROR

Sleep 10
;=======================================================================================================================
Function RunSuAs($CommandLine)
If Exist($Devpath)
SetL "SU_DOMAIN=FRITZEU"
SetL "SU_PASSWORD=$SuPassword"
SetL "SU_USERNAME=$SuUsername"
SetL "SU_COMMANDLINE=$CommandLine"
EndIf
EndFunction

regards,

Expodium

Top
#126517 - 2004-09-10 04:12 PM Re: cannot import reg file using SU.exe, why???
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
I think the bit your missing might be here:

Function RunSuAs($CommandLine)

$Devpath="\ntreskit\Su.exe"
If Exist($Devpath)

SetL "SU_DOMAIN=FRITZEU"
SetL "SU_PASSWORD=$SuPassword"
SetL "SU_USERNAME=$SuUsername"
SetL "SU_COMMANDLINE=$CommandLine"

SHELL $DevPath ; <------- here

EndIf

EndFunction

Top
#126518 - 2004-09-10 04:19 PM Re: cannot import reg file using SU.exe, why???
expodium Offline
Fresh Scripter

Registered: 2004-07-14
Posts: 35
i just added your line but still not working.

Is it possible that someone can give me a good example?

many thanks.

Regards,

Patrick

Top
#126519 - 2004-09-10 04:21 PM Re: cannot import reg file using SU.exe, why???
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
i know i had issues with kix recognizing the current directory in the past (i think ver 4.21). Try this

Code:

$Devpath=".\ntreskit\Su.exe"

_________________________
Eric

Top
#126520 - 2004-09-10 04:25 PM Re: cannot import reg file using SU.exe, why???
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Here's an example lifted from one of our admin scripts, instead of calling REGEDIT it calls NETDOM, same diff.

SETL "SU_PASSWORD=******"

CD "C:\NTRESKIT"

SHELL 'SU.EXE ADMINISTRATOR "C:\WINNT\SYSTEM32\CMD.EXE /C $CURDIR\NETDOM.EXE /DOMAIN:$OPDOMAIN /USER:$USERID /PASSWORD:$PASSWORD MEMBER /DELETE >NUL 2>NUL"'

Top
#126521 - 2004-09-10 04:38 PM Re: cannot import reg file using SU.exe, why???
expodium Offline
Fresh Scripter

Registered: 2004-07-14
Posts: 35
sorry but dont understand what it mean with my script. Netdom is for adding or deleting members from the domain (workstations).

is it possible to give me a example with what i needed? importing the reg file.

many many thanks allready.

Regards,

Patrick

Top
#126522 - 2004-09-10 05:06 PM Re: cannot import reg file using SU.exe, why???
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
I think he's just giving you an example of how he uses SU. Just replace the netdom stuff with the regedit stuff you need.
_________________________
Eric

Top
#126523 - 2004-09-10 05:14 PM Re: cannot import reg file using SU.exe, why???
expodium Offline
Fresh Scripter

Registered: 2004-07-14
Posts: 35
i try this but it didnt work also. Thats the reason why asking for a example with the option i neede to add a reg file in to the registry.

But still, many thnaks.

Regards,

expodium

Top
#126524 - 2004-09-10 05:43 PM Re: cannot import reg file using SU.exe, why???
expodium Offline
Fresh Scripter

Registered: 2004-07-14
Posts: 35
when i try it, i get :

PrepareEnvironmentBlock error! (rc=203)
The system could not find the environment
option that was entered.
CreateProcessAsUser error! (rc=2)
The system cannot find the file specified

regards,

expodium

Top
#126525 - 2004-09-10 05:45 PM Re: cannot import reg file using SU.exe, why???
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Lets see your complete script now, with the changes ...


Top
#126526 - 2004-09-10 05:56 PM Re: cannot import reg file using SU.exe, why???
expodium Offline
Fresh Scripter

Registered: 2004-07-14
Posts: 35
SetL "SU_DOMAIN=FRITZEU" (im in a domain environment, FRITZEU)
SetL "SU_PASSWORD=pws"
Shell 'SU.EXE INSTALLER "c:\winnt\system32\regedit.exe /s c:\1.reg"'

userID is correct, pws is a dummy.

many thanks,

expodium

Top
#126527 - 2004-09-10 06:11 PM Re: cannot import reg file using SU.exe, why???
expodium Offline
Fresh Scripter

Registered: 2004-07-14
Posts: 35
i can use su.exe directly because path environment, or when i use c:\winnt\system32\su.exe, i get the same message.

regards,

expodium

Top
#126528 - 2004-09-10 06:38 PM Re: cannot import reg file using SU.exe, why???
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Are you (still) CD'ing to the location of SU before-hand, like this ?

CD "c:\ntreskit"

Shell 'SU.EXE INSTALLER "c:\winnt\system32\regedit.exe /s c:\1.reg"'

If not, try it like that again.

-Shawn

Top
#126529 - 2004-09-10 10:33 PM Re: cannot import reg file using SU.exe, why???
expodium Offline
Fresh Scripter

Registered: 2004-07-14
Posts: 35
i heve now :

Break on

SetL "SU_PASSWORD=pws"
CD "c:\ntreskit"
Shell 'SU.EXE ADMINISTRATOR -e "c:\addreg2.exe"'

and still i get the error :

CreateProcessAsUser error! (rc=1780)
A null reference pointer was passed to the stub.

I found on microsoft site a article about a fix. Its because a build problem but i install allready the suplemental version of resource kit server 2000.

i have version : 5.0.2128.1 (su.exe)

Other idea's?

regards,

expodium

Top
#126530 - 2004-09-11 12:20 AM Re: cannot import reg file using SU.exe, why???
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
This tends to catch a few people out. What is the os that u are deploying too?

And what was the os the .reg file was created in?
_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
Page 1 of 2 12>


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 874 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.078 seconds in which 0.027 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org