#196524 - 2009-10-30 09:01 AM
error in runnas script
|
NaasMarais
Fresh Scripter
Registered: 2009-08-06
Posts: 40
Loc: South Africa, JHB
|
Hi,
I have this problem with the line i need to run
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
%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
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:
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
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
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
|
|
|
|
#196530 - 2009-10-30 10:08 AM
Re: error in runnas script
[Re: Richard H.]
|
NaasMarais
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
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
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
Fresh Scripter
Registered: 2009-08-06
Posts: 40
Loc: South Africa, JHB
|
ok found the problem it is below
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
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
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
/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
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:
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
2 registered
(morganw, mole)
and 414 anonymous users online.
|
|
|