Summary
You publish Desktops and Applications with a Citrix XenApp/XenDesktop/Workspace or Microsoft Remote Desktop Services (RDS) environment on Microsoft Windows Server 2012 R2, 2016 or 2019 and restrict your users with GPO to change any display settings. But your users want to change the Session Scale, Font Size or Font Smoothing? Here is a method with PowerShell, that gives your users the flexibility back to change the desired settings.
Description
The PowerShell script can be started from any desired location on your RDS server and produce a user friendly GUI, that allows the users to change three advanced display settings. The PowerShell script differs slightly between the Windows Server 2012 R2, 2016 and 2019 operating systems
The features of the PowerShell script (Windows Server 2016 and 2019)
- Two advanced display settings can changed
- Session scale and layout (100, 125 and 150%) DPI scale and font size summarized
- Turn font smoothing On or Off
- Display the actual Citrix session resolution
- Display the actual configured advanced display settings
- Graphical user interface (GUI)
The features of the PowerShell script (Windows Server 2012 R2)
- Three advanced display settings can changed
- DPI scaling (100, 125 and 150%)
- Font size (100, 125 and 150%)
- Turn font smoothing On or Off
- Display the actual Citrix session resolution
- Display the actual configured advanced display settings
- Graphical user interface (GUI)
The GUI
The GUI are simple and easy to use.
The PowerShell script for Windows Server 2016 and 2019
Lines: 411
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 | ######################################################################## # Title: Session Scaling RDS Server 2016 and 2019 # Description: Set session size and font smoothing # Filename: SessionScaling.ps1 # Date Created: 20.02.2021 # Date Modified: 24.02.2021 # Version: 1.2/roe # Developer: Beat Röthlisberger ######################################################################## #---------------------------------------------- # Collect and define data for form #---------------------------------------------- function OnApplicationLoad { return $true } function OnApplicationExit { $script:ExitCode = 0 } #---------------------------------------------- # Start function Generat form #---------------------------------------------- function GenerateForm { #Import form assemblies [reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null [reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null #Define variables $UserName = $env:USERNAME #Define form images from Base64 $base64ImageString = "iVBORw0KGgoAAAANSUhEUgAAADkAAABgCAYAAACnmdq6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOdAAADnQBaySz1gAAABZ0RVh0Q3JlYXRpb24gVGltZQAwOS8yNS8xONGbuJIAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzQGstOgAAAflElEQVR4nMWceZBdV53fP+eee+97/XqTWnu3WrIsWfKGt4cl27EHs5oxTM1kkqpQFSAVB4owpohrij9MQgihMmBmqApQxT8JMDWQUEmFCgECBBhDbCfIWp4tW7LkRba21t57v+3ee5b8cc69773u1mbM5FCm9e67y/me3+/8lu/vd5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8ITl6L+4BrlyS4l9auAw74sBRr3dsH01NTtBJX2AmkZOPoCJVKyML8LOem5tAG0lSTZilZpmg0WiRJm4sXz1NvtBga7KdSjshS90NE5XKZr3zlK0xOzfJnf/bJ7udf03gzII97kIDbk+VYcvBogxdeqXHm9d8SJCeZma1z1113+tK4K8ju2fMs/+jD/4xNO7bTajVJ0oyVw4Mo7V48SzPNrTeM0W63+cmTp7wqD1FvtLv53ON/FyBPUPwEnIt4tFaE8QClygBJ9izjq1Zw7vxFdu682//KhFuMZ57+DXfevJl7763SbLomwCRJyXzfgPsdrICAyP3sVNLmkX/6GL/41a9ptVq5ul6T0XmzIA/gsxHrJ+b64DRWu5Dt9OmzKKXZvfvZztvjvk3tP//wWX717AVUlhY/r5EDdByr8FVm9xr+v3jsMdLM8LnP/avu5//eQR4nV9c8QQ5CLJIsSxi74UHqC7ezcnvEsfkF7/fceTfccwtzpo+pkwJLCaN9N7O1qLyz2YK1AX19ZQIBYRj2/JgffxfqWq1Wj9dqtevA/2aVgdk0Js1J5bCPeNVqsLBiBXkJpRh2mYb9pcO9fHbsOUujXqedujAwCAKq1erxa53zVbF1lxqzM1P2+KnzvHZiBulzxW5utvgvj4y6/93Fvbrzc77Hk8pCUJ86hkobaGO56cYb2XXPPYyMrLq2t2J+V5DT0zM2EIbB/s5bsD3vaXXY4Z7CTmd0v9pEQS7n34XxACIIEQLmZucIpGRkZOSaQf4/m01ovHcJVYkAAAAASUVORK5CYII=" $imageBytes = [Convert]::FromBase64String($base64ImageString) $SessionSizeIMG = New-Object IO.MemoryStream($imageBytes, 0, $imageBytes.Length) $SessionSizeIMG.Write($imageBytes, 0, $imageBytes.Length); $base64ImageString = "iVBORw0KGgoAAAANSUhEUgAAAB8AAAA5CAYAAADOW/ASAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOdAAADnQBaySz1gAAABZ0RVh0Q3JlYXRpb24gVGltZQAwOS8yNS8xONGbuJIAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzQGstOgAAAByElEQVRYhe2W23GDMBBFD578xx1EJdBBKIESXEJKoIO0QAlJB6QD3AHuwB04HxaTRZaQVgM4H9wZTfTae7MvmYL1cQsdFFqDCFy+WZ7DgsJqnpeFhGDqtU/4Icop4qHUaODl8IV9MywZdgjn2d0v4Mmeu+JLVXoSVH2ZyREs2H8V9k0Rq/YlejwI6fkSxabimAv7ai9bivjq2MWfKr55pUtxF6tX+pz4Jniq+I4dO3bsWAWrfp0CR6AGKsDYvQHogNb36dxkiHR2SNRAC7w6++/2b+sjumWMD4ejUt5PMgqNyuEZxFnLX8iPwGlcu2EvxfxCIDQe9GJeA292/mPFRlwlpytuxLwnL/+VmLeBO15x6XmPDpUdtbNnxHqY+4euhPMYwxfx2mikgfyGM0zbYlCKl/ErU04ZduNcPEWIeu7eyvsl8GnXZx5bKpjKBl17NREO3/kEbtg18HlhIucTyLDLnH0nGPvOJccQE5eYe7FyOJJROobHDGHJkfRGjDk3Yu/Cvd+1kBwq8excCag5RvFK7HWZ4moOX9iHTPFsDllsKc/kHIeqXioyWyTA0aUaHZh6es4Uz/opLrjnytj1VWMsIDkGEnP+C+cbmFyg8s/zAAAAAElFTkSuQmCC" $imageBytes = [Convert]::FromBase64String($base64ImageString) $FontSmoothingIMG = New-Object IO.MemoryStream($imageBytes, 0, $imageBytes.Length) $FontSmoothingIMG.Write($imageBytes, 0, $imageBytes.Length); #Define form icon from Base64 $base64IconString = "AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAAAABHz6uMTdKt35Liyt9T07DfSNGr31rVst+a483fq+jU33vcwd9a1bPfatm534Pew9963MDfft3C33LavN9i17XDSNGqxVrVs/+N4cj/StGs/0nRrP9g17X/ft7C/4rgx/+P4sn/kOLJ/2nZuf9s2rr/nuXP/5rkzv993cH/adm530jRqtpn2Lj/pObS/1rVsv9a1bP/cdu8/3ncwP933L//d9y//4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AAAAAAAAAAAAAAAAAAAAAAAAAA/v78ES86sJUnRq2VH0ayjR9Cqx0fRq9VI0avWR9GqzkjQqbRH0al1AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAACAAAAAwAAAAOAAAADwAAAA/AAAAA==" $iconimageBytes = [Convert]::FromBase64String($base64IconString) $FormIcon = New-Object IO.MemoryStream($iconimageBytes, 0, $iconimageBytes.Length) $FormIcon.Write($iconimageBytes, 0, $iconimageBytes.Length); #Define Citrix session ID $keySessionnr = "HKCU:\SOFTWARE\Citrix\SessionSfr" $CitrixSessionID = (Get-ChildItem -Path $keySessionnr -Name -ErrorAction SilentlyContinue) #Define Citrix session display resolution $keyResolution = "HKLM:\SOFTWARE\Citrix\Ica\Session\$CitrixSessionID\Connection" $CitrixDispHRes = (Get-ItemProperty -Path $keyResolution -Name "HRes" -ErrorAction SilentlyContinue | Select -exp HRes) $CitrixDispVRes = (Get-ItemProperty -Path $keyResolution -Name "VRes" -ErrorAction SilentlyContinue | Select -exp VRes) #Read Font Scaling Size from registry $keyHKCUDesktop = "HKCU:\Control Panel\Desktop" $LogPixels = (Get-ItemProperty -Path $keyHKCUDesktop -Name "LogPixels" -ErrorAction SilentlyContinue | Select -exp LogPixels) $LogPixels = $LogPixels * 1.041666666666667 $LogPixels = [int]::Parse("0" + $LogPixels) #Read DPI Scaling from registry $keyHKCUDesktop = "HKCU:\Control Panel\Desktop" $DPIScaling = (Get-ItemProperty -Path $keyHKCUDesktop -Name "AppliedDPI" -ErrorAction SilentlyContinue | Select -exp AppliedDPI) $DPIScaling = $DPIScaling * 1.041666666666667 $DPIScaling = [int]::Parse("0" + $DPIScaling) #Read Font Smoothing configuration from registry $keyHKCUDesktop = "HKCU:\Control Panel\Desktop" $FontSmoothing = (Get-ItemProperty -Path $keyHKCUDesktop -Name "FontSmoothing" -ErrorAction SilentlyContinue | Select -exp FontSmoothing) IF ($FontSmoothing -eq "2") { $FontSmoothing = "ON"} Else { $FontSmoothing = "OFF" } #Read Session ID from system $SessionId = ((quser | Where-Object { $_ -match $UserName }) -split ' +')[2] #Generated form objects $form1 = New-Object System.Windows.Forms.Form $icon = [System.Drawing.Image]::FromStream($FormIcon, $true) $font = New-Object System.Drawing.Font("Microsoft Sans Serif",10,[System.Drawing.FontStyle]::Regular) $fonthead = New-Object System.Drawing.Font("Microsoft Sans Serif",10,[System.Drawing.FontStyle]::Bold) $fontvalue = New-Object System.Drawing.Font("Microsoft Sans Serif",10,[System.Drawing.FontStyle]::Bold) $labelhead1 = New-Object System.Windows.Forms.Label $labelhead2 = New-Object System.Windows.Forms.Label $labelctxres = New-Object System.Windows.Forms.Label #$labeldpiscaling = New-Object System.Windows.Forms.Label $labelfonsize = New-Object System.Windows.Forms.Label $labelfonsmooth = New-Object System.Windows.Forms.Label #$valuedpiscaling = New-Object System.Windows.Forms.Label $valuefonsize = New-Object System.Windows.Forms.Label $valuefonsmooth = New-Object System.Windows.Forms.Label #$imgdpiscaling = [System.Drawing.Image]::FromStream($DPIScalingIMG, $true) $imgfontsize = [System.Drawing.Image]::FromStream($SessionSizeIMG, $true) $imgfontsmoothing = [System.Drawing.Image]::FromStream($FontSmoothingIMG, $true) #$radiogroupboxdpi = New-Object System.Windows.Forms.GroupBox $radiogroupboxfont = New-Object System.Windows.Forms.GroupBox $radiobuttonfont = New-Object System.Windows.Forms.RadioButton $radiogroupboxfonts = New-Object System.Windows.Forms.GroupBox $radiobuttonfonts = New-Object System.Windows.Forms.RadioButton $buttonApply = New-Object System.Windows.Forms.Button $buttonLogOff = New-Object System.Windows.Forms.Button $InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState $FontFoot = New-Object System.Drawing.Font("Microsoft Sans Serif",7,[System.Drawing.FontStyle]::Regular) $labelFoot = New-Object System.Windows.Forms.Label #---------------------------------------------- # Call functions from apply button #---------------------------------------------- $ScriptApplySessionScale = { Add-Type @" using System; using System.Runtime.InteropServices; using Microsoft.Win32; public class Setter { [System.Runtime.InteropServices.DllImport("SHCore.dll")] internal static extern bool SetProcessDPIAware(); } "@ } #---------------------------------------------- # Call functions from radio buttons #---------------------------------------------- function font150 { Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name LogPixels -Value 144 #$form1.Dispose() #GenerateForm } function font125 { Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name LogPixels -Value 120 #$form1.Dispose() #GenerateForm } function font100 { Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name LogPixels -Value 96 #$form1.Dispose() #GenerateForm } function fontsOFF { Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name FontSmoothing -Value 0 #$form1.Dispose() #GenerateForm } function fontsON { Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name FontSmoothing -Value 2 #$form1.Dispose() #GenerateForm } function buttonApply { Add-Type -AssemblyName PresentationCore,PresentationFramework $oReturn=[System.Windows.Forms.MessageBox]::Show("You must sign out of your Citrix session to apply these changes. `nSave any open files and close all programs before you sign out. `n`nTo sign out click on OK","Sign out to apply settings",[System.Windows.Forms.MessageBoxButtons]::OKCancel) switch ($oReturn){ "OK" { #write-host "You pressed OK" logoff $SessionId } "Cancel" { #write-host "You pressed Cancel" $form1.Dispose() GenerateForm } } } function buttonCancel { $form1.Close() } #---------------------------------------------- # Call form functions from button handler #---------------------------------------------- #Call funtion font150 $handler_radiobuttonfont150_click= ${function:font150} #Call funtion font125 $handler_radiobuttonfont125_click= ${function:font125} #Call funtion font100 $handler_radiobuttonfont100_click= ${function:font100} #Call funtion fontsOFF $handler_radiobuttonfontsOFF_click= ${function:fontsOFF} #Call funtion fontsON $handler_radiobuttonfontsON_click= ${function:fontsON} #Call funtion button Apply $handler_buttonApply_Click= ${function:buttonApply} #Call funtion button Cancel $handler_buttonCancel_Click= ${function:buttonCancel} #---------------------------------------------- # Form code to ganerate gui #---------------------------------------------- $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 373 $System_Drawing_Size.Width = 540 $form1.Icon = [System.Drawing.Icon]::FromHandle((new-object System.Drawing.Bitmap -argument $FormIcon).GetHIcon()) $form1.Font = $font $form1.ClientSize = $System_Drawing_Size $form1.DataBindings.DefaultDataSourceUpdateMode = 0 $form1.Name = "form1" $form1.Text = "Session Scaling" $form1.FormBorderStyle = "Fixed3D" #Form lable $labelHead1.Text = "Session scale and layout" $labelHead1.Font = $fonthead $labelHead1.Location = "15,15" $labelHead1.Height = 20 $labelHead1.Width = 250 #Form lable $labelfonsize.Text = "Change the size of text and apps:" $labelfonsize.Location = "15,55" $labelfonsize.Height = 40 $labelfonsize.Width = 180 $valuefonsize.Text = " $LogPixels%" $valuefonsize.Font = $fontvalue $valuefonsize.ForeColor = 'Green' $valuefonsize.Location = "208,75" $valuefonsize.Height = 20 $valuefonsize.Width = 60 #Radio button box font size $radiogroupboxfont.Location = '15,95' $radiogroupboxfont.size = '250,120' $radiogroupboxfont.text = "Choose size:" $radiobuttonfont = New-Object System.Windows.Forms.RadioButton $radiogroupboxfont.Controls.Add($radiobuttonfont) $radiobuttonfont.Location = '55,20' $radiobuttonfont.size = '80,20' IF ($LogPixels -eq "150") { $radiobuttonfont.Checked = $true} Else { $radiobuttonfont.Checked = $false } $radiobuttonfont.Text = "150%" $radiobuttonfont.add_Click($handler_radiobuttonfont150_click) $radiobuttonfont = New-Object System.Windows.Forms.RadioButton $radiogroupboxfont.Controls.Add($radiobuttonfont) $radiobuttonfont.Location = '55,55' $radiobuttonfont.size = '80,20' IF ($LogPixels -eq "125") { $radiobuttonfont.Checked = $true} Else { $radiobuttonfont.Checked = $false } $radiobuttonfont.Text = "125%" $radiobuttonfont.add_Click($handler_radiobuttonfont125_click) $radiobuttonfont = New-Object System.Windows.Forms.RadioButton $radiogroupboxfont.Controls.Add($radiobuttonfont) $radiobuttonfont.Location = '55,90' $radiobuttonfont.size = '80,20' IF ($LogPixels -eq "100") { $radiobuttonfont.Checked = $true} Else { $radiobuttonfont.Checked = $false } $radiobuttonfont.Text = "100%" $radiobuttonfont.add_Click($handler_radiobuttonfont100_click) #Image font size $imgfontsizebox = new-object Windows.Forms.PictureBox $radiogroupboxfont.Controls.Add($imgfontsizebox) $imgfontsizebox.Location = "140,18" $imgfontsizebox.Height = $imgfontsize.Size.Height $imgfontsizebox.Width = $imgfontsize.Size.Width $imgfontsizebox.Image = $imgfontsize #Form lable $labelHead2.Text = "Font smoothing" $labelHead2.Font = $FontHead $labelHead2.Location = "275,15" $labelHead2.Height = 20 $labelHead2.Width = 486 $labelfonsmooth.Text = "Font smoothing is turned:" $labelfonsmooth.Location = "275,75" $labelfonsmooth.Height = 20 $labelfonsmooth.Width = 180 $valuefonsmooth.Text = "$FontSmoothing" $valuefonsmooth.Font = $fontvalue $valuefonsmooth.ForeColor = 'Green' $valuefonsmooth.Location = "433,75" $valuefonsmooth.Height = 20 $valuefonsmooth.Width = 60 #Radio button font smoothing $radiogroupboxfonts.Location = '275,95' $radiogroupboxfonts.size = '250,120' $radiogroupboxfonts.text = "Turn font smoothing ON or OFF:" $radiobuttonfonts = New-Object System.Windows.Forms.RadioButton $radiogroupboxfonts.Controls.Add($radiobuttonfonts) $radiobuttonfonts.Location = '25,50' $radiobuttonfonts.size = '80,20' IF ($FontSmoothing -eq "OFF") { $radiobuttonfonts.Checked = $true} Else { $radiobuttonfonts.Checked = $false } $radiobuttonfonts.Text = "OFF" $radiobuttonfonts.add_Click($handler_radiobuttonfontsOFF_click) $radiobuttonfonts = New-Object System.Windows.Forms.RadioButton $radiogroupboxfonts.Controls.Add($radiobuttonfonts) $radiobuttonfonts.Location = '25,75' $radiobuttonfonts.size = '80,20' IF ($FontSmoothing -eq "ON") { $radiobuttonfonts.Checked = $true} Else { $radiobuttonfonts.Checked = $false } $radiobuttonfonts.Text = "ON" $radiobuttonfonts.add_Click($handler_radiobuttonfontsON_click) #Image font smoothing $imgfontsmoothingbox = new-object Windows.Forms.PictureBox $radiogroupboxfonts.Controls.Add($imgfontsmoothingbox) $imgfontsmoothingbox.Location = "120,45" $imgfontsmoothingbox.Height = $imgfontsmoothing.Size.Height $imgfontsmoothingbox.Width = $imgfontsmoothing.Size.Width $imgfontsmoothingbox.Image = $imgfontsmoothing #Session display resolution $labelctxres.Text = "Citrix Session Resolution: $CitrixDispHRes/$CitrixDispVRes" $labelctxres.Font = $FontFoot $labelctxres.Location = "15,335" $labelctxres.Height = 20 $labelctxres.Width = 250 #Apply button $System_Drawing_Point1 = New-Object System.Drawing.Point $System_Drawing_Point1.X = 15 $System_Drawing_Point1.Y = 285 $buttonApply.Location = $System_Drawing_Point1 $buttonApply.Name = "Apply" $System_Drawing_Size1 = New-Object System.Drawing.Size $System_Drawing_Size1.Height = 35 $System_Drawing_Size1.Width = 110 $buttonApply.Size = $System_Drawing_Size1 $buttonApply.TabIndex = 0 $buttonApply.Text = "Apply" $buttonApply.UseVisualStyleBackColor = $True $buttonApply.add_Click($handler_buttonApply_Click) #Cancel button $System_Drawing_Point1 = New-Object System.Drawing.Point $System_Drawing_Point1.X = 130 $System_Drawing_Point1.Y = 285 $buttonLogOff.Location = $System_Drawing_Point1 $buttonLogOff.Name = "Cancel" $System_Drawing_Size1 = New-Object System.Drawing.Size $System_Drawing_Size1.Height = 35 $System_Drawing_Size1.Width = 110 $buttonLogOff.Size = $System_Drawing_Size1 $buttonLogOff.TabIndex = 0 $buttonLogOff.Text = "Cancel" $buttonLogOff.UseVisualStyleBackColor = $True $buttonLogOff.add_Click($handler_buttonCancel_Click) #Form footer $labelFoot.Font = $FontFoot $labelFoot.Text = "fresh-it.info (c) | support@fresh-it.info | Ver. 1.2/roe" $labelFoot.Location = "15, 355" $labelFoot.Height = 40 $labelFoot.Width = 300 $form1.Controls.Add($labelHead1) $form1.Controls.Add($labelHead2) $form1.Controls.Add($labelctxres) #$form1.Controls.Add($labeldpiscaling) #$form1.Controls.Add($valuedpiscaling) $form1.Controls.Add($labelfonsize) $form1.Controls.Add($valuefonsize) $form1.Controls.Add($valuefonsmooth) $form1.Controls.Add($labelfonsmooth) #$form1.Controls.Add($radiogroupboxdpi) $form1.Controls.Add($radiogroupboxfont) $form1.Controls.Add($radiogroupboxfonts) $form1.Controls.Add($buttonLogOff) $form1.Controls.Add($buttonApply) $form1.Controls.Add($labelFoot) #Save state of the form $InitialFormWindowState = $form1.WindowState #Correct OnLoad event to correct form state $form1.add_Load($form1_StateCorrection_Load) #Display defined form return $form1.ShowDialog() } #Call function GenerateForm if(OnApplicationLoad -eq $true) { GenerateForm | Out-Null OnApplicationExit } |
The PowerShell script for Windows Server 2012 R2
Lines: 497
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | ######################################################################## # Title: Session Scaling RDS Server 2012 R2 # Description: Set Font Size, Smoothing and Session DPI Scaling # Filename: SessionScaling.ps1 # Date Created: 11.08.2019 # Date Modified: 21.09.2019 # Version: 1.1/roe # Developer: Beat Röthlisberger ######################################################################## #---------------------------------------------- # Collect and define data for form #---------------------------------------------- function OnApplicationLoad { return $true } function OnApplicationExit { $script:ExitCode = 0 } #---------------------------------------------- # Start function generate form #---------------------------------------------- function GenerateForm { #Import form assemblies [reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null [reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null #Define variables $UserName = $env:USERNAME #Define form images from Base64 $base64ImageString = "iVBORw0KGgoAAAANSUhEUgAAADkAAABgCAYAAACnmdq6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOdAAADnQBaySz1gAAABZ0RVh0Q3JlYXRpb24gVGltZQAwOS8yNS8xONGbuJIAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzQGstOgAAAflElEQVR4nMWceZBdV53fP+eee+97/XqTWnu3WrIsWfKGt4cl27EHs5oxTM1kkqpQFSAVB4owpohrij9MQgihMmBmqApQxT8JMDWQUEmFCgECBBhDbCfIWp4tW7LkRba21t57v+3ee5b8cc69773u1mbM5FCm9e67y/me3+/8lu/vd5/Yv3//RuBctVpVAGma2jRNieOYt25YQPh/WhCi91trEYuO5dcZY3uvL+7XO7JMUS73EUVhcWKtVguB9SHwQ+DDwCsACwsLzM3Ns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NE5XKZr3zlK0xOzfJnf/bJ7udf03gzII97kIDbk+VYcvBogxdeqXHm9d8SJCeZma1z1113+tK4K8ju2fMs/+jD/4xNO7bTajVJ0oyVw4Mo7V48SzPNrTeM0W63+cmTp7wqD1FvtLv53ON/FyBPUPwEnIt4tFaE8QClygBJ9izjq1Zw7vxFdu682//KhFuMZ57+DXfevJl7763SbLomwCRJyXzfgPsdrICAyP3sVNLmkX/6GL/41a9ptVq5ul6T0XmzIA/gsxHrJ+b64DRWu5Dt9OmzKKXZvfvZztvjvk3tP//wWX717AVUlhY/r5EDdByr8FVm9xr+v3jsMdLM8LnP/avu5//eQR4nV9c8QQ5CLJIsSxi74UHqC7ezcnvEsfkF7/fceTfccwtzpo+pkwJLCaN9N7O1qLyz2YK1AX19ZQIBYRj2/JgffxfqWq1Wj9dqtevA/2aVgdk0Js1J5bCPeNVqsLBiBXkJpRh2mYb9pcO9fHbsOUujXqedujAwCAKq1erxa53zVbF1lxqzM1P2+KnzvHZiBulzxW5utvgvj4y6/93Fvbrzc77Hk8pCUJ86hkobaGO56cYb2XXPPYyMrLq2t2J+V5DT0zM2EIbB/s5bsD3vaXXY4Z7CTmd0v9pEQS7n34XxACIIEQLmZucIpGRkZOSaQf4/m01ovHcJVYkAAAAASUVORK5CYII=" $imageBytes = [Convert]::FromBase64String($base64ImageString) $DPIScalingIMG = New-Object IO.MemoryStream($imageBytes, 0, $imageBytes.Length) $DPIScalingIMG.Write($imageBytes, 0, $imageBytes.Length); $base64ImageString = "iVBORw0KGgoAAAANSUhEUgAAADIAAABhCAYAAACUJfLoAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOdAAADnQBaySz1gAAABZ0RVh0Q3JlYXRpb24gVGltZQAwOS8yNS8xONGbuJIAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzQGstOgAAAIq0lEQVR4nNWc3W4ctxXHfyPICNJ8WDUcS7L1MY5hJ75oapRXvfLmCaqLXhao2heo+wS1n6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sglsk/4UNoscU63nUQukU/J/8Zkmjiv204il8geRxNmWME5qhFCCZHcj2WmiWWmTKTkY5lpYomE12uQS+RrYE5K+b0FSXVbcyTW6gZZRIQQL1AuxcVE0WniItDotpPI7REY94JnjSyv16CEyA7dQ2mzxmkKVp8lRO4zfSI9Rp8n9enGV1bIcBYNctx4gwHjYQAXqU+VbjFaHW4Cf4iUXSEeV+yghMinwDuR5z3rPrRrbjaxFxgdA7ym7xf0ZfAOmW91KCPyFVBJKd8UQjzzPDfL113SQdINVGxll9FwGq429Sm5isDhAB+y54gQ4r/Ac+BsoEit/zYJUVcYKW++X+/TPah5Fniu28xCyWQHpWTqY5l+QoYdxT2OOhBwme76f43C/bKSoQXwCfAe8CfPM0NkE/95ehON6qGUPo6KoW95ZP2IgvkB5UQGwE89+TWjeOI647HHp4Gyoa2gNeAvJYqVDq0B/qFVW/eV59oIlI0RyXIWDUqJ7OLfne/pvzkbdjllVyk8vj7JZPcRqa3nKeSUXc2UNUQREW0OB1JKN2Jl0jn7wNGyWvagxPRCeY+AiifWTp6JBfYz6qfK1vhjllFMQqShS6Qk8pRTts6QM4ZS8wtqEtrmtQHet+5jyCm7zgTfqUxC5DZdL9g9DRdDTtlLqLh9EaYxtKaNmknCeW3bFl/b29sl/yKhCNvb2+0kOv0PoROqsnnksEIAAAAASUVORK5CYII=" $imageBytes = [Convert]::FromBase64String($base64ImageString) $FontSizeIMG = New-Object IO.MemoryStream($imageBytes, 0, $imageBytes.Length) $FontSizeIMG.Write($imageBytes, 0, $imageBytes.Length); $base64ImageString = "iVBORw0KGgoAAAANSUhEUgAAAB8AAAA5CAYAAADOW/ASAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOdAAADnQBaySz1gAAABZ0RVh0Q3JlYXRpb24gVGltZQAwOS8yNS8xONGbuJIAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzQGstOgAAAByElEQVRYhe2W23GDMBBFD578xx1EJdBBKIESXEJKoIO0QAlJB6QD3AHuwB04HxaTRZaQVgM4H9wZTfTae7MvmYL1cQsdFFqDCFy+WZ7DgsJqnpeFhGDqtU/4Icop4qHUaODl8IV9MywZdgjn2d0v4Mmeu+JLVXoSVH2ZyREs2H8V9k0Rq/YlejwI6fkSxabimAv7ai9bivjq2MWfKr55pUtxF6tX+pz4Jniq+I4dO3bsWAWrfp0CR6AGKsDYvQHogNb36dxkiHR2SNRAC7w6++/2b+sjumWMD4ejUt5PMgqNyuEZxFnLX8iPwGlcu2EvxfxCIDQe9GJeA292/mPFRlwlpytuxLwnL/+VmLeBO15x6XmPDpUdtbNnxHqY+4euhPMYwxfx2mikgfyGM0zbYlCKl/ErU04ZduNcPEWIeu7eyvsl8GnXZx5bKpjKBl17NREO3/kEbtg18HlhIucTyLDLnH0nGPvOJccQE5eYe7FyOJJROobHDGHJkfRGjDk3Yu/Cvd+1kBwq8excCag5RvFK7HWZ4moOX9iHTPFsDllsKc/kHIeqXioyWyTA0aUaHZh6es4Uz/opLrjnytj1VWMsIDkGEnP+C+cbmFyg8s/zAAAAAElFTkSuQmCC" $imageBytes = [Convert]::FromBase64String($base64ImageString) $FontSmoothingIMG = New-Object IO.MemoryStream($imageBytes, 0, $imageBytes.Length) $FontSmoothingIMG.Write($imageBytes, 0, $imageBytes.Length); #Define form icon from Base64 $base64IconString = "AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAAAABHz6uMTdKt35Liyt9T07DfSNGr31rVst+a483fq+jU33vcwd9a1bPfatm534Pew9963MDfft3C33LavN9i17XDSNGqxVrVs/+N4cj/StGs/0nRrP9g17X/ft7C/4rgx/+P4sn/kOLJ/2nZuf9s2rr/nuXP/5rkzv993cH/adm530jRqtpn2Lj/pObS/1rVsv9a1bP/cdu8/3ncwP933L//d9y//4Dew/+j5tH/renW/83w4//K7+L/jOHI/3ncwN9I0avfbtq7/8rv4v+j5tH/lePL/5zlzv+h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qzkjQqbRH0al1AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAACAAAAAwAAAAOAAAADwAAAA/AAAAA==" $iconimageBytes = [Convert]::FromBase64String($base64IconString) $FormIcon = New-Object IO.MemoryStream($iconimageBytes, 0, $iconimageBytes.Length) $FormIcon.Write($iconimageBytes, 0, $iconimageBytes.Length); #Define Citrix session ID $keySessionnr = "HKCU:\SOFTWARE\Citrix\SessionSfr" $CitrixSessionID = (Get-ChildItem -Path $keySessionnr -Name -ErrorAction SilentlyContinue) #Define Citrix session display resolution $keyResolution = "HKLM:\SOFTWARE\Citrix\Ica\Session\$CitrixSessionID\Connection" $CitrixDispHRes = (Get-ItemProperty -Path $keyResolution -Name "HRes" -ErrorAction SilentlyContinue | Select -exp HRes) $CitrixDispVRes = (Get-ItemProperty -Path $keyResolution -Name "VRes" -ErrorAction SilentlyContinue | Select -exp VRes) #Read Font Scaling Size from registry $keyHKCUDesktop = "HKCU:\Control Panel\Desktop" $LogPixels = (Get-ItemProperty -Path $keyHKCUDesktop -Name "LogPixels" -ErrorAction SilentlyContinue | Select -exp LogPixels) $LogPixels = $LogPixels * 1.041666666666667 $LogPixels = [int]::Parse($LogPixels) #Read DPI Scaling from registry $keyHKCUDesktop = "HKCU:\Control Panel\Desktop" $DPIScaling = (Get-ItemProperty -Path $keyHKCUDesktop -Name "AppliedDPI" -ErrorAction SilentlyContinue | Select -exp AppliedDPI) $DPIScaling = $DPIScaling * 1.041666666666667 $DPIScaling = [int]::Parse($DPIScaling) #Read Font Smoothing configuration from registry $keyHKCUDesktop = "HKCU:\Control Panel\Desktop" $FontSmoothing = (Get-ItemProperty -Path $keyHKCUDesktop -Name "FontSmoothing" -ErrorAction SilentlyContinue | Select -exp FontSmoothing) IF ($FontSmoothing -eq "2") { $FontSmoothing = "ON"} Else { $FontSmoothing = "OFF" } #Read Session ID from system $SessionId = ((quser | Where-Object { $_ -match $UserName }) -split ' +')[2] #Generated form objects $form1 = New-Object System.Windows.Forms.Form $icon = [System.Drawing.Image]::FromStream($FormIcon, $true) $font = New-Object System.Drawing.Font("Microsoft Sans Serif",10,[System.Drawing.FontStyle]::Regular) $fonthead = New-Object System.Drawing.Font("Microsoft Sans Serif",10,[System.Drawing.FontStyle]::Bold) $fontvalue = New-Object System.Drawing.Font("Microsoft Sans Serif",10,[System.Drawing.FontStyle]::Bold) $labelhead1 = New-Object System.Windows.Forms.Label $labelhead2 = New-Object System.Windows.Forms.Label $labelctxres = New-Object System.Windows.Forms.Label $labeldpiscaling = New-Object System.Windows.Forms.Label $labelfonsize = New-Object System.Windows.Forms.Label $labelfonsmooth = New-Object System.Windows.Forms.Label $valuedpiscaling = New-Object System.Windows.Forms.Label $valuefonsize = New-Object System.Windows.Forms.Label $valuefonsmooth = New-Object System.Windows.Forms.Label $imgdpiscaling = [System.Drawing.Image]::FromStream($DPIScalingIMG, $true) $imgfontsize = [System.Drawing.Image]::FromStream($FontSizeIMG, $true) $imgfontsmoothing = [System.Drawing.Image]::FromStream($FontSmoothingIMG, $true) $radiogroupboxdpi = New-Object System.Windows.Forms.GroupBox $radiogroupboxfont = New-Object System.Windows.Forms.GroupBox $radiobuttonfont = New-Object System.Windows.Forms.RadioButton $radiogroupboxfonts = New-Object System.Windows.Forms.GroupBox $radiobuttonfonts = New-Object System.Windows.Forms.RadioButton $buttonApply = New-Object System.Windows.Forms.Button $buttonLogOff = New-Object System.Windows.Forms.Button $InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState $FontFoot = New-Object System.Drawing.Font("Microsoft Sans Serif",7,[System.Drawing.FontStyle]::Regular) $labelFoot = New-Object System.Windows.Forms.Label #---------------------------------------------- # Call functions from apply button #---------------------------------------------- $ScriptApplySessionScale = { Add-Type @" using System; using System.Runtime.InteropServices; using Microsoft.Win32; public class Setter { [System.Runtime.InteropServices.DllImport("SHCore.dll")] internal static extern bool SetProcessDPIAware(); } "@ } #---------------------------------------------- # Call functions from radio buttons #---------------------------------------------- function dpi150 { Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name AppliedDPI -Value 144 #$form1.Dispose() #GenerateForm } function dpi125 { Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name AppliedDPI -Value 120 #$form1.Dispose() #GenerateForm } function dpi100 { Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name AppliedDPI -Value 96 #$form1.Dispose() #GenerateForm } function font150 { Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name LogPixels -Value 144 #$form1.Dispose() #GenerateForm } function font125 { Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name LogPixels -Value 120 #$form1.Dispose() #GenerateForm } function font100 { Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name LogPixels -Value 96 #$form1.Dispose() #GenerateForm } function fontsOFF { Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name FontSmoothing -Value 0 #$form1.Dispose() #GenerateForm } function fontsON { Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name FontSmoothing -Value 2 #$form1.Dispose() #GenerateForm } function buttonApply { Add-Type -AssemblyName PresentationCore,PresentationFramework $oReturn=[System.Windows.Forms.MessageBox]::Show("You must sign out of your Citrix session to apply these changes. `nSave any open files and close all programs before you sign out. `n`nTo sign out click on OK","Sign out to apply settings",[System.Windows.Forms.MessageBoxButtons]::OKCancel) switch ($oReturn){ "OK" { #write-host "You pressed OK" logoff $SessionId } "Cancel" { #write-host "You pressed Cancel" $form1.Dispose() GenerateForm } } } function buttonCancel { $form1.Close() } #---------------------------------------------- # Call form functions from button handler #---------------------------------------------- #Call funtion dpi150 $handler_radiobuttondpi150_click= ${function:dpi150} #Call funtion dpi125 $handler_radiobuttondpi125_click= ${function:dpi125} #Call funtion dpi100 $handler_radiobuttondpi100_click= ${function:dpi100} #Call funtion font150 $handler_radiobuttonfont150_click= ${function:font150} #Call funtion font125 $handler_radiobuttonfont125_click= ${function:font125} #Call funtion font100 $handler_radiobuttonfont100_click= ${function:font100} #Call funtion fontsOFF $handler_radiobuttonfontsOFF_click= ${function:fontsOFF} #Call funtion fontsON $handler_radiobuttonfontsON_click= ${function:fontsON} #Call funtion button Apply $handler_buttonApply_Click= ${function:buttonApply} #Call funtion button Cancel $handler_buttonCancel_Click= ${function:buttonCancel} #---------------------------------------------- # Form code to ganerate gui #---------------------------------------------- $System_Drawing_Size = New-Object System.Drawing.Size $System_Drawing_Size.Height = 373 $System_Drawing_Size.Width = 516 $form1.Icon = [System.Drawing.Icon]::FromHandle((new-object System.Drawing.Bitmap -argument $FormIcon).GetHIcon()) $form1.Font = $font $form1.ClientSize = $System_Drawing_Size $form1.DataBindings.DefaultDataSourceUpdateMode = 0 $form1.Name = "form1" $form1.Text = "Session Scaling" $form1.FormBorderStyle = "Fixed3D" #Form lable $labelHead1.Text = "Session DPI scaling and font size" $labelHead1.Font = $fonthead $labelHead1.Location = "15,15" $labelHead1.Height = 20 $labelHead1.Width = 486 $labeldpiscaling.Text = "Configured DPI scaling:" $labeldpiscaling.Location = "15,35" $labeldpiscaling.Height = 20 $labeldpiscaling.Width = 190 $valuedpiscaling.Text = "$DPIScaling%" $valuedpiscaling.Font = $fontvalue $valuedpiscaling.ForeColor = 'Green' $valuedpiscaling.Location = "208,35" $valuedpiscaling.Height = 20 $valuedpiscaling.Width = 53 #Radio button DPI scaling $radiogroupboxdpi.Location = '15,55' $radiogroupboxdpi.size = '243,120' $radiogroupboxdpi.text = "Choose session DPI scaling:" $radiobuttondpi = New-Object System.Windows.Forms.RadioButton $radiogroupboxdpi.Controls.Add($radiobuttondpi) $radiobuttondpi.Location = '55,20' $radiobuttondpi.size = '80,20' IF ($DPIScaling -eq "150") { $radiobuttondpi.Checked = $true} Else { $radiobuttondpi.Checked = $false } $radiobuttondpi.Text = "150%" $radiobuttondpi.add_Click($handler_radiobuttondpi150_click) $radiobuttondpi = New-Object System.Windows.Forms.RadioButton $radiogroupboxdpi.Controls.Add($radiobuttondpi) $radiobuttondpi.Location = '55,55' $radiobuttondpi.size = '80,20' IF ($DPIScaling -eq "125") { $radiobuttondpi.Checked = $true} Else { $radiobuttondpi.Checked = $false } $radiobuttondpi.Text = "125%" $radiobuttondpi.add_Click($handler_radiobuttondpi125_click) $radiobuttondpi = New-Object System.Windows.Forms.RadioButton $radiogroupboxdpi.Controls.Add($radiobuttondpi) $radiobuttondpi.Location = '55,90' $radiobuttondpi.size = '80,20' IF ($DPIScaling -eq "100") { $radiobuttondpi.Checked = $true} Else { $radiobuttondpi.Checked = $false } $radiobuttondpi.Text = "100%" $radiobuttondpi.add_Click($handler_radiobuttondpi100_click) #Image dpi scaling $imgdpiscalingbox = new-object Windows.Forms.PictureBox $radiogroupboxdpi.Controls.Add($imgdpiscalingbox) $imgdpiscalingbox.Location = "140,74" $imgdpiscalingbox.Height = $imgdpiscaling.Size.Height $imgdpiscalingbox.Width = $imgdpiscaling.Size.Width $imgdpiscalingbox.Image = $imgdpiscaling #Form lable $labelfonsize.Text = "Configured font size:" $labelfonsize.Location = "258,35" $labelfonsize.Height = 20 $labelfonsize.Width = 180 $valuefonsize.Text = " $LogPixels%" $valuefonsize.Font = $fontvalue $valuefonsize.ForeColor = 'Green' $valuefonsize.Location = "433,35" $valuefonsize.Height = 20 $valuefonsize.Width = 60 #Radio button box font size $radiogroupboxfont.Location = '258,55' $radiogroupboxfont.size = '250,120' $radiogroupboxfont.text = "Choose font size:" $radiobuttonfont = New-Object System.Windows.Forms.RadioButton $radiogroupboxfont.Controls.Add($radiobuttonfont) $radiobuttonfont.Location = '55,20' $radiobuttonfont.size = '80,20' IF ($LogPixels -eq "150") { $radiobuttonfont.Checked = $true} Else { $radiobuttonfont.Checked = $false } $radiobuttonfont.Text = "150%" $radiobuttonfont.add_Click($handler_radiobuttonfont150_click) $radiobuttonfont = New-Object System.Windows.Forms.RadioButton $radiogroupboxfont.Controls.Add($radiobuttonfont) $radiobuttonfont.Location = '55,55' $radiobuttonfont.size = '80,20' IF ($LogPixels -eq "125") { $radiobuttonfont.Checked = $true} Else { $radiobuttonfont.Checked = $false } $radiobuttonfont.Text = "125%" $radiobuttonfont.add_Click($handler_radiobuttonfont125_click) $radiobuttonfont = New-Object System.Windows.Forms.RadioButton $radiogroupboxfont.Controls.Add($radiobuttonfont) $radiobuttonfont.Location = '55,90' $radiobuttonfont.size = '80,20' IF ($LogPixels -eq "100") { $radiobuttonfont.Checked = $true} Else { $radiobuttonfont.Checked = $false } $radiobuttonfont.Text = "100%" $radiobuttonfont.add_Click($handler_radiobuttonfont100_click) #Image font size $imgfontsizebox = new-object Windows.Forms.PictureBox $radiogroupboxfont.Controls.Add($imgfontsizebox) $imgfontsizebox.Location = "140,18" $imgfontsizebox.Height = $imgfontsize.Size.Height $imgfontsizebox.Width = $imgfontsize.Size.Width $imgfontsizebox.Image = $imgfontsize #Form lable $labelHead2.Text = "Font smoothing" $labelHead2.Font = $FontHead $labelHead2.Location = "15,180" $labelHead2.Height = 20 $labelHead2.Width = 486 $labelfonsmooth.Text = "Font smoothing is turned:" $labelfonsmooth.Location = "15,200" $labelfonsmooth.Height = 20 $labelfonsmooth.Width = 180 $valuefonsmooth.Text = "$FontSmoothing" $valuefonsmooth.Font = $fontvalue $valuefonsmooth.ForeColor = 'Green' $valuefonsmooth.Location = "200,200" $valuefonsmooth.Height = 20 $valuefonsmooth.Width = 60 #Radio button font smoothing $radiogroupboxfonts.Location = '15,220' $radiogroupboxfonts.size = '250,120' $radiogroupboxfonts.text = "Turn font smoothing ON or OFF:" $radiobuttonfonts = New-Object System.Windows.Forms.RadioButton $radiogroupboxfonts.Controls.Add($radiobuttonfonts) $radiobuttonfonts.Location = '25,50' $radiobuttonfonts.size = '80,20' IF ($FontSmoothing -eq "OFF") { $radiobuttonfonts.Checked = $true} Else { $radiobuttonfonts.Checked = $false } $radiobuttonfonts.Text = "OFF" $radiobuttonfonts.add_Click($handler_radiobuttonfontsOFF_click) $radiobuttonfonts = New-Object System.Windows.Forms.RadioButton $radiogroupboxfonts.Controls.Add($radiobuttonfonts) $radiobuttonfonts.Location = '25,75' $radiobuttonfonts.size = '80,20' IF ($FontSmoothing -eq "ON") { $radiobuttonfonts.Checked = $true} Else { $radiobuttonfonts.Checked = $false } $radiobuttonfonts.Text = "ON" $radiobuttonfonts.add_Click($handler_radiobuttonfontsON_click) #Image font smoothing $imgfontsmoothingbox = new-object Windows.Forms.PictureBox $radiogroupboxfonts.Controls.Add($imgfontsmoothingbox) $imgfontsmoothingbox.Location = "120,45" $imgfontsmoothingbox.Height = $imgfontsmoothing.Size.Height $imgfontsmoothingbox.Width = $imgfontsmoothing.Size.Width $imgfontsmoothingbox.Image = $imgfontsmoothing #Session display resolution $labelctxres.Text = "Citrix Session Resolution: $CitrixDispHRes/$CitrixDispVRes" $labelctxres.Font = $FontFoot $labelctxres.Location = "278,220" $labelctxres.Height = 20 $labelctxres.Width = 250 #Apply button $System_Drawing_Point1 = New-Object System.Drawing.Point $System_Drawing_Point1.X = 275 $System_Drawing_Point1.Y = 285 $buttonApply.Location = $System_Drawing_Point1 $buttonApply.Name = "Apply" $System_Drawing_Size1 = New-Object System.Drawing.Size $System_Drawing_Size1.Height = 35 $System_Drawing_Size1.Width = 110 $buttonApply.Size = $System_Drawing_Size1 $buttonApply.TabIndex = 0 $buttonApply.Text = "Apply" $buttonApply.UseVisualStyleBackColor = $True $buttonApply.add_Click($handler_buttonApply_Click) #Cancel button $System_Drawing_Point1 = New-Object System.Drawing.Point $System_Drawing_Point1.X = 390 $System_Drawing_Point1.Y = 285 $buttonLogOff.Location = $System_Drawing_Point1 $buttonLogOff.Name = "Cancel" $System_Drawing_Size1 = New-Object System.Drawing.Size $System_Drawing_Size1.Height = 35 $System_Drawing_Size1.Width = 110 $buttonLogOff.Size = $System_Drawing_Size1 $buttonLogOff.TabIndex = 0 $buttonLogOff.Text = "Cancel" $buttonLogOff.UseVisualStyleBackColor = $True $buttonLogOff.add_Click($handler_buttonCancel_Click) #Form footer $labelFoot.Font = $FontFoot $labelFoot.Text = "fresh-it.info (c) | support@fresh-it.info | Ver. 1.1/roe" $labelFoot.Location = "15, 355" $labelFoot.Height = 40 $labelFoot.Width = 300 $form1.Controls.Add($labelHead1) $form1.Controls.Add($labelHead2) $form1.Controls.Add($labelctxres) $form1.Controls.Add($labeldpiscaling) $form1.Controls.Add($imgdpiscalingbox) $form1.Controls.Add($valuedpiscaling) $form1.Controls.Add($labelfonsize) $form1.Controls.Add($valuefonsize) $form1.Controls.Add($valuefonsmooth) $form1.Controls.Add($labelfonsmooth) $form1.Controls.Add($radiogroupboxdpi) $form1.Controls.Add($radiogroupboxfont) $form1.Controls.Add($radiogroupboxfonts) $form1.Controls.Add($buttonLogOff) $form1.Controls.Add($buttonApply) $form1.Controls.Add($labelFoot) #Save state of the form $InitialFormWindowState = $form1.WindowState #Correct OnLoad event to correct form state $form1.add_Load($form1_StateCorrection_Load) #Display defined form return $form1.ShowDialog() } #Call function GenerateForm if(OnApplicationLoad -eq $true) { GenerateForm | Out-Null OnApplicationExit } |