@@ -90,40 +90,8 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
9090 {
9191 Write-Verbose - Message " Windows version is not supported. Update your Windows" - Verbose
9292
93- # Get the real Windows version like %SystemRoot%\system32\winver.exe relies on
94- $Signature = @ {
95- Namespace = " WinAPI"
96- Name = " Winbrand"
97- Language = " CSharp"
98- CompilerParameters = $CompilerParameters
99- MemberDefinition = @"
100- [DllImport("Winbrand.dll", CharSet = CharSet.Unicode)]
101- public extern static string BrandingFormatString(string sFormat);
102- "@
103- }
104-
105- # PowerShell 7 has CompilerOptions argument instead of CompilerParameters as PowerShell 5 has
106- # https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/add-type#-compileroptions
107- if ($Host.Version.Major -eq 7 )
108- {
109- $Signature.Remove (" CompilerParameters" )
110- $Signature.Add (" CompilerOptions" , $CompilerParameters )
111- }
112-
113- if (-not (" WinAPI.Winbrand" -as [type ]))
114- {
115- Add-Type @Signature
116- }
117-
11893 # Receive updates for other Microsoft products when you update Windows
119- if ([WinAPI.Winbrand ]::BrandingFormatString(" %WINDOWS_LONG%" ) -match " Windows 11" )
120- {
121- (New-Object - ComObject Microsoft.Update.ServiceManager).AddService2(" 7971f918-a847-4430-9279-4a52d1efe18d" , 7 , " " )
122- }
123- else
124- {
125- New-ItemProperty - Path HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings - Name AllowMUUpdateService - PropertyType DWord - Value 1 - Force
126- }
94+ (New-Object - ComObject Microsoft.Update.ServiceManager).AddService2(" 7971f918-a847-4430-9279-4a52d1efe18d" , 7 , " " )
12795
12896 # Check for updates
12997 Start-Process - FilePath " $env: SystemRoot \System32\UsoClient.exe" - ArgumentList StartInteractiveScan
@@ -315,8 +283,6 @@ switch ($Version)
315283 {
316284 Set-Location - Path " $DownloadsFolder \Sophia_Script_for_Windows_11_Latest"
317285 }
318-
319- return
320286 }
321287 " Sophia_Script_for_Windows_11_PowerShell_7"
322288 {
0 commit comments