Chef windows_package resource execution shows a "Run as" dialog - automation

Im trying to install SmartBear through windows_package, however when it is executing the resource, a CMD prompt says "installing service", it closes, and then a "Run As" dialog shows, of course that dialog won't go anywhere except for a user intervention.
the error raised if i click on cancel (after waiting for a while) is:
FATAL: Mixlib::ShellOut::CommandTimeout: windows_package[SmartBear TestExecute 9.31] (smartbear::testexecute line 61) had an error: Mixlib::ShellOut::CommandTimeout: command timed out:
---- Begin output of start "" /wait "C:\chef\cache\TestExecute\setup.exe" /s /sms ----
STDOUT:
STDERR:
---- End output of start "" /wait "C:\chef\cache\TestExecute\setup.exe" /s /sms ----
Is there any workaround for it?

Related

sshexec Remote command failed with exit status -1

I have the following line in my xml code trying to kill a java process.
<sshexec command="kill something" failonerror="false"/>
and I sometimes get this error:
[sshexec] Remote command failed with exit status -1
The process is not killed and therefore when I restart it again I get 2 instances of it not 1.
Could anyone help me with the meaning of the exit status?
Thanks
Non zero exit status usually means that program finished with some error.
https://en.wikipedia.org/wiki/Exit_status
In order to debug this problem you may to login to your remote server and execute your kill command manually to see the error.

Tasklist / Taskkill Logon Failure

I am trying the list tasks on a Win10 PC from a Win7 PC so I can create a batch script to kill that process.
the following is the code i have typed in command prompt (running in administrator mode)
tasklist /s remotepc /u remotepc\user /p password
This keeps returning the error
ERROR: Logon Failure: unknown username or bad password
I've triple checked the username password and computer name and they are all correct.
I've tried dropping the computer/domain name for the /U command but that did not work.
can anyone help?
Thanks in advance

rabbitmq-plugin returns "error could not recognize command"

I installed rabbitmq for windows server 2012. it installed properly.I want to run rabbitmq_management command inside the rabbitmq-plugin.bat but the bat file when double clicked throughs "error could not recognize command".Googled the error didn't find a thing.How can i ovveride the error?
Open a cmd terminal, go to the rabbitmq sbin folder and execute:
rabbitmq-plugin.bat enable rabbitmq_management

Passing CMD Results to Variable in a Batch File

I am trying to install an application and a group of services using PSTools, but I want to take into account that the computer I am trying to connect to may be turned off or on a different network, which is not reachable from the internal network.
Basically if the machine is not able to be accessed through the admin share, this is the message that I am getting:
Couldn't access MachineName:
The network path was not found.
Make sure that the default admin$ share is enabled on MachineName.
This is the syntax I am using to try to capture the "Error Message" and then report back that if installation was successful or not (depending on if it can contact the machine)
#echo off
set /p name=What is the machine name?:
psexec.exe \\%name% -u *useraccount* -p *password* \\ServerName\installation.bat
FOR /F "tokens=*" %%A IN ('COMMAND ^| FIND "Couldn't access"') DO SET Error=%%A
If "%Error%"=="Couldn't access"
ECHO Installation Failed.
Else
ECHO Installtion complete.
Pause
exit
Currently it hangs right at the point it's defining the Error Variable. Can't quite figure out what I am going wrong here.
'COMMAND ^| FIND "Couldn't access"' opens a command shell, which is why it hangs. It will not proceed until that shell is exited.
You will need to look at redirecting the error messages to another file. 2>Errors.txt on the psexec line will give you a file to search in the next line.
this will make the batch file look something like this:
#echo off
set /p name=What is the machine name?:
psexec.exe \\\%name% ... \\\ServerName\installation.bat 1>Error.txt 2>&1
for /f "tokens=*" %%A in ('FIND /i error.txt "Couldn't Access"') do SET Error=%%A
If not x%ERROR:Couldn=%==x%ERROR% (
ECHO Installation Failed.
) Else (
ECHO Installtion complete.
)
Pause
exit
(Also, notice the use of brackets to make a multi line IF)
the check for if will see if Couldn is part of the string, as a direct comparison will not work, as you would have to check against the whole string including the machine name

Cannot start a VB Windows Service from batch

I created a custom windows service in Visual Basic using Visual Studios '05.
The service is on our server which is running Windows Server 2003. I have installed the service, and it runs perfectly when I go into Computer Management and Start the service manually.
I have created a batch file to start the service using the NET START command. Whenever I run the batch file, the service doesn't start. I get this message from the command prompt:
The 'Service Name' is starting.
The 'Service Name' could not be started. The service did not report an error. More help is available by typing NET HELPMSG 3543.
I'm not sure what to do. (Been "googling" for a couple of hours.) It starts up when I manually run it, but it wont start via the batch file. Thanks!
Try forcing it to elevate in the batch file.
#ECHO OFF
:: Automatically elevate...
#ECHO OFF
SETLOCAL
:: Check if script was run with administrator privilages
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
:: If the error flag is set, we do not have admin.
IF "%ERRORLEVEL%"=="0" GOTO GOTADMIN
:UACPROMPT
ECHO. Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
ECHO. UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%TEMP%\getadmin.vbs"
EXIT /B
:GOTADMIN
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
CD /D "%~dp0"
ENDLOCAL
GOTO SCRIPTSTART
:: THE ACTUAL SCRIPT STARTS HERE
:SCRIPTSTART
NET START [whatever service]