bubaibhatta
asked on
Batch file to Launch cmd.exe
Hi all,
I want to publish an app in Xenapp 5.0 (Windows 2003) through which I can launch command prompt on any of the server. Here is the idea:
1. user clicks on the icon from webpage (Citrix Web Interface)
2. application launches, it asks for the server for which it need to connect.
3. connects to server and command prompt launches.
I dont want to use any third party software for that.
How do I do that? Please help!!
I want to publish an app in Xenapp 5.0 (Windows 2003) through which I can launch command prompt on any of the server. Here is the idea:
1. user clicks on the icon from webpage (Citrix Web Interface)
2. application launches, it asks for the server for which it need to connect.
3. connects to server and command prompt launches.
I dont want to use any third party software for that.
How do I do that? Please help!!
Hmm and what about if you publish CMD ? As exe file?
ASKER
Hi Jeremyno,
I can do that. But the issue here is that I have to publish 50 appliactions for that to connect each server in the farm.
Naturally I thought of somekind of batch file which will ask me a choice of the server and accordingly connect me to the particular server of my choice.
I can do that. But the issue here is that I have to publish 50 appliactions for that to connect each server in the farm.
Naturally I thought of somekind of batch file which will ask me a choice of the server and accordingly connect me to the particular server of my choice.
Ok,
i whose thinking litle bit about and the solution is powershell
here is simple script for something like you need
http://stackoverflow.com/questions/11130336/run-mstsc-exe-with-powershell
powershell understand CMD commands and can be used remotly without publishing or you can publish script.
Is this what you looking for?
i whose thinking litle bit about and the solution is powershell
here is simple script for something like you need
http://stackoverflow.com/questions/11130336/run-mstsc-exe-with-powershell
powershell understand CMD commands and can be used remotly without publishing or you can publish script.
Is this what you looking for?
If you have session sharing then as JEREMYNO said you can publish CMD and launch it after you have launched the application.
Alternatively, you can publish a batch file (.bat or .cmd) instead of the application; where it has two commands: one to launch the application and the second after sleeping for several seconds launch cmd.
Alternatively, you can publish a batch file (.bat or .cmd) instead of the application; where it has two commands: one to launch the application and the second after sleeping for several seconds launch cmd.
ASKER
Hi Mutawadi,
Can you explain a bit more on that? I am talking about the second option...
Can you explain a bit more on that? I am talking about the second option...
$computername = read-host "Enter the computer name"
invoke-command -filepath c:\windows\system32\cmd.ex e -computerName $computername
You can use the above line for powersheel scirpts..
invoke-command -filepath c:\windows\system32\cmd.ex
You can use the above line for powersheel scirpts..
On a batch file it would be something like this:
Start "C:\bla\bla\bla\<your app execution>"
Timeout /T 3
Start "C:\Windows\System32\cmd.exe"
Yes or you can use this script with manual edit of computer name with conditions if you want
list of servers just with numbers 1. SERVER1, 2.SERVER2
see here
http://technet.microsoft.com/en-us/library/ff730939.aspx
list of servers just with numbers 1. SERVER1, 2.SERVER2
see here
http://technet.microsoft.com/en-us/library/ff730939.aspx
ASKER
Hi Venurajav,
whenever I try to run c:\windows\system32\cmd.ex e -computerName $computername it runs on the same system, not on the remote system. Is there ant way to do that? I installed powershell on the server where I am running the script.
whenever I try to run c:\windows\system32\cmd.ex
Copy 2 line in the notepad and save it with ext ps1.Run the the file, first it will prompt for the computer name and then it run the cmd from that computer.
But i am not sure how you can use this to publish :(.
But i am not sure how you can use this to publish :(.
Hi normaly you will publish powershell.exe with parameter
%windir%\system32\windowsp owershell\ v1.0\power shell.exe YOUR_SCRIPT_NAME.ps1
%windir%\system32\windowsp
With PowerShell, you will need the invoke-command cmdlet, as shown in http:#a39203702. cmd.exe does not know of a -Computername switch. Further, you need to have Remoting (WinRM) active and configured on each target to allow for PS to execute commands.
http:#a39203733 is wrong. start doesn't run remotely, and the first parameter enclosed in double quotes is used as title, and not as command to execute.
http:#a39203733 is wrong. start doesn't run remotely, and the first parameter enclosed in double quotes is used as title, and not as command to execute.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The solution that I find is much more easier than that other's. I was expecting exactly the same.