How to shutdown a Windows Server 2003 machine remotely usin C#? - c#-4.0

I want to shutdown/reboot a Windows Server 2003 machine remotely using C Sharp. I have the Administrator credntials. This app will be ran from local machines also on the LAN.
I have tried so many examples on the internet, and none appear to work :(

Instal PsShutdown app from sysinternals link package and then use your code to call it like:
Process.Start("psshutdown.exe","-h -u "Login" -p "Password" \\PCNAMEORIP");
That's the simplest way i can suggest.

Related

Does psexec open a GUI window on the local host and the remote machine?

I've been using psexec for a while to do admin tasks and its very helpful. The other day I was looking at the online help and discovered the "-i" interactive switch so I started messing around with it and doing some research. This website explains the feature this way:
"For example, the following PsExec command will open the notepad.exe process on the remote computer and display it on the local user’s desktop:
psexec -i \\lon-srv01 notepad"
So at first I couldn't get it to work but then I found a few tips that helped and now I can invoke psexec with the "-i" switch from an administrator cmd prompt on my laptop, and use this syntax to launch an application on my workstation remotely.
Working syntax: PsExec.exe -i 5 -s \\<remotePC> regedit
So in this case, regedit launches on the remote machine but not on my local machine. Is my understanding of the interactive feature incorrect? I'm assuming the GUI should load on my local machine as well so I can do admin tasks. Am I wrong? Is the article I quoted wrong?
I'm seeing "interactive" in the documentation and assuming I can interact with the application GUI locally, similar to how I can interact with a linux application like Gedit remotely using a third party app like MobaXterm.
Can someone set me straight here?
Thanks,

Is it possible to execute sh files GUI application from linux remote server and view it on local machine?

I have a job that runs denodo platform on remote server. Sh files is a GUI application, and I have to run it to start denodo service. I can't access it in windows, is there a way to solve these problems?
Already running sh files on Putty Windows, but only return null.
If it's a linux GUI application, you should "export display" to view the server screen on your workstation.
Depending of your workstation linux distribution, it might be as easy as :
xhost +<IP_address_of_workstation>
./runMyApp.sh
As your workstation is running windows operating system, you have do further configuration :
https://superuser.com/questions/325630/how-can-i-export-display-from-a-linux-terminal-to-a-windows-pc
https://seanthegeek.net/234/graphical-linux-applications-bash-ubuntu-windows/
If your workstation is connected through SSH you need even more configuration as discussed here : https://unix.stackexchange.com/questions/12755/how-to-forward-x-over-ssh-to-run-graphics-applications-remotely
You can run GUI-Applications of remote linux host in a windows client via ssh (putty) with x-forwarding and an installed x-server (xming)
See this question:
https://superuser.com/questions/299158/how-to-make-putty-do-the-equivalent-of-ssh-x

Is it possible to open X11 application in terminal of a server in linux?

I can launch X11 application through my local machine to X11 enabled server.
e.g. ssh -x from my localmachine(linux desktop) then launch a installed application from the minimal server.
I would like to know if it's possible to access my installed application directly from my minimal server. e.g. ssh -x ?
Thank you.
Not sure if it is useful but better you can use either Xming or Mobaxterm to get an X11 for a linux machine . Ultra VNC/VNC are also some of those kind .

remote command on windows from linux

I want to run windows command on windows 2003 server from RHEL machine.
I tried one way to do it using winexe and it is working as expected. However to do this one I have to keep 139 port open and apparently this is a very vulnerable port and is advised not to be kept open.
One other way I found was to use cygwin and open ssh packages but these are again not supported in windows 2003 server.
Can anyone please suggest me any other way leaving these 2 to connect linux and windows machine and run command on cmd.exe from linux terminal.
You can emulate the whole Windows on RHEL using the Wine software. So you won't need to connect anywhere.
Other option is to connect from RHEL to Windows 2003 Server via an SSH.
Installing of an OpenSSH server on Windows has a couple of quirks:
in Windows settings you have to allow your account to run services
in the sshd config file of the OpenSSH server you have to set the StrictModes option to no, so you can use the SSH authentication by public/private keys

How to run Shiny Server on linux using remote acces?

I'm trying to put in production my shiny app. I can run my shiny app locally on my Windows machine, from R. However, since we need to use Linux to deploy the app over the web, we decided to use a Linux server for that. We access this Linux server remotely, from our local machines (running Windows).
I followed the instruction at the RStudio website, and successful installed Shine Server on the Linux server. Its's running on it. I don't know what to do next. So, my question is: what should I do next? Please, remember that I access the Linux server remotely (using puty). Also, I have almost no knowledge of Linux.
Any guidance on what to do next is very welcome.
Some info that may be useful:
I use a Ubuntu 12.04.3
I ran as root (I think, but I can use sudo, for sure).
Another person has access to this server besides me.
We use R 3.0.2
you can follow the instructions here:
https://groups.google.com/forum/#!msg/shiny-discuss/NuZp0ziVXvw/BXHcIoXThnoJ
Short answer:
# this is all one line
sudo wget\
https://raw.github.com/rstudio/shiny-server/master/config/upstart/shiny-server.conf\
-O /etc/init/shiny-server.conf
# Start the server
sudo start shiny-server
Then just open a browser and point to it

Resources