Page 1 of 1 1
Topic Options
#127125 - 2004-09-28 12:08 PM CPAU.exe - Create Process As User
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
Another RunAs freeware replacement tool found... dunno if it has been mentioned here before?

http://www.joeware.net/win32/index.html
_________________________
The tart is out there

Top
#127126 - 2005-09-06 04:00 PM Re: CPAU.exe - Create Process As User
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
updated link:
http://www.joeware.net/win/free/tools/cpau.htm
_________________________
!

download KiXnet

Top
#127127 - 2006-10-10 01:53 PM Re: CPAU.exe - Create Process As User
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
uhm.. to root a useful tool up, does anyone know how to feed variables like %LOGONSERVER% into CPAU when creating .job files? If you just put the variable there, it gets resolved which I don't want.
Top
#127128 - 2006-10-10 02:33 PM Re: CPAU.exe - Create Process As User
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Try ^%LOGONSERVER^%
Top
#127129 - 2006-10-10 10:30 PM Re: CPAU.exe - Create Process As User
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
doesn't work m8... :/

My line:
cpau -u DOMAIN\Utility -p mypassword -ex "%LOGONSERVER%\NETLOGON\KIX32.EXE %LOGONSERVER%\NETLOGON\Utils\myscript.kix" -enc -file myscriptjob.job

What I tried:
cpau -u DOMAIN\Utility -p mypassword -ex "^%LOGONSERVER%^\NETLOGON\KIX32.EXE ^%LOGONSERVER%^\NETLOGON\Utils\myscript.kix" -enc -file myscriptjob.job


Edited by masken (2006-10-10 10:44 PM)

Top
#127130 - 2006-10-11 12:01 AM Re: CPAU.exe - Create Process As User
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Here is some further info to hopefully help you.

Syntax : Escape Characters, Delimiters and Quotes
http://www.ss64.com/ntsyntax/esc.html

Command shell overview
http://www.microsoft.com/resources/docum...w.mspx?mfr=true

small problem
http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=153766

Parsing C++ Command-Line Arguments
http://msdn.microsoft.com/library/defaul...e_Arguments.asp

bug (?) when passing variable on the commandline
http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=154793


RUNNAS - Tokenized Runas Utility
http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=153599
 

Top
#127131 - 2006-10-11 02:15 AM Re: CPAU.exe - Create Process As User
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
try %%LOGONSERVER%%

cj

Top
#127132 - 2006-10-11 09:55 AM Re: CPAU.exe - Create Process As User
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
You've got a typo:
Wrong:
Code:
"^%LOGONSERVER%^\NETLOGON\KIX32.EXE ^%LOGONSERVER%^\NETLOGON\Utils\myscript.kix"


Right:
Code:
"^%LOGONSERVER^%\NETLOGON\KIX32.EXE ^%LOGONSERVER^%\NETLOGON\Utils\myscript.kix"



When typed correctly it works for me:
Code:
C:\Temp\KiXtart_OddsAndSods>echo %LOGONSERVER%
\\XXXDC00004

C:\Temp\KiXtart_OddsAndSods>echo ^%LOGONSERVER^%
%LOGONSERVER%




But be warned, MS have had a couple of goes at escaping special characters, all of which have been idiotic and overly complicated. Depending on the version of Windows and the prevailing direction of the wind either the "%%" or the "^%" technique should work.

Also, you need to know how the string is used. If there is a danger that environment strings might be expanded again, then you will need to keep adding the escape characters until it gets through.

If this is a one-off command to get the environment variables into a command then often the simplest technique is to unset the environment variable before you run the command, then set it back to the original value afterwards.

For example:
Code:

C:\Temp\KiXtart_OddsAndSods>echo %LOGONSERVER%
\\XXXDC00004

C:\Temp\KiXtart_OddsAndSods>set OLDLS=%LOGONSERVER%

C:\Temp\KiXtart_OddsAndSods>set LOGONSERVER=

C:\Temp\KiXtart_OddsAndSods>echo %LOGONSERVER%
%LOGONSERVER%

