Powered by Blogger.

Run a Visual Studio project in another PC via command prompt

Saturday, May 23, 2015

First we need to access Visual Studio (VS) Developer Command Prompt (DCP) in the remote machine via the regular prompt. Accessing VS DCP is explained here.

This link shows how to debug a VS project via DCP.

Assuming now we have a .exe file in the Debug folder, we can use the following code now to run the application remotely.

C:\Users\source_user_name>psexec -i \\destination_ip -u destination_user -p destination_password "C:\Users\destination_user\Documents\Visual Studio 2012\Projects\my_roject\my_roject\bin\Debug\my_application.exe"

Access command prompt of another PC via IP

1. Download and extract PsTools to "C:\Windows\System32" in both source and target PCs (In my case both are Windows 8).

2. Open command prompt and type:
"reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\system /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f"

Following was the output:
The operation completed successfully.

3. Let us access "ipconfig" remotely as an example. Type the following in the command prompt of the source computer.

psexec \\destination_ip_address -u destination_username -p destination_password ipconfig

Note:
If you get the following error, please try the code given below in the remote PC.

Error:
Couldn't access 192.168.1.106:
The network path was not found.

Make sure that the default admin$ share is enabled on 192.168.1.106.

Code to try:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\AutoShareServer Change the AutoShareServer key to 1

Referrences:
1. http://stackoverflow.com/questions/18388381/make-sure-that-the-default-admin-share-is-enable-on-servername
2. serverfault.com/questions/422078/psexec-unknown-user-name-or-bad-password-in-workgroup