Skip to content

Commit d233d3d

Browse files
committed
Replace WIM with CIM
1 parent 855b87e commit d233d3d

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Windows/Activate and Get License.ps1

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
# Found from internet. Need to review and cleanup.
33

44
# Activate Windows
5-
$ProductKey = (Get-WmiObject -Class SoftwareLicensingService).OA3xOriginalProductKey
6-
Invoke-Expression "cscript /b C:\Windows\System32\slmgr.vbs -ipk $Productkey"
5+
$ProductKey = (Get-CimInstance -ClassName SoftwareLicensingService).OA3xOriginalProductKey
6+
Invoke-Expression "cscript /b C:\Windows\System32\slmgr.vbs -ipk $ProductKey"
77
Start-Sleep 5
88
Invoke-Expression 'cscript /b C:\Windows\System32\slmgr.vbs -ato'
99

1010

1111

1212
# Define the registry key path and value
1313
$registryPath = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\MfaRequiredInClipRenew'
14-
$registryValueName = 'Verify Multifactor Authentication in ClipRenew'
14+
$registryValueName = 'Verify Multi-factor Authentication in ClipRenew'
1515
$registryValueData = 0 # DWORD value of 0
1616
$sid = New-Object System.Security.Principal.SecurityIdentifier('S-1-5-4')
1717
# SID for the Everyone group
@@ -37,6 +37,4 @@ Write-Output "Added 'Interactive' group and SID ($sid) with read permissions (wi
3737
#Remove the # below to make sure it will kick off the scheduled task on already enrolled devices
3838
Start-Process "$env:SystemRoot\system32\ClipRenew.exe"
3939

40-
41-
42-
$ProductKey = (Get-WmiObject -Class SoftwareLicensingService).OA3xOriginalProductKey
40+
$ProductKey = (Get-CimInstance -ClassName SoftwareLicensingService).OA3xOriginalProductKey

0 commit comments

Comments
 (0)