.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Open a Command Prompt of Remote Computer

Posted By:      Posted Date: September 03, 2010    Points: 0   Category :ASP.Net
Hi All, I need to open a Command prompt (cmd.exe) of a Remote server computer and Run a Command from my asp.net web application (C# laungauge).  I have progressed till opening a command prompt of the webserver where the website is hosted. My code is:System.Diagnostics.ProcessStartInfo psi = new ProcessStartInfo(); psi.WorkingDirectory = "C:\\WINDOWS\\system32"; psi.FileName = "cmd.exe"; Process p = Process.Start(psi); System.Threading.Thread.Sleep(5000); I have achived this using the VB script. The code is:wshShell.run("c:\scripts\uptime\psexec.exe \\nawinapp627 -u domainname\userid -p password cmd.exe") WScript.Sleep 5000 In the above code psexec.exe is software used to access remote computers. nawinapp627 = Remote server Please help me to achieve above using C#. Advance thanks..

View Complete Post

More Related Resource Links

Accessing the command prompt of the server computer in c#

Hi ,I'm developing a web application in asp.net using  C# and need to access the command prompt of the server computer.After accessing it I need to run a "ABC.bat" file in the server computer which is in folder "E:\Test".The absolute path of the server is "\\MyServer"Any help to achieve this ( or any other alternative suggestions) would be greatly appreciated....ThanksPS: I need to run the ABC.bat file on the server machine as the bat file runs couple of more applications which are licensed to that server machine.

How to Acess VSS from a remote Computer


i acess vss from lan with no problems and now i want acess from a remote computer not in a Lan

I need access over the Internet

What are settings i need to set up in the server and my client machine

There is already an open DataReader associated with this Command which must be closed first.


when i insert record

There is already an open DataReader associated with this Command which must be closed first.

help me.

SqlConnection conn = new SqlConnection(@"Data Source=Localhost\SQLEXPRESS;Initial Catalog=StudentDetails;Integrated Security=True");

SqlCommand cmd2 = new SqlCommand();
SqlCommand cmd1 = new SqlCommand();

if (conn.State == ConnectionState.Closed)

cmd2 = new SqlCommand("Select * from UserInfo where Standard", conn);
            SqlDataReader dr1 = cmd2.ExecuteReader();
            string stu, par,std,sec,roll;
            par = "";
            stu = "";
            std = "";

How to generate pdf from 2005 rdl report files from command prompt?

Hi All, I have a scenario like this, i have 10 rdl reports, which needs to run on a job basis with out any user interaction. Tell me is there any way to generate the pdf from command prompt using existing 2005 rdl files. Your help is more appreaciated!! Thanks, Sarvesh M  Sarvesh

Prompt "The proper type library could not be found in the system registry" when open SQL2008 Express

Hi folks, I just format my notebook and installed the Win7Pro Eng 32-bit version and then install the SQL2008Express. I restarted my notebook as usual after the installation and open the SQL SMS, it prompt the following error "The proper type library could not be found in the system registry", It's a big dialog with certain text saying I do not have permission...etc. Since, I am using administrator account to open the program already but still fail. I have to repaire the SQL SMS too. May I know any other I can check? Any comment is highly appreciated. Thank you very much! Regards, Tony  

ReportBuilder 2.0: open server report via command line?

Hello,is it possible to launch ReportBuilder 2.0 and pass the server report to open via command line?Searching the forums I have found this blog-entry (Launching Report Builder from the command line), but I think it is for ReportBuilder 1.0, because SQL Server 2005 is mentioned. I have tried it anyway, but ReportBuilder 2.0 just starts with an empty report.If I specify a rdl-file from the local file system the report will open fine:MSReportBuilder.exe d:\temp\samplereport.rdlthanks in advance and best regards,Gerald

Open Office Documents from Document Library without Password Prompt

We have a SharePoint site and Document library set up for anonymous access.   All non-Microsoft file types open correctly without a password.   When users click on Microsoft Office documents they are prompted for passwords.   Is there some way to configure the Office documents or Document Library so that users are not prompted for passwords when they open documents or is this a bug?

Executing a program on a remote computer


I'm trying to execute a program on a remote computer, using code ofcourse, and i'm trying the following:

The function rerturns code 8 which says "unknows failure" and the program i was trying to execute (or any other program for that matter) doe's not run.
Nothing happens except that on the remote computer the mouse curser changes for a split of a second. I know the connection is OK because of that - plus if i change one of the parameters (computer name, user name, password) to a wrong one, the program exits.

Does anyone know what might be the problem?


By pass the prompt - Do you want to open or save this file?


Is there any way that I can avoid or bypass the following prompt: Do you want to open or save this file?

I am using a data view webpart where I have hyper-linked a column with  an infopath file. So when ever I click on the hyperlink, a window prompts with the mentioned text.

Any help in this regard will be appreciated!

one user open a website (one computer and not another computer) on same time


how to restrict web site one time login(1101) at same time nobody used  this id (1101)

update SharePoint list with data from infopath form using the Command Prompt or similar


i have a InfoPath form that is updating a SharePoint list when it is submitted. Now i added some extra Fields to the Sharepoint List. All these new Fields are empty till I open the InfoPath form and hit the submit buttion again.

Is there a way to update all the empty fields from the old entrys I made.

My first Idea was to search for a Powershell Solution but unfortunately I am using Windows Server 2003 R2, Sharepoint 2007 and IndoPath 2007.

Hopefully someone can Help ;)

