MSDeploy Command Console - deployment

How to open the "MSDeploy Command Console" that I see in the video "http://www.iis.net/downloads/microsoft/web-deploy" at around 3 minutes, 40 secs
I could access that by pointing a cmd prompt to "C:\Program Files\IIS\Microsoft Web Deploy V3" and then launching msdeploy.exe.
My question is, is this the only way, or there is some command prompt similar to what we have for visual studio command prompt

You can try this:
string deployPath = #"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe";
string deployScript ="-verb:sync -source:package='C\package.zip' -dest:auto"
string scr = string.Format( "/k \"{0}\" {1}", deployPath, deployScript );
Process proc = new Process();
proc = Process.Start( "cmd.exe", scr + " > error.txt" );
This way you call cmd and they inside you run the deployPath specified and by deployScript you say what you want msdeploy to do. /k keeps the console opened so you can see the result and finally > error.txt is there in order to save the output in a file (still working on sending the error)

Related

Executing procdump64.exe remotely using wmic

I am trying to generate a dump file using procdump64.exe in Powershell. I need to run the executable remotely using wmic. I am running the following command:
wmic /node:[IP Address] /user:"[DOMAIN/USER]" /password:"[PASSWORD]" process call create "cmd.exe /c U:\procdump64.exe -ma U:\lsass.exe > C:\dump.dmp"
For reference, I have verified that both procdump64.exe and lsass.exe are located at U:\ .
I receive output that says "Method execution successful" with a Return Value of 0.
However, the file that is generated is empty. Can anyone tell me what is wrong with my command?

How to automate user input to a executable?

I have a .exe file which when called from the Windows Command prompt, first connects to a server and then requests for user input as a confirmation.
Something like below:
C:\SomePath\AnotherFolder>TheApplication.exe download
Logging in to Vault server myserver.app.cosmos...
Logged in to the Vault server
Downloading will overwrite existing files.
Download scripts for context 'COSMOS' to folder:
C:\Work\MyFolder\TEST?
(y/n): n <--- n was my input
Press any key to exit... <--- here i pressed y
I want to automate this process.
I tried the below line from the Windows command prompt:
echo n|TheApplication.exe download
I even tried :
(echo n && echo y)|TheApplication.exe download <-- the y for the last user input request to close the app.
But in both cases its throwing the below error:
Unhandled Exception: System.InvalidOperationException: Cannot read keys when either application does not have a console or when console input has been redirected from a file. Try Console.Read.
at System.Console.ReadKey(Boolean intercept)
at System.Console.ReadKey()
at TheApplication.Program.Main(String[] args)
**disclaimer: TheApplication.exe is a third party executable. I cannot change anything inside it.
PS: If needed I can run this from a powershell console if its not possible from windows command prompt or I can also include the whole thing inside a batch script.
But any how I need to automate this.
If you can use PowerShell...
autoinput.ps1
Add-Type -AssemblyName System.Windows.Forms
Start-Sleep -m 1000
[System.Windows.Forms.SendKeys]::SendWait("ny")
The command is:
powershell .\autoinput.ps1 & .\TheApplication.exe

How do I tell eclipse that an external tool is done executing?

The Eclipse IDE has a feature where one could run external tools. I use it to run batch scripts. Oddly if a batch script runs a powershell command, the powershell command will never exit until I hit enter. This is especially odd since it exits just fine when running in cmd. How should I correct my script so that it runs as expected via the eclipse external tools?
Current script (foo.bat):
#echo off
echo "Hello 1"
REM Configure this to your installation of maven.
SET "CMD=C:\foo.ps1"
REM Reformat args to be Powershell friendly.
SET "ARGS=%*"
SET "ARGS=%ARGS: =' '%"
PowerShell.Exe -Command "%CMD%" '%ARGS%'
echo "Hello 2"
EXIT /B
In cmd, I see "Hello 1", the output of %CMD%, and "Hello 2". In Eclipse, I see "Hello 1", the output of %CMD%, and then it hangs in the progress tab forever until I click the Console window and press the enter key.
I tried passing the -NonInteractive flag to Powershell. I tried having my Powershell script echo a newline at the end. Not sure how to get this to "just work".
Found the answer. I needed to add a NUL redirect to the end of my Powershell command. So it looks like this:
#echo off
REM Configure this to your installation of maven.
SET "CMD=C:\foo.ps1"
REM Reformat args to be Powershell friendly.
SET "ARGS=%*"
SET "ARGS=%ARGS: =' '%"
PowerShell.Exe -Command "%CMD%" '%ARGS%' < NUL
Note that I also removed the dubugging code from the script found in my question. If you add that code back in, you'll see that it echos everything now.

launch cmd run command isn't working

I am working on a script or batch file (or combo of the two) which imports an outlook prf file, then launches a new cmd.exe window runs a application specific program which when passed a server cluster name pulls in an outlook data file in the previously created outlook profile. So i have the vbs script that checks for the outlook profile if it doesn't exist it imports the prf. That's working fine, now the program i need to is called addiman.exe the server cluster name is gsiapp...the manual method is i launch a cmd windows and type "addiman gsiapp" i wish to automates this by calling it in a routine called :Filesite the below command has been unsuccessful, it launches a new cmd.exe window but doesn't run the command.
:ImportPRf
call cscript \\gsf1\Apps\Scripts\public\deployprf.vbs
GOTO :FileSite
:FileSite
start cmd.exe /c "c:\program files\interwoven\worksite\addiman.exe" GSIAPP
GOTO :EXIT
:Exit
Exit
start cmd.exe /c "c:\program files\interwoven\worksite\addiman.exe GSIAPP"
try this, because cmd.exe interprets the part between "" as comand and ignores the GSIAPP statement
wild guess. Try adding another call before the "start" - like this
:FileSite
call start cmd.exe /c "c:\program files\interwoven\worksite\addiman.exe" GSIAPP
problem solved, the full path isn't needed. just had to putt "addiman GSIAPP". Thanks everyone who provided suggestions.

How to create a file without a Command Prompt window

I'm using WinRAR SFX module to create an installation, and use its presetup option to run some preliminary tests.
Since wscript can only accept vbs file, and not the script itself, I first run "cmd /c echo {...script code...} > setup.vbs", and then I run "wscript setup.vbs". The run of the first cmd command opens a brief command window, and I would really like to avoid this. I thought of using RunDll32 to write this data, but couldn't find any suitable API to use.
Can anyone think of a way to bypass it and create a small file with a small VBScript text without opening a Command Prompt window?
Thanks a lot,
splintor
Is the script code already in a file? If so,
You can use the TYPE command to send the script to a file:
TYPE [script_file] > setup.vbs
or COPY the script file:
COPY [script_file] setup.vbs
If the script code is in the body of your cmd, you can use the START command to run the cmd without a window (/b flag):
START /B cmd /c echo {...script code...} > setup.vbs
Rather than use cmd /c echo {...script code...} > setup.vbs as a presetup step, perhaps you could package a VBscript with your install that does your preliminary tests and creates setup.vbs, and then calls setup.vbs for you. You'd have to put this in the setup portion of the WinRAR script.
You can call another VBScript from VBScript like this:
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.Run "wscript d:\setup.vbs, ,True
See this MSDN link for the syntax of the Run command.