You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Set-WindowsCbsEdition.ps1
+9-5Lines changed: 9 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
36
36
Sets the script to stage the current edition instead of removing it.
37
37
#>
38
38
39
-
#Requires -RunAsAdministrator
40
39
41
40
param (
42
41
[Parameter()]
@@ -49,6 +48,11 @@ param (
49
48
[Switch]$StageCurrent
50
49
)
51
50
51
+
if (-Not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
52
+
Write-Error"Administrator rights are required to change the edition!"
$packages=Get-ChildItem-Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages'| select Name |where name -Match'^.*\\Microsoft-Windows-.*Edition~'
202
+
$packages=Get-ChildItem-Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages'| select Name |where{ $_.name-match'^.*\\Microsoft-Windows-.*Edition~' }
0 commit comments