thanking you in anticipation

Deploy a project to a remote computer



I have an Analysis Services project in Visual Studio and I want to deploy it to a remote server, but I can't connect to the server. What might I be doing wrong? Is it related to the impersonation definition of the database?



How to type Korean Characters in command prompt of Korean win2k3/XP

We are not able to type the Korean multi-bytes in command prompt of Korean-Win2k3/XP. But we able to copy paste the Korean characters command prompt successfully. Here we are using “MS-IME2002” as keyboard type

In case of Korean-Win2k8, able to type through both command prompt by selecting “MS-IME2002” as keyboard type.

Get Remote computer DATETIME




I want to know the remote computer which is in LAN. Get the DATETIME according to diff zones and change the date time value . how can this be done using VB.net?any code?

Thanks Avinash Desai

Why do I get: There is already an open DataReader associated with this Command which must be closed



I create a Form and show it:

            JelentesForm jf = new JelentesForm(Globals.DC, (int)row.Cells["Jelentes_ID"].Value);
            jf.StartPosition = FormStartPosition.CenterParent;

The form gets the DataContext (DC) and the ID of row in a table to work with.

In the constructor the form reads the row, then validates it:

            var jel = from j in context.JELENTES where j.Jelentes_ID == Jelentes_ID select j;
            jelentes = jel.Single();


The validating means calling the same stored procedure for the fields to check them. The stored procedure reads data from other tables for checking.

When I open the form first time it is all right. When I close the form (without any action) and open it second time I get the error above in the validateAll() on the first call of stored procedure.

I tried to move the validateAll() from constructor into form_Shown event, then tried to move it into a

2008 R2 Upgrade Advisor from command prompt fails


I've run the 2008 R2 Upgrade Advisor (from the GUI) successfully, finding several upgrade issues in a run which takes around 20 minutes. When I run the command prompt version of the tool, using the config file created by the GUI run, it returns immediately with no error message and having created no report. Here's the command:

C:\>"C:\Program Files\Microsoft SQL Server 2008 R2 Upgrade Advisor\UpgradeAdvisorWizardCmd.exe" -ConfigFile "C:\Documents and Settings\MyLogin\My Documents\SQLServer 2008 R2 Upgrade Advisor Reports\MyServer\Config.xml"

Why is the command doing nothing? I need this to automate my pre-upgrade analysis work.

There is already an open DataReader associated with this Command needs to be Closed



Hope this subject seems to be familiar in search. I need this subject to be taken for a discussion to get the right solution for me.

My scenario:

I am using  a web service which access the sql server database to provide an XML output. this part is working fine. I am using a SqlDataAdapter and DataTable with Fill method to get the data.


When more than one person access this web service at the same time i get the error message which is given in the subject line.

I understand the problem is because of the sql connection which is still open by the first user. If the first user completes his operation before the second users request then both the user receives the correct response.

My Solution:

What i did was i initiated 10 connection strings and will check which connection string is closed and i have used this connection for the second persons request if they both access at the same time.

My Question:

I know this is not the best solution. So i want to take this topic to be discussed to get a right solution. I am in need of some idea from the experts in this forum to resolve my issue.


Thanks & Regards

Karthikeyan S


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend