Page 1 of 1 1
Topic Options
#196524 - 2009-10-30 09:01 AM error in runnas script
NaasMarais Offline
Fresh Scripter

Registered: 2009-08-06
Posts: 40
Loc: South Africa, JHB
Hi,

I have this problem with the line i need to run
 Code:
SHELL '%comspec% /c %systemroot%\system32\runnas.exe /user:rds\xxxxx "%logonserver%\netlogon\bginfo\bginfo.exe %logonserver%\netlogon\bginfo\rds.bgi /nolicprompt /silent /timer:0" /password:xxxx /env'
 

It tells me "The system cannot find the file specified"
When I copy and paste this into cmd it work no probs
 Code:
%systemroot%\system32\runnas.exe /user:rds\xxxxx "%logonserver%\netlogon\bginfo\bginfo.exe %logonserver%\netlogon\bginfo\rds.bgi /nolicprompt /silent /timer:0" /password:xxxx /env


Please can someone point out my problem for me must be something to do with the %COMSPEC%

Thanks


Edited by NaasMarais (2009-10-30 09:13 AM)
_________________________
KIX Scripting is the Bomb!!

Top
#196526 - 2009-10-30 09:43 AM Re: error in runnas script [Re: NaasMarais]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Make sure that your current working drive and directory are real as some processes will object if they are not, and they may not be during login / runas activities.

Output the value of the command so that you can check it - the event log is a handy place to write it if your script runs hidden:
 Code:
GO "C:"
CD "C:\"

$sCommand='"'+%COMSPEC%
	+'" /c "'+%SYSTEMROOT%+'\system32\runnas.exe" /user:rds\xxxxx "'
	+%LOGONSERVER%+'\netlogon\bginfo\bginfo.exe" "'
	+%LOGONSERVER%+'\netlogon\bginfo\rds.bgi" /nolicprompt /silent /timer:0 /password:xxxx /env'
 
$=LogEvent(4,0,"About to execute: "+$sCommand,"","MyScript.kix")
Shell($sCommand)

Top
#196527 - 2009-10-30 09:54 AM Re: error in runnas script [Re: Richard H.]
NaasMarais Offline
Fresh Scripter

Registered: 2009-08-06
Posts: 40
Loc: South Africa, JHB
Hi Richard

I ran the script you did and got this back from the event log


The description for Event ID ( 0 ) in Source ( MyScript.kix ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: About to execute: "C:\WINDOWS\system32\cmd.exe" /c "C:\WINDOWS\system32\runnas.exe" /user:rds\xxxxx "\\RDSJNBPEN2\netlogon\bginfo\bginfo.exe" "\\RDSJNBPEN2\netlogon\bginfo\rds.bgi" /nolicprompt /silent /timer:0 /password:xxxx /env.


Edited by NaasMarais (2009-10-30 09:54 AM)
_________________________
KIX Scripting is the Bomb!!

Top
#196528 - 2009-10-30 10:04 AM Re: error in runnas script [Re: NaasMarais]
NaasMarais Offline
Fresh Scripter

Registered: 2009-08-06
Posts: 40
Loc: South Africa, JHB
Sorry forgot to enter the username and password

The description for Event ID ( 0 ) in Source ( MyScript.kix ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: About to execute: 0.
_________________________
KIX Scripting is the Bomb!!

Top
#196529 - 2009-10-30 10:06 AM Re: error in runnas script [Re: NaasMarais]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
 Quote:
"C:\WINDOWS\system32\cmd.exe" /c "C:\WINDOWS\system32\runnas.exe" /user:rds\xxxxx "\\RDSJNBPEN2\netlogon\bginfo\bginfo.exe" "\\RDSJNBPEN2\netlogon\bginfo\rds.bgi" /nolicprompt /silent /timer:0 /password:xxxx /env


Ok, so you can see that all you environment variables have expanded, so your %COMSPEC% is fine.

Check that the other values/paths are correct, and if they are you are going to need to start breaking the process down to find which bit is failing.

Top
#196530 - 2009-10-30 10:08 AM Re: error in runnas script [Re: Richard H.]
NaasMarais Offline
Fresh Scripter

Registered: 2009-08-06
Posts: 40
Loc: South Africa, JHB
Ok let me try that
_________________________
KIX Scripting is the Bomb!!

Top
#196531 - 2009-10-30 10:09 AM Re: error in runnas script [Re: Richard H.]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
 Quote:
About to execute: 0


I think you broke something.

The zero means that the "$sCommand=" expression has become a numeric rather than string expression.

Top
#196532 - 2009-10-30 10:26 AM Re: error in runnas script [Re: NaasMarais]
NaasMarais Offline
Fresh Scripter

Registered: 2009-08-06
Posts: 40
Loc: South Africa, JHB
ok found the problem it is below

 Code:
Enter password:
RUNNAS: The parameter is incorrect.
\\RDSJNBPEN2\netlogon\bginfo\bginfo.exe\\RDSJNBPEN2\netlogon\bginfo\rds.bgi
ERROR : Error in expression.!
Script: c:\my documents\scripts\bginfo.kix
Line  : 2

Press any key to continue . . .
_________________________
KIX Scripting is the Bomb!!

Top
#196533 - 2009-10-30 10:44 AM Re: error in runnas script [Re: NaasMarais]
NaasMarais Offline
Fresh Scripter

Registered: 2009-08-06
Posts: 40
Loc: South Africa, JHB
Alright I got it to work up until this part of the code
 Code:

SHELL '%COMSPEC% /c %systemroot%\system32\runnas.exe /user:rds\loginscript "%logonserver%\netlogon\bginfo\bginfo.exe %logonserver%\netlogon\bginfo\rds.bgi" /nolicprompt /silent /timer:0'



After that I still need to add the following
 Code:
/password:itRocks@33 /env


But i am not getting it to work
_________________________
KIX Scripting is the Bomb!!

Top
#196535 - 2009-10-30 04:15 PM Re: error in runnas script [Re: NaasMarais]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
"@" is a special character in KiXtart.

Either disable macros in strings with SetOption() (read the manual for more info) or double the character:
 Code:
/password:itRocks@@33

Top
Page 1 of 1 1


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

Who's Online
2 registered (morganw, mole) and 414 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.062 seconds in which 0.023 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