# Enable Mirroring Add-Type -TypeDefinition @" using System; using System.Runtime.InteropServices; public class DisplaySettings { [DllImport("user32.dll")] public static extern int EnumDisplaySettings(string deviceName, int modeNum, ref DEVMODE devMode); [DllImport("user32.dll")] public static extern int ChangeDisplaySettings(ref DEVMODE devMode, int flags); [StructLayout(LayoutKind.Sequential)] public struct DEVMODE { private const int CCHDEVICENAME = 32; private const int CCHFORMNAME = 32; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = CCHDEVICENAME)] public string dmDeviceName; public short dmSpecVersion; public short dmDriverVersion; public short dmSize; public short dmDriverExtra; public int dmFields; public int dmPositionX; public int dmPositionY; public int dmDisplayOrientation; public int dmDisplayFixedOutput; public short dmColor; public short dmDuplex; public short dmYResolution; public short dmTTOption; public short dmCollate; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = CCHFORMNAME)] public string dmFormName; public short dmLogPixels; public int 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; } 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_BADDUALVIEW = -6; public static DEVMODE GetDisplaySettings(int iDevNum) { DEVMODE dm = new DEVMODE(); dm.dmSize = (short)Marshal.SizeOf(typeof(DEVMODE)); EnumDisplaySettings(null, ENUM_CURRENT_SETTINGS, ref dm); return dm; } public static void SetDisplayMode(DEVMODE devMode) { ChangeDisplaySettings(ref devMode, CDS_TEST); ChangeDisplaySettings(ref devMode, CDS_UPDATEREGISTRY); } } "@ # Get the current display settings $devMode = [DisplaySettings]::GetDisplaySettings(0) # Modify the settings to enable mirroring $devMode.dmPelsWidth = 1920 $devMode.dmPelsHeight = 1080 # Set the new display mode [DisplaySettings]::SetDisplayMode($devMode)