Browse Source

Fix for Show-Menu function

master
Dmitry Nefedov 3 months ago
parent
commit
c09f48143d
  1. 17
      Wrapper/Config/config_Windows_11_LTSC.json
  2. 4
      src/Sophia_Script_for_Windows_10/Module/Sophia.psm1
  3. 4
      src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1
  4. 4
      src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1
  5. 4
      src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1
  6. 4
      src/Sophia_Script_for_Windows_11/Module/Sophia.psm1
  7. 75
      src/Sophia_Script_for_Windows_11_LTSC_2024/Module/Sophia.psm1
  8. 8
      src/Sophia_Script_for_Windows_11_LTSC_2024/Sophia.ps1
  9. 4
      src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1

17
Wrapper/Config/config_Windows_11_LTSC.json

@ -645,23 +645,6 @@
"WindowsDefault": "One", "WindowsDefault": "One",
"LTSC2024": "true" "LTSC2024": "true"
}, },
{
"Region": "UI & Personalization",
"Control": "cmb",
"Required": "false",
"Function": "PreventTeamsInstallation",
"Arg": {
"Zero": {
"Tag": "Enable"
},
"One": {
"Tag": "Disable"
}
},
"Preset": "Zero",
"WindowsDefault": "One",
"LTSC2024": "true"
},
{ {
"Region": "UI & Personalization", "Region": "UI & Personalization",
"Control": "cmb", "Control": "cmb",

4
src/Sophia_Script_for_Windows_10/Module/Sophia.psm1

@ -924,8 +924,12 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
$Menu += [WinAPI.GetStrings]::GetString(16956) $Menu += [WinAPI.GetStrings]::GetString(16956)
} }
# Check if current terminal is Windows Terminal
if ($env:WT_SESSION)
{
# https://github.com/microsoft/terminal/issues/14992 # https://github.com/microsoft/terminal/issues/14992
[System.Console]::BufferHeight += $Menu.Count [System.Console]::BufferHeight += $Menu.Count
}
$minY = [Console]::CursorTop $minY = [Console]::CursorTop
$y = [Math]::Max([Math]::Min($Default, $Menu.Count), 0) $y = [Math]::Max([Math]::Min($Default, $Menu.Count), 0)

4
src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1

@ -892,8 +892,12 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
$Menu += [WinAPI.GetStrings]::GetString(16956) $Menu += [WinAPI.GetStrings]::GetString(16956)
} }
# Check if current terminal is Windows Terminal
if ($env:WT_SESSION)
{
# https://github.com/microsoft/terminal/issues/14992 # https://github.com/microsoft/terminal/issues/14992
[System.Console]::BufferHeight += $Menu.Count [System.Console]::BufferHeight += $Menu.Count
}
$minY = [Console]::CursorTop $minY = [Console]::CursorTop
$y = [Math]::Max([Math]::Min($Default, $Menu.Count), 0) $y = [Math]::Max([Math]::Min($Default, $Menu.Count), 0)

4
src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1

@ -892,8 +892,12 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
$Menu += [WinAPI.GetStrings]::GetString(16956) $Menu += [WinAPI.GetStrings]::GetString(16956)
} }
# Check if current terminal is Windows Terminal
if ($env:WT_SESSION)
{
# https://github.com/microsoft/terminal/issues/14992 # https://github.com/microsoft/terminal/issues/14992
[System.Console]::BufferHeight += $Menu.Count [System.Console]::BufferHeight += $Menu.Count
}
$minY = [Console]::CursorTop $minY = [Console]::CursorTop
$y = [Math]::Max([Math]::Min($Default, $Menu.Count), 0) $y = [Math]::Max([Math]::Min($Default, $Menu.Count), 0)

4
src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1

@ -928,8 +928,12 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
$Menu += [WinAPI.GetStrings]::GetString(16956) $Menu += [WinAPI.GetStrings]::GetString(16956)
} }
# Check if current terminal is Windows Terminal
if ($env:WT_SESSION)
{
# https://github.com/microsoft/terminal/issues/14992 # https://github.com/microsoft/terminal/issues/14992
[System.Console]::BufferHeight += $Menu.Count [System.Console]::BufferHeight += $Menu.Count
}
$minY = [Console]::CursorTop $minY = [Console]::CursorTop
$y = [Math]::Max([Math]::Min($Default, $Menu.Count), 0) $y = [Math]::Max([Math]::Min($Default, $Menu.Count), 0)

4
src/Sophia_Script_for_Windows_11/Module/Sophia.psm1

@ -898,8 +898,12 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
$Menu += [WinAPI.GetStrings]::GetString(16956) $Menu += [WinAPI.GetStrings]::GetString(16956)
} }
# Check if current terminal is Windows Terminal
if ($env:WT_SESSION)
{
# https://github.com/microsoft/terminal/issues/14992 # https://github.com/microsoft/terminal/issues/14992
[System.Console]::BufferHeight += $Menu.Count [System.Console]::BufferHeight += $Menu.Count
}
$minY = [Console]::CursorTop $minY = [Console]::CursorTop
$y = [Math]::Max([Math]::Min($Default, $Menu.Count), 0) $y = [Math]::Max([Math]::Min($Default, $Menu.Count), 0)

