|
|
|||||||
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 |
||||||||
|
|
|||||||
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) |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
Ok let me try that |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
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 . . . |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
"@" 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 |