GCP windows VM does not work when logged off - google-cloud-platform

I am running a Windows Server VM on GCP.
When logging in via Remote Desktop, I am starting certain applications which should actively run for a couple of hours.
But when closing my Remote Desktop Connection, all applications stop working.
How can I prevent this from happening?

In order to keep the session ongoing, you'll have to configure the RD Session Host time limits.
Open the group policy editor with: Windows+R, then type gpedit.msc, confirm with Enter.
Then in the management console, navigate to:
Computer Configuration
Administrative Templates
Windows Components
Remote Desktop Services
Remote Desktop Session Host
Session Time Limits
There one can adjust the settings:
Set time limit for disconnected sessions
Terminate session when time limits are reached

Related

Automate an RDP connection right after Windows instance turns on in GCP

I am performing some UI Automation on GCP using a Windows Server.
The process is as follows:
=> Machine Switches on at a defined time
=> RDP Connection to Machine
=> UI Interaction Script Runs on Startup
=> Process Ends
=> Machine Switches off at a defined time
All the components have been fulfilled except for automating the RDP connection in some way or other. I referred to this link but didn't find much insights or documentations.
Does anyone know a way to Automate an RDP connection right after instance turns on in GCP?
There is a windows application called IAP Desktop, using that you can manage multiple remote Desktop connection to Windows VM. While connecting to the VM you can save the credentials which will allow you to access the Windows VM using RDP just after boot on.
Also to automate the Windows password generation here is the documentation related to 1, inside of that document there are both options available automate or manually.
How are you deploying your startup script?
During the boot sequence, a script will either run before, after or during the boot process. By declaring Windows-specific metadata keys, you can run startup scripts after the instance turns on.
If that doesn't work, there is a paid Cloud Automation service that sounds like it will meet your requirements.
Tried using startup-scripts but no luck IAP Desktop didn't work due to scheduling as well. Finally Managed to solve it via using Windows 10 Auto login settings. This skips login screen and the best part was that out of all the users, it allows you to login via user of your choice. After I Login to the system, I added a startup a bat file by running shell:startup and it worked great.

AWS - Managing EC2 user sessions

I have an EC2 (Windoes Server R2 2012) that is running a NodeJS process. Now, the detail is that once I get Disconnected from server (Disconnection it is supposed to keep everything on server, hence my NodeJS process) after a few minutes, the session is killed, so also the process.
I connect again and it is like I have signed out. How can I solve this? I really need to the process still running without stay ALWAYS connected to the server.
Normally Windows installation will not logoff disconnected sessions.
Your installation is probably customized for it to be logging off disconnected RDP sessions.
Load the Group Policy Object Editor and go to Computer Configuration -> Administrative Templates -> Windows Components -> Remote Desktop Services -> Remote Desktop Session Host -> Session Time Limits.
Check that the setting "Set time limit for disconnected sessions" is either Not Configured, or Enabled, but with a setting of Never.

Scheduling the opening of Chrome on EC2 startup

I currently am using the ec2 API to launch an instance of windows server. When the instance has started, I want to open up chrome to a specific webpage before I need to RDP into the server for a specific profile. I have tried setting up a task scheduler and working with user scripts to do this, but I haven't had any luck getting to work properly. What would be the best way to start up a program right when an instance starts?
Thanks
It might be better to not launch chrome when the instance starts (having chrome running serves no purpose if no user is logged in), more likely you want to run a program when a user starts an RDP connection:
http://technet.microsoft.com/en-us/library/cc770821.aspx

When running as a windows service, how do i get the number of active monitors? C++

I have ran into an issue when retrieving the number of active monitors while the exe is running as a windows service. I have tried using EnumDisplayDevices and GetSystemMetrics(SM_CMONITROS) to get the number of monitors, these two methods woulds give me the correct number of monitors when running them as console mode (meaning initiated by the user), but when I register the exe as a service and run it through the windows service, the number of monitors that was reported turned out to be incorrect.
Is there any other way to determine the number of active monitors while running as a windows service? Or any other work around? Thanks in advance!
Services are not allowed to interact with the user desktop for security reason. Therefore they are running in their virtual desktop which has nothing to do with the physical one. You can try the following. In the service list of the service manager. Rightclick your service, go to properties and there to "Log On". There you can change the account the service is using. With the "Local System account" you can check the "Allow service to interact with desktop". I didn't try that my self. But for interacting the service has to get the access to the "real" desktop and therefore the monitor count should be right.

Web Server in IIS stops time after time

I have developed a web service in c# (ASP.NET), and published it in IIS 6.1 (Windows Server 2008). Web application takes data from this web service, but time after time it does not return anything. After I restart web service it works again normally. I don't understand why web service stops returning result time after time. What can cause this? Any help please?
Hard to say without knowing any details. But an approach would be checking the event logs.
Set the Idle timeOut for an Application Pool to 0 instead of default value of 20 minutes for having no timeout when your service is idle.
using inetmgr
Open IIS Manager. For information about opening IIS Manager, see Open
IIS Manager (IIS 7).
In the Connections pane, expand the server node and click Application
Pools.
On the Application Pools page, select the application pool for
which you want to specify idle time-out settings, and then click
Advanced Settings in the Actions pane.
In the Idle Time-out (minutes) box, type a number of minutes, and then click OK.
uisng cmd
appcmd set config /section:applicationPools /[name=' string
'].processModel.idleTimeout: timeSpan
appcmd set config /section:applicationPools /[name=' Marketing '].processModel.idleTimeout:0.00:30:00