75
src/Sophia_Script_for_Windows_11_LTSC_2024/Module/Sophia.psm1

@ -877,8 +877,12 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
$Menu += [WinAPI.GetStrings]::GetString(16956) $Menu += [WinAPI.GetStrings]::GetString(16956)
} }
# Check if current terminal is Windows Terminal
if ($env:WT_SESSION)
{
# https://github.com/microsoft/terminal/issues/14992 # https://github.com/microsoft/terminal/issues/14992
[System.Console]::BufferHeight += $Menu.Count [System.Console]::BufferHeight += $Menu.Count
}
$minY = [Console]::CursorTop $minY = [Console]::CursorTop
$y = [Math]::Max([Math]::Min($Default, $Menu.Count), 0) $y = [Math]::Max([Math]::Min($Default, $Menu.Count), 0)
@ -3376,77 +3380,6 @@ function TaskViewButton
} }
} }
<#
.SYNOPSIS
Chat (Microsoft Teams) installation for new users
.PARAMETER Enable
Hide the Chat icon (Microsoft Teams) on the taskbar and prevent Microsoft Teams from installing for new users
.PARAMETER Disable
Show the Chat icon (Microsoft Teams) on the taskbar and remove block from installing Microsoft Teams for new users
.EXAMPLE
PreventTeamsInstallation -Enable
.EXAMPLE
PreventTeamsInstallation -Disable
.NOTES
Current user
#>
function PreventTeamsInstallation
{
param
(
[Parameter(
Mandatory = $true,
ParameterSetName = "Enable"
)]
[switch]
$Enable,
[Parameter(
Mandatory = $true,
ParameterSetName = "Disable"
)]
[switch]
$Disable
)
Clear-Variable -Name Task -ErrorAction Ignore
switch ($PSCmdlet.ParameterSetName)
{
"Disable"
{
# Save string to run it as "NT SERVICE\TrustedInstaller"
# Prevent Microsoft Teams from installing for new users
$Task = "New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Communications -Name ConfigureChatAutoInstall -Value 0 -Type Dword -Force"
}
"Enable"
{
# Save string to run it as "NT SERVICE\TrustedInstaller"
# Remove block from installing Microsoft Teams for new users
$Task = "Remove-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Communications -Name ConfigureChatAutoInstall -Value 1 -Type Dword -Force"
}
}
# Create a Scheduled Task to run it as "NT SERVICE\TrustedInstaller"
$Parameters = @{
TaskName = "BlockTeamsInstallation"
Action = New-ScheduledTaskAction -Execute powershell.exe -Argument "-WindowStyle Hidden -Command $Task"
}
Register-ScheduledTask @Parameters -Force
$ScheduleService = New-Object -ComObject Schedule.Service
$ScheduleService.Connect()
$ScheduleService.GetFolder("\").GetTask("BlockTeamsInstallation").RunEx($null, 0, 0, "NT SERVICE\TrustedInstaller")
# Remove temporary task
Unregister-ScheduledTask -TaskName BlockTeamsInstallation -Confirm:$false
}
<# <#
.SYNOPSIS .SYNOPSIS
Seconds on the taskbar clock Seconds on the taskbar clock

8
src/Sophia_Script_for_Windows_11_LTSC_2024/Sophia.ps1

@ -423,14 +423,6 @@ TaskViewButton -Hide
# Отобразить кнопку "Представление задач" на панели задач (значение по умолчанию) # Отобразить кнопку "Представление задач" на панели задач (значение по умолчанию)
# TaskViewButton -Show # TaskViewButton -Show
# Hide the Chat icon (Microsoft Teams) on the taskbar and prevent Microsoft Teams from installing for new users
# Скрыть кнопку чата (Microsoft Teams) с панели задач и запретить установку Microsoft Teams для новых пользователей
PreventTeamsInstallation -Enable
# Show the Chat icon (Microsoft Teams) on the taskbar and remove block from installing Microsoft Teams for new users (default value)
# Отобразить кнопку чата (Microsoft Teams) на панели задач и убрать блокировку на устанвоку Microsoft Teams для новых пользователей (значение по умолчанию)
# PreventTeamsInstallation -Disable
# Show seconds on the taskbar clock # Show seconds on the taskbar clock
# Показывать секунды на часах на панели задач # Показывать секунды на часах на панели задач
SecondsInSystemClock -Show SecondsInSystemClock -Show

4
src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1

@ -902,8 +902,12 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
$Menu += [WinAPI.GetStrings]::GetString(16956) $Menu += [WinAPI.GetStrings]::GetString(16956)
} }
# Check if current terminal is Windows Terminal
if ($env:WT_SESSION)
{
# https://github.com/microsoft/terminal/issues/14992 # https://github.com/microsoft/terminal/issues/14992
[System.Console]::BufferHeight += $Menu.Count [System.Console]::BufferHeight += $Menu.Count
}
$minY = [Console]::CursorTop $minY = [Console]::CursorTop
$y = [Math]::Max([Math]::Min($Default, $Menu.Count), 0) $y = [Math]::Max([Math]::Min($Default, $Menu.Count), 0)

Loading…
Cancel
Save