Logon failure in running a windows service - service

I am running a service called prunner on windows server 2012. I used the command sc to change the username and the password of the service:
sc.exe config myService obj= "sqa265\hero" password= "hero1"
The output of the command is saying that it have succeed but when I go to task manager in order to start the service I get: logon failure!!!
I tried to run the sc command under the user hero and under the user administrator but I still get the same error. But the very strange thing is that if I do the same thing manually via the task manager and service control pane I success and the service go to the state:running!!! But I need to automate this thing, so please any help?

You need to give the account "sqa265\hero" the SeServiceLogonRight permission. As you have noticed setting the credentials up through the control panel works, but what you might not have noticed is that if you tried to use the command line after using the control panel.
You can test this by setting the service back to the Local System account in the control panel, and then running your command-line again.
To fix this from a script, you can use the NTRights utility outlined in this MS knowledgebase article:
http://support.microsoft.com/kb/315276
After you install NTRights, you can run it like this:
NTRights.exe +r SeServiceLogonRight -u "sqa265\hero"
Combined with the sc config commandline you already have, the service should run with those credentials.
Further reading:
http://www.techrepublic.com/article/set-user-rights-using-the-ntrights-utility/5032903

Related

Alternatives for PsExec which works in standard user

I am using psexec to execute commands on remote server. Here is my command,
PsExec.exe" -u user \\server -h run.bat
I am entering the password manually. here I am using standard user account due to security issues. When I run the command I am getting the error,
"Make sure that the default admin$ share is enabled"
I read here that it cannot be done without admin privileges.
But when I test the same command in LAN it works in standard user.
How it works in LAN not in Remote server ?
Is there any alternative tools which will work in standard user ?
Please help me.
As an alternate tool, you can use Powershell and WinRM. Powershell allows you to execute a command, or an interactive session, on the remote windows server.
An example of executing a command is available here:
How to programmatically/remotely execute a program in EC2 Windows instance
If you need an interactive session, look at the Powershll command 'Enter-PSSession': https://technet.microsoft.com/en-us/library/hh849707.aspx

How do I install a windows service that runs as an administrator without GUI?

If we assume that a service must be run as administrator, is it possible to install it using a command line (sc.exe, powershell - all is available)?
Bonus: Is it possible to do without providing password?
sc.exe config 'servicename-notdisplayname' obj='\Administrator' password='secret'
Still no luck avoiding password, as it's required when starting the service.

Spring XD - Unable to undeploy & destroy stream through --cmdfile option

Today i have started automating certain Spring-XD tasks like, stream creation, deployment, and undeploying the same.
For this, all my undeploy and destroy commands sit in one file, but when i run the following
$xd-shell --cmdfile auto_cleanup_14032016_235706.txt
I'm getting the following output:
WARNING: Command 'stream destroy --name ingestion_14032016_235706_<>' was found but is not currently available (type 'help' then ENTER to learn about this command)
But When i run the same command inside the interactive shell xd-shell -- It seems to work fine. :(
You will notice this Warning when xd-shell fails to connect to Spring XD admin. Unless specified xd-shell assumes the admin server to be on localhost.
Add below statement to the top of your cmdfile.
admin config server http://spring-xd-admin-server:9393
Also provide the credentials to spring xd admin if required.

Wildfly add-user.sh Instance to Management Instance

I'm running Wildfly within Docker. I need to add users and set the configuration before the java process is started.
I can run the add-user.sh script to create a simple user:
/wildfly/bin/add-user.sh admin admin --silent
However, I need to create a management user that will be used for authenticating an instance with the managed instance. In the CLI the option is:
"Is this new user going to be used for one AS process to connect to another AS process?", reply yes.
Is there a way to set this option via a parameter in the script?
add-user.sh just adds the user to: mgmt-users.properties
so you can generate this value for yourself pretty easily.
This will give you access to the container
docker exec -it wildfly-instance /bin/bash

JasperReports Server Installation fails while executing initdb.exe of postgresql

JasperReports Server 5.6.0
I am able to successfully install JasperReports Server in unattended mode, when login to a specific machine as local Administrator. But I want to do the installation from a remote machine and am passing the same parameters as earlier(invoking the setup using CPAU for run as admin), but it fails while executing initdb.exe with the data folder creation.
I am getting the following error message as stated below.
"Executing initdb.exe -U postgres -E UTF8 -D C:/JASPER~1/JASPER~1.6/POSTGR~1/data
Script exit code: unknown signal
Script output:
Script stderr: child killed: unknown signal"
After googling and looking for a possible solution, I tried the following.
1) Created the data folder via cmd and provided full control permissions using cacls
2) Created the parent folder 'JasperServer' and provided inheritance permissions of OI, CI, Full Control.
But the issue appears to be the same. Though I am able to install JR Server with the same account by rdp in to the specific machine.
Can anyone help me out?
pls try this:
http://community.jaspersoft.com/wiki/bundled-installer-fails-error-running-initdbexe
Reason: You are using domain admin account.
Solution:
change to local admin user and restart install procedure,then it works:-)
By, Kosta