Change Screen Resolution Remotley in Business environment

fige18

Free Member
Nov 8, 2011
24
0
Hi all,

This is my first post on here and I'm afraid its going to be short and sweet as I am just about to head out of the office.

I currently have a business (call centre) who have teams of upto 10-20 advisors (around 3-400 on each site across 4 sites). These teams or single advisors move around to differnt computers quite often, some don't have set seats.

The issue is the screen resolution, no matter what we set it as standard, we keep getting people asking for it to be changed to a higher or lower screen resolution dependant on their eyesight etc. I understand this is a small issue but we do get these requests quite often and its time consuming logging in as a admin to do this for every advisor who requests it. They do not have the right click facility and are not allowed it.

Does anyone know of any software for remotley changing machines screen rsolution, or somehow doing it through active directory. Or if you have any sensible suggestions please feel free to add them.

Thanks
Chris
 

Posilan

Free Member
Dec 20, 2010
2,540
878
Manchester
Hi Chris,

AFAIK you cannot set screen resolution in roaming profiles - it's hardware dependant.

What OS are the PC's running?

If it's XP, you could install Qres (http://qres.sourceforge.net/) on each PC and then when you need to change the resolution, you can do it remotely with over the network with psexec (http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx).

For windows 7/vista there will probably be similar programs to Qres (Qres may still work)

Steve
 
Upvote 0

fige18

Free Member
Nov 8, 2011
24
0
I am currently looking into both of these replies.

I did want to ask can any of these in the following scenario just cange the screen res instanty?

So lets say we have computer number 1 which had a high resolution on it then we get advisor A move to this PC and say they want a lower reslution as everything is to small. Can we then use Qres or Nircmd to change that specific computers resolutions. Would the advisor need to restart PC or log out and in?

No advisos have roaming profiles, so any settings are for the machine not user.

Thanks for your help, hope you understand what i mena.
Chris
 
Upvote 0

Posilan

Free Member
Dec 20, 2010
2,540
878
Manchester
I am currently looking into both of these replies.

I did want to ask can any of these in the following scenario just cange the screen res instanty?

So lets say we have computer number 1 which had a high resolution on it then we get advisor A move to this PC and say they want a lower reslution as everything is to small. Can we then use Qres or Nircmd to change that specific computers resolutions. Would the advisor need to restart PC or log out and in?

No advisos have roaming profiles, so any settings are for the machine not user.

Thanks for your help, hope you understand what i mena.
Chris
I'm pretty certain the change is instant.
 
Upvote 0

computer storm

Free Member
Aug 1, 2008
487
134
Kilmarnock
If you have a central server that does the authentication they you could use the server to push out the batch file at logon, thats if you are running a windows server. And a group policy could also run a script to call the batch file and assign to a certain OU with in the active directory structure.
 
Upvote 0

computer storm

Free Member
Aug 1, 2008
487
134
Kilmarnock
If you are running windows then you could use the following powershell script to change the resolution on any machine.



Function Set-ScreenResolution {

<#
.Synopsis
Sets the Screen Resolution of the primary monitor
.Description
Uses Pinvoke and ChangeDisplaySettings Win32API to make the change
.Example
Set-ScreenResolution -Width 1024 -Height 768
#>
param (
[Parameter(Mandatory=$true,
Position = 0)]
[int]
$Width,

[Parameter(Mandatory=$true,
Position = 1)]
[int]
$Height
)

$pinvokeCode = @"

using System;
using System.Runtime.InteropServices;

namespace Resolution
{

[StructLayout(LayoutKind.Sequential)]
public struct DEVMODE1
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public string dmDeviceName;
public short dmSpecVersion;
public short dmDriverVersion;
public short dmSize;
public short dmDriverExtra;
public int dmFields;

public short dmOrientation;
public short dmPaperSize;
public short dmPaperLength;
public short dmPaperWidth;

public short dmScale;
public short dmCopies;
public short dmDefaultSource;
public short dmPrintQuality;
public short dmColor;
public short dmDuplex;
public short dmYResolution;
public short dmTTOption;
public short dmCollate;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public string dmFormName;
public short dmLogPixels;
public short dmBitsPerPel;
public int dmPelsWidth;
public int dmPelsHeight;

public int dmDisplayFlags;
public int dmDisplayFrequency;

public int dmICMMethod;
public int dmICMIntent;
public int dmMediaType;
public int dmDitherType;
public int dmReserved1;
public int dmReserved2;

public int dmPanningWidth;
public int dmPanningHeight;
};



class User_32
{
[DllImport("user32.dll")]
public static extern int EnumDisplaySettings(string deviceName, int modeNum, ref DEVMODE1 devMode);
[DllImport("user32.dll")]
public static extern int ChangeDisplaySettings(ref DEVMODE1 devMode, int flags);

public const int ENUM_CURRENT_SETTINGS = -1;
public const int CDS_UPDATEREGISTRY = 0x01;
public const int CDS_TEST = 0x02;
public const int DISP_CHANGE_SUCCESSFUL = 0;
public const int DISP_CHANGE_RESTART = 1;
public const int DISP_CHANGE_FAILED = -1;
}



public class PrmaryScreenResolution
{
static public string ChangeResolution(int width, int height)
{

DEVMODE1 dm = GetDevMode1();

if (0 != User_32.EnumDisplaySettings(null, User_32.ENUM_CURRENT_SETTINGS, ref dm))
{

dm.dmPelsWidth = width;
dm.dmPelsHeight = height;

int iRet = User_32.ChangeDisplaySettings(ref dm, User_32.CDS_TEST);

if (iRet == User_32.DISP_CHANGE_FAILED)
{
return "Unable To Process Your Request. Sorry For This Inconvenience.";
}
else
{
iRet = User_32.ChangeDisplaySettings(ref dm, User_32.CDS_UPDATEREGISTRY);
switch (iRet)
{
case User_32.DISP_CHANGE_SUCCESSFUL:
{
return "Success";
}
case User_32.DISP_CHANGE_RESTART:
{
return "You Need To Reboot For The Change To Happen.\n If You Feel Any Problem After Rebooting Your Machine\nThen Try To Change Resolution In Safe Mode.";
}
default:
{
return "Failed To Change The Resolution";
}
}

}


}
else
{
return "Failed To Change The Resolution.";
}
}

private static DEVMODE1 GetDevMode1()
{
DEVMODE1 dm = new DEVMODE1();
dm.dmDeviceName = new String(new char[32]);
dm.dmFormName = new String(new char[32]);
dm.dmSize = (short)Marshal.SizeOf(dm);
return dm;
}
}
}