C:\Temp\KiXtart_OddsAndSods>set LOGONSERVER=%OLDLS%

C:\Temp\KiXtart_OddsAndSods>echo %LOGONSERVER%
\\XXXDC00004



BTW, how are you checking that the correct command is being stored?

Top
#127133 - 2006-10-11 09:55 AM Re: CPAU.exe - Create Process As User
It_took_my_meds Offline
Hey THIS is FUN
*****

Registered: 2003-05-07
Posts: 273
Loc: Sydney, Australia
Quote:

cpau -u DOMAIN\Utility -p mypassword -ex "^%LOGONSERVER%^\NETLOGON\KIX32.EXE ^%LOGONSERVER%^\NETLOGON\Utils\myscript.kix" -enc -file myscriptjob.job




That's not correct. Try ..

Code:
 cpau -u DOMAIN\Utility -p mypassword -ex "^%LOGONSERVER^%\NETLOGON\KIX32.EXE ^%LOGONSERVER^%\NETLOGON\Utils\myscript.kix" -enc -file myscriptjob.job 



Edited by It_took_my_meds (2006-10-11 10:05 AM)

Top
#127134 - 2006-10-11 11:03 AM Re: CPAU.exe - Create Process As User
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
@meds, that results in the following *.job file:

Quote:

CPAU V01.10.00cpp Joe Richards (joe@joeware.net) October 2004

Attempting to create CPAU job file: myscript.job
Job file Created with following information:
Job File: myscript.job
Domain : MYDOMAIN
User : Utility
Password: mypassword
Execute : ^%LOGONSERVER^%\NETLOGON\KIX32.EXE ^%LOGONSERVER^%\NETLOGON\Utils\myscript.kix
CRC Files:




Will this work?

Top
#127135 - 2006-10-11 01:37 PM Re: CPAU.exe - Create Process As User
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Quote:

Will this work?



Probably not

Try clearing the value as I've described above. This will definately get the command-to-execute correct.

At least you don't have spaces in the paths anywhere, or that would cause even more problems!

The next issue is whether CPAU will expand the environment variables, but you should be able to test that yourself with a test script.

Top
#127136 - 2006-10-11 01:42 PM Re: CPAU.exe - Create Process As User
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
Wonder if Shawn's RUNNAS handles this better?
Top
#127137 - 2006-10-12 03:19 AM Re: CPAU.exe - Create Process As User
It_took_my_meds Offline
Hey THIS is FUN
*****

Registered: 2003-05-07
Posts: 273
Loc: Sydney, Australia
If I understand correctly what you are trying to achieve, I suggest that you create the scheduled task in Windows to generate the job file you want. To deploy that job file to another computer, copy it to %windir%\tasks and use schtasks to set the credentials.
Top
#127138 - 2006-10-12 09:57 AM Re: CPAU.exe - Create Process As User
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
*.job files are CPAU precompiled/"tokenized" jobs. The script itself is a part of the login script that requires admin privs.

All I want to do is create a CPAU "job" command which calls my script with admin privs. The "job" file should refer to %LOGONSERVER% since it affects people over WAN:s...

Guess one way is to create a small .cmd file which contains the real call to the script, and have the *.job file point to a specific DC since it seems impossible to have environment vars when creating *.job files... :/

EDIT
Blah.. that didn't work either...


Edited by masken (2006-10-12 11:09 AM)

Top
#127139 - 2006-10-20 09:29 AM Re: CPAU.exe - Create Process As User
Senser Offline
Fresh Scripter
*****

Registered: 2005-05-26
Posts: 32
Loc: The Netherlands
@masken,

You should try specifing environment vars with {%{var}%}. That should work.
_________________________
Kix2Exe - Kixtart Script Packager - Check : http://kix2exe.ramonitor.nl

Top
Page 1 of 1 1


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

Who's Online
1 registered (Allen) and 475 anonymous users online.
Newest Members
min_seow, Audio, Hoschi, Comet, rrosell
17881 Registered Users

Generated in 0.066 seconds in which 0.025 seconds were spent on a total of 11 queries. Zlib compression enabled.

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