Shutdown Windows When Remote Desktop Connection Closes - windows

I am trying to build a "desktop in the cloud" using the Apache Guacamole service and Google Cloud VMs. I have accepted that I can not boot a VM on a RDP connection, but I am wondering if there is a way to shut down a machine on RDP disconnect.
I have a Windows Datacenter VM hosted as my "desktop" and Apache Guacamole hosted on another server to RDP into the desktop. To save money I would like to shut down the VM when I disconnect. Basically, when I terminate the RDP connection can I detect that and trigger shutdown?
I am not averse to writing bash or python scripts to accomplish this task, but I need some direction.
Thanks,
Owen

As per Squashman's recommendation:
I created a task in the Task Scheduler that is triggered by a disconnect from the user and had it run a bash script to shutdown the machine.
Thank you!
Script:
SHUTDOWN /p

Related

Steps required to SSH into Azure Windows VM from a Linux VM

Having created a Windows Azure VM and opened ports 3389 and 22 for inbound RDP and SSH connections, respectively.
I can successfully connect to the vm via RDP from a remote Windows PC.
Testing SSH connection in the Portal succeeds. However trying to connect from a remote Linux VM using SSH fails.
Given that SSH connection test within the portal succeeds, it suggests that (1) it is possible to SSH into a windows VM; and (2) there is no other config require on the server ie installing OpenSSH (or similar) / Copying over key file(s) to some location etc. However, the help steps in the Azure Portal for my Windows VM, for making remote SSH connections suggest that maybe a public key needs to exist on the server and that I need the private key on the LinuxVM I am trying to connect from.
Please could someone help me understand if ssh into windows Azure VM is possible and if so, the requirements / minimum set of steps (on the target Windows VM and the source Linux VM) I need to get to a state that I can successfully SSH.
Other posts re similar question posted have not helped me connect via ssh. I have not found a 'golden source of truth' on Microsoft docs. Maybe I missed it.
Thank you.
A Windows Server doesn’t typically come pre-built and ready to go with SSH access and it requires some setup. You can follow this to set up your Azure VM for SSH access. You can configure SSH on a Windows Azure VM for access, check out How to Set Up OpenSSH on a Windows Server. After deploying the OpenSSH, you can follow the steps about connect via SSH with client in the Azure portal on your Linux client to access that Windows VM via SSH.

Lost rdp access to EC2 instance

I changed the firewall (on windows server ) of an Amazon EC2 instance to accept the Remote Desktop connections only for a specific IP address .
Once changes are done , i lost connection and i am no longer able to access the instance .
my question is :
is there a way to access this instance again or is it completely lost ?
You might be able to use Windows Remote Management (WinRM) to open a console to the machine and change the firewall setting from the command line.
WinRM uses port 5985 and it is on by default on some windows images on EC2 (not all of them). Try opening port 5985 in your security group and log in with a Powershell client.
There are some instructions on how to use powershell for WinRM here: How to programmatically/remotely execute a program in EC2 Windows instance
You can run the steps in the script manually.

Cannot set up a tcp session to an azure worker role listener when debugging locally

I have a SocketListener running in an azure worker role. It works fine but I want to debug locally. I can connect to the worker role using localhost but cannot connect from remote clients.
I have tested the router and incoming firewall by using a tcp terminal program I have switched off the firewall on my development pc.
Please can you help me to get remote clients to connect to a worker role listener being debugged on the development machine.
Thank you
The local windows azure development emulator is not designed to support remote connections. I would suggest deploying the application to Windows Azure and remotely debugging to test your scenario.

Amazon EC2, failed to ssh due to ssh server not started

I added a bad script in startup script, turned out this script is blocking and hence ubuntu instance can't boot up to ssh server and I can't ssh into it. Is there a way for me to go to the server console (like from VGA port)? like go to single-user mode or safe mode and fix it?
Thanks in advance.
I don't know of any way to obtain server console access or change boot modes on the EC2 instances...
I had the same issue sometime ago, and I ended up creating a temporary EC2 instance, mounting the root device from the original (failing) EC2 there, modifying the files, then reattaching the device and destroying the temporary instance. Note: you may end up paying more depending on which instance type you launch.

Windows 7 remote desktop connection conflict with FTP Serve?

Today I was connecting to another computer using Windows 7 remote desktop connection and I just setted up a IIS FTP server on this computer. Then I changed the inbound rule of windows 7 firewall to allow FTP service. After finishing that, I lost connection with the computer and could not connect to it using Remote Desktop Connection. Why will this happen?
I know another solution for this problem on OnlineVNC basis. OnlineVNC it is a remote desktop with
embeded FTP server inside which does not conflict each other. Very easy to set up and fast. Maybe it will be help full for you.
http://www.onlinevnc.com/support/configuring-ftp-based-file-transfer.html

Resources