Click here to Skip to main content
14,391,319 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
GeneralI was sent this, and... Pin
OriginalGriff19-Nov-19 11:36
mveOriginalGriff19-Nov-19 11:36 
GeneralRe: I was sent this, and... Pin
phil.o19-Nov-19 11:52
mvephil.o19-Nov-19 11:52 
GeneralRe: I was sent this, and... Pin
Roger Wright19-Nov-19 22:19
professionalRoger Wright19-Nov-19 22:19 
GeneralRe: I was sent this, and... Pin
dandy7220-Nov-19 8:04
Memberdandy7220-Nov-19 8:04 
GeneralRe: I was sent this, and... Pin
Sander Rossel19-Nov-19 22:37
professionalSander Rossel19-Nov-19 22:37 
GeneralRe: I was sent this, and... Pin
OriginalGriff19-Nov-19 22:39
mveOriginalGriff19-Nov-19 22:39 
GeneralFree game Pin
Nelek19-Nov-19 10:43
protectorNelek19-Nov-19 10:43 
GeneralTransforming their No into your Yes! Pin
raddevus19-Nov-19 10:26
mvaraddevus19-Nov-19 10:26 
I work on a number of remote VMs from my local desktop. My local desktop is locked down so I can't install anything. I have to use VMs for dev, etc.

Previously, the default was for each VM's screen to lock with the screen saver after 10 minutes.

I changed it on all of my VMs so it would never lock. Never any need to type in password multiple times a day. The sun was shining and I was smiling for many months. Smile | :)

Policy
Then a new update to Win10 allowed a new policy so that every screen would lock after 10 minutes.
Suddenly the skies darkened and I became very grumpy. Mad | :mad: This meant that I had to type in my password to unlock any of the numerous machines that hadn't been touched in past 10 minutes. Ugh!
Yes, small things make me grumpy. I'm a dev. Roll eyes | :rolleyes:

Local Security Policy
Here's where you find the policy that was changed (imgur image):
https://i.stack.imgur.com/0AkJI.png[^]

Mordac The Preventer Of Information Services
I asked Mordac about it and he said, "NO! It can't be changed, now off with you!"

There's Always A Way
So I wrote this LINQPad - free C# dev playground[^] (C#) script that touches each VM window (mstsc process) every X seconds.
// #######################################################
// ####  Must include the two following libraries
// ####  using System.Diagnostics
// #### using System.Runtime.InteropServices

[DllImport("user32.dll")]
private static extern bool SetForegroundWindow(IntPtr hWnd);

[DllImport("user32.dll", CharSet=CharSet.Auto,ExactSpelling=true)]
private static extern IntPtr SetFocus(HandleRef hWnd);

[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

void Main()
{
	InitializeTimer();
	RescanTimer.Start();
}
System.Timers.Timer RescanTimer = new System.Timers.Timer();
private void InitializeTimer()
{
	RescanTimer.Interval = 45000D;
	RescanTimer.Elapsed += RescanTimer_Elapsed;
}

protected void RescanTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
	try{
		//Stop timer each time, while the elapsed function runs.
		RescanTimer.Stop();
		Process[] processlist = Process.GetProcesses();
		Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
		foreach (Process process in processlist)
		{
		    if (!String.IsNullOrEmpty(process.MainWindowTitle))
		    {
				if (process.ProcessName.Contains("mstsc")){
		        	Console.WriteLine("Process: {0} ID: {1} Window title: {2}", process.ProcessName, process.Id, process.MainWindowTitle);
					SetForegroundWindow(process.MainWindowHandle);
					SetFocus(new HandleRef(null, process.MainWindowHandle));
					ShowWindow(process.MainWindowHandle, 1);
				}
		    }
		}
		Console.WriteLine();
	}
	finally{
		// Insure that even if the elapsed function fails, the timer is still restarted.
		RescanTimer.Start();
	}
}


The timer fires and the script iterates through the processes and finds all mstsc (microsoft RDP) and Sets them to foreground, sets focus on them and does a ShowWindow -- if minimized it sets to regular).

I Know It's Stupid
It's just silly to have to do that, but, it works.

Also...
1. It doesn't use any noticeable CPU
2. it doesn't interrupt you or shift your focus to another screen (while I was typing up this, the code ran numerous times without interrupting)
3. none of the associated VM screens have locked
Yes!

Update!!
I can't believe it. It's already been done.
Dilbert Comic Strip on 2005-08-02 | Dilbert by Scott Adams[^]

Update 2
Unfortunately, if you lock your main computer then the VM windows still seem to lock. Hmmm | :| But, I believe that as long as your screen is unlocked the other VM windows won't lock.

modified 19-Nov-19 16:49pm.

GeneralRe: Transforming their No into your Yes! Pin
RickZeeland19-Nov-19 10:32
communityengineerRickZeeland19-Nov-19 10:32 
JokeRe: Transforming their No into your Yes! Pin
raddevus19-Nov-19 10:39
mvaraddevus19-Nov-19 10:39 
GeneralRe: Transforming their No into your Yes! Pin
RickZeeland19-Nov-19 10:41
communityengineerRickZeeland19-Nov-19 10:41 
GeneralRe: Transforming their No into your Yes! Pin
Marc Clifton19-Nov-19 10:56
mvaMarc Clifton19-Nov-19 10:56 
GeneralRe: Transforming their No into your Yes! Pin
Maximilien19-Nov-19 10:34
MemberMaximilien19-Nov-19 10:34 
GeneralRe: Transforming their No into your Yes! Pin
raddevus19-Nov-19 10:38
mvaraddevus19-Nov-19 10:38 
GeneralRe: Transforming their No into your Yes! Pin
Sander Rossel19-Nov-19 10:46
professionalSander Rossel19-Nov-19 10:46 
GeneralRe: Transforming their No into your Yes! Pin
Nelek19-Nov-19 10:48
protectorNelek19-Nov-19 10:48 
GeneralRe: Transforming their No into your Yes! Pin
raddevus19-Nov-19 10:53
mvaraddevus19-Nov-19 10:53 
GeneralRe: Transforming their No into your Yes! Pin
Nelek19-Nov-19 20:13
protectorNelek19-Nov-19 20:13 
PraiseRe: Transforming their No into your Yes! Pin
phil.o19-Nov-19 10:55
mvephil.o19-Nov-19 10:55 
GeneralRe: Transforming their No into your Yes! Pin
Rick York19-Nov-19 12:17
mveRick York19-Nov-19 12:17 
GeneralThought of the Day Pin
OriginalGriff19-Nov-19 5:28
mveOriginalGriff19-Nov-19 5:28 
NewsRe: Thought of the Day Pin
lopatir19-Nov-19 5:38
Memberlopatir19-Nov-19 5:38 
GeneralRe: Thought of the Day Pin
W Balboos19-Nov-19 5:39
mveW Balboos19-Nov-19 5:39 
GeneralRe: Thought of the Day Pin
DRHuff19-Nov-19 6:23
MemberDRHuff19-Nov-19 6:23 
GeneralRe: Thought of the Day Pin
Ravi Bhavnani19-Nov-19 6:55
professionalRavi Bhavnani19-Nov-19 6:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.