How to work with MSDeploy through command line? - iis

I want to run a .bat file on my server via MSDeploy from remote. I installed the remote agent service on the server and started it. Also installed MSdeploy on my computer.
Now I want to execute the bat file from remote.
Can anyone help me out?
Thanks, any help will be upvoted immediately!

You're looking for the runCommand provider:
msdeploy.exe -verb:sync ^
-source:runCommand="path\to\batch.bat" ^
-dest:auto,computerName=serverName,userName=user,password=pass
This will automatically transfer the batch file to the remote server as long as it is named .bat or .cmd and you do not pass any parameters to it.

It sounds like you are trying to execute the bat file on one machine from another machine? If so have you considered PsExec from Sysinternals? http://technet.microsoft.com/en-us/sysinternals/bb897553

Related

How to run multiple scripts in remote machine

I have to remotely connect to a gateway(working on Linux platform), inside which I have couple of executable files (signingModule.sh and taxModule.sh).
Now I want to write one script in my desktop which will connect to that gateway and run signingModule.sh and taxModule.sh in two different terminals.
I have written below code:
ssh root#10.138.77.150 #to connect to gateway
sleep 5
cd /opt/swfiscal/signingModule #path of both modules
./signingModule #executable.
But through this code I am able to connect my gateway but after connecting to gateway nothing is happening.
2nd code:
source configPath # file where i have given path of both the modules
cd $FCM_SCRIPTS # variable in which i have stored the path of modules
ssh root#10.138.77.150 'sh -' < startSigningModule** #to connect and run one module.
as an output of this i am getting:
-source: configPath: file not found
Please help me working this out. Thanks in advance.
Notes:
I can copy paste my files in that gateway if required.
Gnome-Terminal or any other alternatives of this is not working in my gateway
ssh root#10.138.77.150 "cd /opt/swfiscal/signingModule && ./signingModule"
Line source configPath doesn't work because you need specify full path to the file.
You can pass several commands to ssh to run them in sequence; but I prefer a different solution: I have whole scripts locally; and running them remotely means:
Using scp to copy my script to the remote system
Using ssh to then run the script on the remote system
The big advantage here: there is always a potential for getting things wrong (for example: quoting) when directly giving commands to ssh. But when you put everything into a script, you have exact/full control over what is going to happen. You can put things like "set -e" into your script to improve error handling ...
(and of course, you can also automate the two steps listed above!)

cPanel cron job, no input file specified?

I've just set up my first cron-jon to run a stock script every night.
Running it manually works fine.
It's stored in /admin/stock_update.php
The command i'm running is /usr/bin/php -q /admin/stock_update.php
But I'm getting emails saying no input file is specified?
Any ideas?
Cheers
Network services almost never expose actual paths on the server's hard disk drive and even if they could it isn't a behaviour you can rely on. So the fact that your file is located at /admin/stock_update.php in the FTP server doesn't say much about actual location on disk, which is what local command-line utilities expect.
In PHP, you can find path on disk of current file with the __FILE__ magic constant. You can create a test script:
<?php
var_dump(__FILE__);
... upload it to the same FTP location and execute through the web server. If that's not an option because files in your FTP account in not visible from the web you can run the file from cron and check the email.
Do you have CloudLinux kernel installed on that server and CageFS filestyem? If yes try running this:
cagefsctl -w cpaneluser; cagefsctl -m cpaneluser
Then try running the cron again

Can't start a win10 app remotely

I need to start a win10 app remotly.
What I already tried is:
for starters I used this path: shell:appsfolder\appname!app
using psexec to start the app doesn't work
same with powershell (over psexec as well as native ps remote)
also tried starting it indirectly from a .cmd file and .vbs file executing form psexec
all these command and files are working if executed directly on the client. But if I try to execute them remotly I get the error message path not found or it just nothing happening and really nothing I checked if the appropriate exe file is running via taskmanager. Apparently there must be some issue with the name translation of shell:appsfolder over a remote session.

Locked out of Jenkins

I enabled jenkins security thinking it would prompt me to create an account. I tried deleting and editing my config.xml file in c:/program files/jenkins but i'm not sure how to restart jenkins without having access.
Any help would be appreciated.
I'm running Jenkins on a windows server, recently updated to the latest version.
If you don't have a lot of other configuration that you'd like to save, you can just delete %JENKINS_HOME%/config.xml and restart Jenkins to disable security.
Otherwise, edit config.xml and set the values inside the <useSecurity> tags to false, then restart Jenkins.
I had this exact issue today on my windows jenkins server.
Just removing the xml file and restarting did not work for me either. I had to:
Stop the service.
Check taskmanager to ensure the process is gone.
Either edit the Config.XML file and change the useSecurity false or delete the config.xml file.
Now start the service again
You can try: How to restart Jenkins manually?
or kill the process in taskmanager or do a taskkill in windows shell.
Here are the instructions to restart from command line:
Open Command Prompt.
Type one of the following: without qoutes
To stop a service, type:
net stop 'service'
To start a service, type:
net start 'service'
Also I think you may be looking in the wrong folder. Do you have a config.xml in
C:\Users\yourUserName\.jenkins?

How to start IIS Express Manually

Is there a command line program or service that I can use to start IIS Express manually?
iisexpress program is responsible for that.
http://www.iis.net/learn/extensions/using-iis-express/running-iis-express-from-the-command-line
Once you have IIS Express installed (the easiest way is through Microsoft Web Platform Installer), you will find the executable file in %PROGRAMFILES%\IIS Express (%PROGRAMFILES(x86)%\IIS Express on x64 architectures) and its called iisexpress.exe.
To see all the possible command-line options, just run:
iisexpress /?
and the program detailed help will show up.
If executed without parameters, all the sites defined in the configuration file and marked to run at startup will be launched. An icon in the system tray will show which sites are running.
There are a couple of useful options once you have some sites created in the configuration file (found in %USERPROFILE%\Documents\IISExpress\config\applicationhost.config): the /site and /siteId.
With the first one, you can launch a specific site by name:
iisexpress /site:SiteName
And with the latter, you can launch by specifying the ID:
iisexpress /siteId:SiteId
With this, if IISExpress is launched from the command-line, a list of all the requests made to the server will be shown, which can be quite useful when debugging.
Finally, a site can be launched by specifying the full directory path. IIS Express will create a virtual configuration file and launch the site (remember to quote the path if it contains spaces):
iisexpress /path:FullSitePath
This covers the basic IISExpress usage from the command line.
From the links the others have posted, I'm not seeing an option. -- I just use powershell to kill it -- you can save this to a Stop-IisExpress.ps1 file:
get-process | where { $_.ProcessName -like "IISExpress" } | stop-process
There's no harm in it -- Visual Studio will just pop a new one up when it wants one.
Or you simply manage it like full IIS by using Jexus Manager for IIS Express, an open source project I work on
https://jexusmanager.com
Start a site and the process will be launched for you.
There is not a program but you can make a batch file and run a command like that :
powershell "start-process 'C:\Program Files (x86)\IIS Express\iisexpress.exe' -workingdirectory 'C:\Program Files (x86)\IIS Express\' -windowstyle Hidden"

Resources