"@

Add-Type $pinvokeCode -ErrorAction SilentlyContinue
[Resolution.PrmaryScreenResolution]::ChangeResolution($width,$height)
}
 
Upvote 0

fige18

Free Member
Nov 8, 2011
24
0
We have all our machine and users within our domain. All the machines get imaged with the screen res we want them to have. Our setup does includes group policies and we also use active directory.

I am looking more to be able to change one advisors machines screen when needed rather than all. These are the sort of requests we get more often. Worse case scenario might look at putting a batch file on their dektop, but would prefer to be able to just do it on my laptop run a command to the specific advisor PC's resolutions will change.

I have got Psexec and qres. With Qres folder there is no spscific intall file or anything do I just need put it somewhere in particular for it to work on the advisor machines? Psexec aswell from the machine I will running that off do I simply just start-run then
psexec \\marklap cmd
 
Upvote 0

computer storm

Free Member
Aug 1, 2008
487
134
Kilmarnock
If it is only one person you want create an OU in AD and then assign the user to that OU and apply the policy to run the powershell script, this will then apply to only that user and to any machine he or she signs onto. That would be the best way of doing it. If you have a lot of policys then you can link them to the OU as well, it would make it better for managing and if you need any other user to have the same settings then you just add them to the same OU.
 
Upvote 0

fige18

Free Member
Nov 8, 2011
24
0
We have all our machine and users within our domain. All the machines get imaged with the screen res we want them to have. Our setup does includes group policies and we also use active directory. Our advisor machine have win xp on all of them and my laptop has win7 but I can use a XP machine to do this if I need to.

I am looking more to be able to change one advisors machines screen when needed rather than all. These are the sort of requests we get more often. Worse case scenario might look at putting a batch file on their dektop, but would prefer to be able to just do it on my laptop run a command to the specific advisor PC's resolutions will change.

I have got Psexec and qres. With Qres folder there is no spscific intall file or anything do I just need put it somewhere in particular for it to work on the advisor machines? Psexec aswell from the machine I will running that off do I simply just start-run then
psexec \\ advisormachinename 1024 768 24

I couldnt quite get my head round that if qres is on advisor machine and psexec on my machine how it owuld just chnage the screen res how would it know the advisormachinename i have put it. how does it relate my domain if you understand what I mean with out any real setup?

Also Power storm thanks for your replies all that code you have jus tgiven me is that something that needs running on the actual advisor machine or I can do it from my machine?

Sorry if I am not taking to this too quickly, i do appreciate all of your input.

Chris
 
Upvote 0

fige18

Free Member
Nov 8, 2011
24
0
I will be doing it to more than one advisor just not all at the same time as all the resolutions are already set. Its just if they move to another machine etc or are new and request it. So i would not be looking at having just one machine in an OU if you understand.
 
Upvote 0

fige18

Free Member
Nov 8, 2011
24
0
Ok i am going to go with the psexec i think, so far from my laptop i can use Psexec to get on to an advisor cmd remotley by using command line:

C:\Users\chrisf\Desktop\PsTools\psexec \ \ machinename cmd

that works fine, i just dont know what line of code I need to use to change screen res.

I have only got the screen res to change by having nircmd in system32 file on advsior machine as an admin inputting:

