diff --git a/Community Scripts/HDRswitch-VDD.ps1 b/Community Scripts/HDRswitch-VDD.ps1 new file mode 100644 index 0000000..b72ec99 --- /dev/null +++ b/Community Scripts/HDRswitch-VDD.ps1 @@ -0,0 +1,38 @@ +# Self-elevate the script if required +if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) { + if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) { + $CommandLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments + Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine + Exit + } +} + +$repoName = "PSGallery" +$moduleName1 = "DisplayConfig" +$moduleName2 = "MonitorConfig" +if (!(Get-PSRepository -Name $repoName) -OR !(Find-Module -Name $moduleName1 | Where-Object {$_.Name -eq $moduleName1}) -OR !(Find-Module -Name $moduleName2 | Where-Object {$_.Name -eq $moduleName2})) { + & .\dep_fix.ps1 +} + +# Import the local module +$dpth = Get-Module -ListAvailable $moduleName1 | select path | Select-Object -ExpandProperty path +import-module -name $dpth -InformationAction:Ignore -Verbose:$false -WarningAction:SilentlyContinue + +# Import the other localmodule +$mpth = Get-Module -ListAvailable $moduleName2 | select path | Select-Object -ExpandProperty path +import-module -name $mpth -InformationAction:Ignore -Verbose:$false -WarningAction:SilentlyContinue + +$disp = Get-Monitor | Select-String -Pattern "MTT1337" | Select-Object LineNumber | Select-Object -ExpandProperty LineNumber +$bpcc = Get-DisplayColorInfo -DisplayId $disp | Select-Object BitsPerColorChannel | Select-Object -ExpandProperty BitsPerColorChannel + +if ( $bpcc -is [int] ) { + if ( $bpcc -gt 8 ) { + Disable-DisplayAdvancedColor -DisplayId $disp + break + } + if ( $bpcc -lt 10 ) { + Enable-DisplayAdvancedColor -DisplayId $disp + break + } +} +else { write-error "Something went wrong in identifying the Colormode of the display." ; break } \ No newline at end of file diff --git a/Community Scripts/changeres-VDD.ps1 b/Community Scripts/changeres-VDD.ps1 new file mode 100644 index 0000000..6e13eae --- /dev/null +++ b/Community Scripts/changeres-VDD.ps1 @@ -0,0 +1,39 @@ +# Self-elevate the script if required +if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) { + if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) { + $CommandLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments + Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine + Exit + } +} + +$repoName = "PSGallery" +$moduleName1 = "DisplayConfig" +$moduleName2 = "MonitorConfig" +if (!(Get-PSRepository -Name $repoName) -OR !(Find-Module -Name $moduleName1 | Where-Object {$_.Name -eq $moduleName1}) -OR !(Find-Module -Name $moduleName2 | Where-Object {$_.Name -eq $moduleName2})) { + & .\dep_fix.ps1 +} + + +# Import the local module +$dpth = Get-Module -ListAvailable $moduleName1 | select path | Select-Object -ExpandProperty path +import-module -name $dpth -InformationAction:Ignore -Verbose:$false -WarningAction:SilentlyContinue -Confirm:$false + +# Import the other localmodule +$mpth = Get-Module -ListAvailable $moduleName2 | select path | Select-Object -ExpandProperty path +import-module -name $mpth -InformationAction:Ignore -Verbose:$false -WarningAction:SilentlyContinue -Confirm:$false + +# Check if there are enough arguments +$numArgs = $args.Count +switch ($numArgs) { + 0 { Write-Error "This script requires at least 2 arguments Xres Yres."; break } + 1 { Write-Error "This script requires at least 2 arguments Xres Yres."; break } + 2 { $disp = Get-Monitor | Select-String -Pattern "MTT1337" | Select-Object LineNumber | Select-Object -ExpandProperty LineNumber + $vres = $args[0] + $hres = $args[1] + continue + } + default { Write-Error "Invalid number of arguments: $numArgs"; break } +} +# Setting the resolution on the correct display. +Get-DisplayConfig | Set-DisplayResolution -DisplayId $disp -Width $vres -Height $hres | Use-DisplayConfig \ No newline at end of file diff --git a/Community Scripts/dep_fix.ps1 b/Community Scripts/dep_fix.ps1 new file mode 100644 index 0000000..7ce0792 --- /dev/null +++ b/Community Scripts/dep_fix.ps1 @@ -0,0 +1,32 @@ +# Define the repository name and URL +$repoName = "PSGallery" +$repoUrl = "https://www.powershellgallery.com/api/v2" + +# Check if the repository is registered +if (-not (Get-PSRepository -Name $repoName)) { + # Register the repository + Register-PSRepository -Name $repoName -SourceLocation $repoUrl -Confirm:$false -InformationAction:Ignore -WarningAction:SilentlyContinue +} +#Trust the repo, either its allready installed or newly added +Set-PSRepository -Name $repoName -InstallationPolicy Trusted -InformationAction:Ignore -WarningAction:SilentlyContinue + +# Define the module name and version +$moduleName1 = "DisplayConfig" +$version1 = "1.1.1" + +# Define the module name and version +$moduleName2 = "MonitorConfig" +$version2 = "1.0.3" + +# Check if the module1 is installed +if (-not (Get-InstalledModule -Name $moduleName1 -MinimumVersion $version1)) { + # Save the module + Save-Module -Name $moduleName1 -Repository $repoName -RequiredVersion $version1 -Confirm:$false -InformationAction:Ignore -WarningAction:SilentlyContinue +} + +# Check if the module2 is installed +if (-not (Get-InstalledModule -Name $moduleName2 -MinimumVersion $version2)) { + # Save the module + Save-Module -Name $moduleName2 -Repository $repoName -RequiredVersion $version2 -Confirm:$false -InformationAction:Ignore -WarningAction:SilentlyContinue +} + diff --git a/Community Scripts/primary-VDD.ps1 b/Community Scripts/primary-VDD.ps1 new file mode 100644 index 0000000..684adeb --- /dev/null +++ b/Community Scripts/primary-VDD.ps1 @@ -0,0 +1,26 @@ +# Self-elevate the script if required +if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) { + if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) { + $CommandLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments + Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine + Exit + } +} + +$repoName = "PSGallery" +$moduleName1 = "DisplayConfig" +$moduleName2 = "MonitorConfig" +if (!(Get-PSRepository -Name $repoName) -OR !(Find-Module -Name $moduleName1 | Where-Object {$_.Name -eq $moduleName1}) -OR !(Find-Module -Name $moduleName2 | Where-Object {$_.Name -eq $moduleName2})) { + & .\dep_fix.ps1 +} + + +# Import the local module +$dpth = Get-Module -ListAvailable $moduleName1 | select path | Select-Object -ExpandProperty path; import-module -name $dpth + +# Import the other localmodule +$mpth = Get-Module -ListAvailable $moduleName2 | select path | Select-Object -ExpandProperty path; import-module -name $mpth + + +$disp = Get-Monitor | Select-String -Pattern "MTT1337" | Select-Object LineNumber | Select-Object -ExpandProperty LineNumber +Set-DisplayPrimary -DisplayId $disp \ No newline at end of file diff --git a/Community Scripts/refreshrate-VDD.ps1 b/Community Scripts/refreshrate-VDD.ps1 new file mode 100644 index 0000000..34d21f6 --- /dev/null +++ b/Community Scripts/refreshrate-VDD.ps1 @@ -0,0 +1,39 @@ +# Self-elevate the script if required +if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) { + if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) { + $CommandLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments + Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine + Exit + } +} + +$repoName = "PSGallery" +$moduleName1 = "DisplayConfig" +$moduleName2 = "MonitorConfig" +if (!(Get-PSRepository -Name $repoName) -OR !(Find-Module -Name $moduleName1 | Where-Object {$_.Name -eq $moduleName1}) -OR !(Find-Module -Name $moduleName2 | Where-Object {$_.Name -eq $moduleName2})) { + & .\dep_fix.ps1 +} + + +# Import the local module +$dpth = Get-Module -ListAvailable $moduleName1 | select path | Select-Object -ExpandProperty path +import-module -name $dpth -InformationAction:Ignore -Verbose:$false -WarningAction:SilentlyContinue -Confirm:$false + +# Import the other localmodule +$mpth = Get-Module -ListAvailable $moduleName2 | select path | Select-Object -ExpandProperty path +import-module -name $mpth -InformationAction:Ignore -Verbose:$false -WarningAction:SilentlyContinue -Confirm:$false + + +# Use the module's functions and cmdlets in your script +# Check if there are enough arguments +$numArgs = $args.Count +switch ($numArgs) { + 0 { Write-Error "This script requires a refreshrate above 59 or reset"; break } + 1 { $disp = Get-Monitor | Select-String -Pattern "MTT1337" | Select-Object LineNumber | Select-Object -ExpandProperty LineNumber + $rate = $args[0] + continue + } + default { Write-Error "Invalid number of arguments: $numArgs"; break } +} +# Setting the resolution on the correct display. +Get-DisplayConfig | Set-DisplayRefreshRate -DisplayId $disp -RefreshRate $rate | Use-DisplayConfig \ No newline at end of file diff --git a/Community Scripts/rotate-VDD.ps1 b/Community Scripts/rotate-VDD.ps1 new file mode 100644 index 0000000..889a7d6 --- /dev/null +++ b/Community Scripts/rotate-VDD.ps1 @@ -0,0 +1,46 @@ +# Self-elevate the script if required +if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) { + if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) { + $CommandLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments + Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine + Exit + } +} + +$repoName = "PSGallery" +$moduleName1 = "DisplayConfig" +$moduleName2 = "MonitorConfig" +if (!(Get-PSRepository -Name $repoName) -OR !(Find-Module -Name $moduleName1 | Where-Object {$_.Name -eq $moduleName1}) -OR !(Find-Module -Name $moduleName2 | Where-Object {$_.Name -eq $moduleName2})) { + & .\dep_fix.ps1 +} + + +# Import the local module +$dpth = Get-Module -ListAvailable $moduleName1 | select path | Select-Object -ExpandProperty path +import-module -name $dpth -InformationAction:Ignore -Verbose:$false -WarningAction:SilentlyContinue -Confirm:$false + +# Import the other localmodule +$mpth = Get-Module -ListAvailable $moduleName2 | select path | Select-Object -ExpandProperty path +import-module -name $mpth -InformationAction:Ignore -Verbose:$false -WarningAction:SilentlyContinue -Confirm:$false + +# Check if there are enough arguments +$numArgs = $args.Count +switch ($numArgs) { + 0 { Write-Error "This script requires at least 1, rotation in degrees ex. 90/180/270."; break } + 1 { $disp = Get-Monitor | Select-String -Pattern "MTT1337" | Select-Object LineNumber | Select-Object -ExpandProperty LineNumber + switch ($args[0]) { + 90 { $degree = "Rotate90" + continue + } + 180 { $degree = "Rotate180" + continue + } + 270 { $degree = "Rotate270" + continue + } + default { Write-Error "Invalid rotation angle(valid 90,180,270)."; break } + } + default { Write-Error "Invalid number of arguments: $numArgs"; break } +} +# Setting the resolution on the correct display. +Get-DisplayConfig | Set-DisplayRotation -DisplayId $disp -Rotation $degree | Use-DisplayConfig \ No newline at end of file diff --git a/Community Scripts/scale-VDD.ps1 b/Community Scripts/scale-VDD.ps1 new file mode 100644 index 0000000..00d12ee --- /dev/null +++ b/Community Scripts/scale-VDD.ps1 @@ -0,0 +1,54 @@ +# Self-elevate the script if required +if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) { + if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) { + $CommandLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments + Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine + Exit + } +} + +$repoName = "PSGallery" +$moduleName1 = "DisplayConfig" +$moduleName2 = "MonitorConfig" +if (!(Get-PSRepository -Name $repoName) -OR !(Find-Module -Name $moduleName1 | Where-Object {$_.Name -eq $moduleName1}) -OR !(Find-Module -Name $moduleName2 | Where-Object {$_.Name -eq $moduleName2})) { + & .\dep_fix.ps1 +} + + +# Import the local module +$dpth = Get-Module -ListAvailable $moduleName1 | select path | Select-Object -ExpandProperty path +import-module -name $dpth -InformationAction:Ignore -Verbose:$false -WarningAction:SilentlyContinue -Confirm:$false + +# Import the other localmodule +$mpth = Get-Module -ListAvailable $moduleName2 | select path | Select-Object -ExpandProperty path +import-module -name $mpth -InformationAction:Ignore -Verbose:$false -WarningAction:SilentlyContinue -Confirm:$false + +# Check if there are enough arguments +$numArgs = $args.Count +switch ($numArgs) { + 0 { Write-Error "This script requires a scale 'reset' or an accepted percfentage value (100, 125, 150, 175, 200, 225, 250, 300, 350, 400, 450, 500) limited by the device max scale."; break } + 1 { $disp = Get-Monitor | Select-String -Pattern "MTT1337" | Select-Object LineNumber | Select-Object -ExpandProperty LineNumber + $maxscale = Get-DisplayScale -DisplayId $disp | Select-Object -ExpandProperty MaxScale + if ( $args[0] -is [int] ) { + if ( $args[0] -le $maxscale -And $args[0] -ge 100 ) { + Set-DisplayScale -DisplayId $disp -Scale $args[0] + break + } + else { + Write-Error "Invalid scale percentage." + break + } + } + else { + if ( $args[0] -eq "reset" ) { + Set-DisplayScale -DisplayId $disp -Recommended + break + } + else { + Write-Error "Invalid arguments: 'reset' or a valid percentage value like 150 is acceptable." + break + } + } + } + default { Write-Error "Invalid number of arguments: $numArgs"; break } +} diff --git a/Community Scripts/winp-VDD.ps1 b/Community Scripts/winp-VDD.ps1 new file mode 100644 index 0000000..92fd7cc --- /dev/null +++ b/Community Scripts/winp-VDD.ps1 @@ -0,0 +1,36 @@ +# Self-elevate the script if required +if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) { + if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) { + $CommandLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments + Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine + Exit + } +} + +$repoName = "PSGallery" +$moduleName1 = "DisplayConfig" +$moduleName2 = "MonitorConfig" +if (!(Get-PSRepository -Name $repoName) -OR !(Find-Module -Name $moduleName1 | Where-Object {$_.Name -eq $moduleName1}) -OR !(Find-Module -Name $moduleName2 | Where-Object {$_.Name -eq $moduleName2})) { + & .\dep_fix.ps1 +} + + +# Import the local module +$dpth = Get-Module -ListAvailable $moduleName1 | select path | Select-Object -ExpandProperty path +import-module -name $dpth -InformationAction:Ignore -Verbose:$false -WarningAction:SilentlyContinue -Confirm:$false + +# Import the other localmodule +$mpth = Get-Module -ListAvailable $moduleName2 | select path | Select-Object -ExpandProperty path +import-module -name $mpth -InformationAction:Ignore -Verbose:$false -WarningAction:SilentlyContinue -Confirm:$false + + +$profi = Get-DisplayProfile + +if ( $profi -eq "Extend" ) { + Set-DisplayProfile Clone + break +} +if ( $profi -eq "Clone" ) { + Set-DisplayProfile Extend + break +} \ No newline at end of file