#127126 - 2005-09-06 04:00 PM
Re: CPAU.exe - Create Process As User
|
Lonkero
KiX Master Guru
   
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
|
Top
|
|
|
|
#127130 - 2006-10-11 12:01 AM
Re: CPAU.exe - Create Process As User
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11625
Loc: CA
|
|
Top
|
|
|
|
#127132 - 2006-10-11 09:55 AM
Re: CPAU.exe - Create Process As User
|
Richard H.
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
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
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
   
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
MM club member
   
Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
|
Wonder if Shawn's RUNNAS handles this better?
|
Top
|
|
|
|
#127139 - 2006-10-20 09:29 AM
Re: CPAU.exe - Create Process As User
|
Senser
Fresh Scripter
   
Registered: 2005-05-26
Posts: 32
Loc: The Netherlands
|
@masken,
You should try specifing environment vars with {%{var}%}. That should work.
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 465 anonymous users online.
|
|
|