C:\WINDOWS\system32\nircmd\nircmd.exe setdisplay 800 600 32

This changes it straight away i jus now need to use qres or keep nircmd on advisor machine to do this remotley. if anyone can help/supply this i woud be grateful i have tried serveral but doesnt seem to work.

So i just need line of code to input on my laptop to chnage the res on the advisor machine guessing it will startby inputting same as cmd below then.....

C:\Users\chrisf\Desktop\PsTools\psexec \ \ machinename

Thanks
Chris
 
Upvote 0

fige18

Free Member
Nov 8, 2011
24
0
Ok guys here is where I am up to,remotley I can mute and unmute advisors PC's make their screensaver come on BUT cant set their screen res.

I am entring in run on my laptop the followin command

psexec \ \machinename nircmd.exe setdisplay 800 600 32

this does not work remotely but does if i do it on the machine locall myslef with the just the nircmd.exe setdisplay 800 600 32 part.

The only error code I have managed to see in the milsecond you get is error code -1 does anyone know of this error in nircmd?

so basically psexec is doing its job because remotley it does other tasks mute unmute etc and nircmd is working on the machine because its doing it locally.

Anyone who can help from here wouldbe a life saver I have trieda all mornin until now and cant figure it out. Another line of code that doesnt work is log user off but that works locally the line is nircmd.exe exitwin logoff

Maybe the issue is related why they wont work?? I cant figure qres out so only been trying with nircmd?

Thanks
Chris
 
Upvote 0

fige18

Free Member
Nov 8, 2011
24
0
we have that many advisors we cant, they are all set anyway but some of there have eyesight issues and some just like to moan, we wish they would just all stay the same, dont me wrong its not the end of the world but if can get this working saves time that logging in as admin :)
 
Upvote 0

Subbynet

Free Member
Aug 1, 2005
6,000
1,101
45
Luton
Hi Chris,

Could you just give us the OS's in use too - yours and the Advisor machines.

I am entring in run on my laptop the followin command

psexec \ \machinename nircmd.exe setdisplay 800 600 32

You have a space between the slashes in the above command which shouldn't be there... it should be psexec \\machinename

this does not work remotely but does if i do it on the machine locall myslef with the just the nircmd.exe setdisplay 800 600 32 part.

The only error code I have managed to see in the milsecond you get is error code -1 does anyone know of this error in nircmd?

so basically psexec is doing its job because remotley it does other tasks mute unmute etc and nircmd is working on the machine because its doing it locally.

When you try it locally, what type of account are you using? (Admin?)

Right lets change this. As you have policies set on the machine, its possible we have a permissions error, so I think it's worth trying to login as admin to perform the command.

Try.

psexec \\machinename -u machinename\AdminUsername -p Password nircmd.exe setdisplay 800 600 32 > psexecerrors.log

If that doesn't work, search for the psexecerrors.log file and see what the errors are.
 
  • Like
Reactions: fige18
Upvote 0

fige18

Free Member
Nov 8, 2011
24
0
Thanks for the reply,

I am putting \ \ because it's turning into a link when no spaces i know they shouldnt be there and I am not entering spaces when doin the command.

I have windows 7 32 bit on my laptop, all the advisors machines are win XP Pro sp3.

I have tried to do the command from another XP machine as admin and get the same error. When I am local on the machine I am on as admin. I am logged on my laptop not as admin, just my standard account, I just tried running command logged on laptop as admin and got the -1 error again.

I have tried the line of code you have given me and its saying it could not start nircmd due to unknown username or bad password I have double checked them are they are correct. I have searched my laptop and the advisor machine the the error log but its nowhere to be found?

Really appreciate yourhelp so far subbynet.


Chris
 
Upvote 0

JDX_John

Free Member
Mar 26, 2009
1,133
125
North-East England
A couple of thoughts:
  • Modern monitors look really bad if you set a resolution not mapping to the native pixel resolution
  • You might have a mix of 4:3 and widescreen monitors, also - how do you know the right resolution to set?
  • You know you can get users to change DPI instead of resolution, in fact I thought MS recommended this instead of resolution switching
Anyone?
 
Upvote 0

Subbynet

Free Member
Aug 1, 2005
6,000
1,101
45
Luton
I have just tried under local admin also and it comes back to the nircmd.exe exited on mahine name with error code -1

You would have thought nircmd would have error codes to realte to, to see what this this.

:(

Hi Chris,

I have a few things on right now but I'm going to have a go at this myself and run through the steps to make sure I'm not missing anything...

On a second point, as you have XP client machines, there might be another way of making this work and I'll run though this with you too.
 
Upvote 0

fige18

Free Member
Nov 8, 2011
24
0
Thanks subbynet, i will keep at it this afternoon also see if i can make any progress, I managed to try as admin with the command you gave me earlier instead of machine name\adminaccount I had to use domain\adminaccount but got the -1 error again.

No worries if you have stuff on, look forward to hearing from you soon.
 
Upvote 0

Latest Articles