Jump to content

Recommended Posts

Posted

Good afternoon all

 

I was just wondering if there is a way to set the screen resolution for a computer via GPO?

 

Basically, the machines running our IWB, I want to ensure run at 1024x768 instead of the native resolutions and I just wondered if there was a way to make this happen via GPO?

 

Also, on a similar topic, is there a way to set accessibility options per user with GPO too? We have a couple of visually impaired students and I'd like to be able to set their desktops to something better for them when they log in.

 

Many thanks

Andy :)

Posted

Don't know about script but i know a way you can do it in a batch file:

 

Change Resolution (chres.exe V1.0) -

 

It's in german but you get the jist, whack that in a login script for the student/teacher in question with the resolution you desire

 

EDIT: come to think of it, i've not tested to see if it works on windows 7

  • Thanks 1
Posted
Don't know about script but i know a way you can do it in a batch file:

 

Change Resolution (chres.exe V1.0) -

 

It's in german but you get the jist, whack that in a login script for the student/teacher in question with the resolution you desire

 

EDIT: come to think of it, i've not tested to see if it works on windows 7

 

I'll give it a try .. :)

Posted
You could probably do a registry preference and apply that to the user via gpp (since iirc screen res can only be on the user level and not the machine)

 

screen res is per machine isnt it?

  • 7 months later...
  • 2 months later...
Posted (edited)

Anyone using the powershell script as a startup script and/or have you got it working with 'best' resolution too? Trying to add this for our laptops and it doesn't seem to do anything, wondering if the laptop display is somehow not the primary display.

Just incase i've got the wrong end of the stick, I've pointed the startup script to a .ps1 script with parameters "set-screenresolution -width x -height y"; I presume this is the intended method?

 

Would like to avoid qres etc but even running this manually doesn't seem to effect the resolution with zero feedback from the console....

 

*edit My coding is too rusty to explain it but removing the function around the code seems todo the trick, then just call the script with x and y numbers for the resolution you want.

Edited by nicklec
  • 2 weeks later...
Posted
Anyone using the powershell script as a startup script and/or have you got it working with 'best' resolution too? Trying to add this for our laptops and it doesn't seem to do anything, wondering if the laptop display is somehow not the primary display.

Just incase i've got the wrong end of the stick, I've pointed the startup script to a .ps1 script with parameters "set-screenresolution -width x -height y"; I presume this is the intended method?

 

Would like to avoid qres etc but even running this manually doesn't seem to effect the resolution with zero feedback from the console....

 

*edit My coding is too rusty to explain it but removing the function around the code seems todo the trick, then just call the script with x and y numbers for the resolution you want.

 

Could you elaborate on this a little bit? I copied and pasted the code, but when i call it nothing happens. I even set the script restrictions trying to get it to work but i am having no luck.

Posted

maybe i misunderstand qres, but i want to do this through GPO for the following reason.

We have students and users who can change the resolution on a monitor. We want at startup and logout to shift a monitor back to a "default" res (say 1024x768). we would like to be able to also set this at the OU level so it can be 1440x900 for 19'' wide, 1650x1050, etc. We want it to be automatic, and we want to also have the nice effect of the laptop using the whole monitor

we dont want this for a program reason, we want to set it so one person doesnt leave it at 800x600, and then the next user complains

 

edit: i should also mention we are using Windows 7 x64 Enterprise

Posted
I jusr shove a shortcut to qres in a pcs all user startup gets copied their from a gpo applied to an ou or filtered on a group
Posted
in as startup and logon/logoff script to ensure it stays as planned. if you use different scripts for staff and students, and or machines, you can achieve what you want to.

were doing startup and logoff scripts. currently we are using Display Changer from 12 noon. What we notice is that it doesnt always do it, even in the scripts. We have also tried Reschange, but are having the same inconsistent issues with this too. Thats why i wanted to try that powershell script, but i cant get the script linked above to do anything

Posted
That's why I wanted to try that PowerShell script, but I can't get the script linked above to do anything

What is the PowerShell execution policy set to on the clients?

Posted

currently not allowed. we are wrapping the call like this (we do this for remoteapp)

 

powershell.exe "Set-ExecutionPolicy Unrestricted CurrentUser"

powershell.exe C:\remoteapp-wcx\Install-RADConnection.ps1 c:\remoteapp-wcx\remoteapp.wcx

powershell.exe "Set-ExecutionPolicy restricted Currentuser"

 

in a cmd file, but doing this i still cant get that powershell script earlier to work. I know someone edited it, but i wanted to know how. maybe i am calling that script wrong?

  • 2 months later...
  • 3 months later...
Posted
Anyone using the powershell script as a startup script and/or have you got it working with 'best' resolution too? Trying to add this for our laptops and it doesn't seem to do anything, wondering if the laptop display is somehow not the primary display.

Just incase i've got the wrong end of the stick, I've pointed the startup script to a .ps1 script with parameters "set-screenresolution -width x -height y"; I presume this is the intended method?

 

Would like to avoid qres etc but even running this manually doesn't seem to effect the resolution with zero feedback from the console....

 

*edit My coding is too rusty to explain it but removing the function around the code seems todo the trick, then just call the script with x and y numbers for the resolution you want.

 

Thank you for the information. You noted that you "removed the function around the code." Can you elaborate on what you removed? I've copied the script into a .ps1 file and placed in into a GPO for machines at startup, but nothing is happening. I've also tried to launch from an elevated cmd, but just wants to open the file. If I click cancel, I receive a message about access denied. Here is what I have:

 

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)

}

 

I then call from the sysvol | policy | machine | startup | SetRes.ps1 with parameter of: Set-ScreenResolution -Width 1024 -Height 600

 

After creating, I forced gpupdate and verified the script applied via gpresult /r. Upon restart, nothing!! Your help is greatly apprecited.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...