Compare commits

...

2 Commits

Author SHA1 Message Date
WindowsAddict 5728ba2686 Add check for NT SERVICE\sppsvc 2024-07-20 03:13:45 +05:30
WindowsAddict ddccc4025f Optimize the code
Thanks to abbodi1406
2024-07-19 21:32:28 +05:30
4 changed files with 6 additions and 14 deletions

View File

@ -1443,7 +1443,7 @@ if not defined permerror (
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && ( reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && (
set "pol=HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Policies" set "pol=HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Policies"
reg query "!pol!" %nul% || reg add "!pol!" %nul% reg query "!pol!" %nul% || reg add "!pol!" %nul%
%psc% "$acl = (Get-Acl 'Registry::!pol!' | fl | Out-String); if (-not ($acl -match 'NT AUTHORITY\\NETWORK SERVICE Allow FullControl') -or ($acl -match 'NT AUTHORITY\\NETWORK SERVICE Deny')) {Exit 3}" %nul% %psc% "$acl = (Get-Acl 'Registry::!pol!' | fl | Out-String); if (-not ($acl -match 'NT AUTHORITY\\NETWORK SERVICE Allow FullControl' -or $acl -match 'NT SERVICE\\sppsvc Allow FullControl') -or ($acl -match 'Deny')) {Exit 3}" %nul%
if !errorlevel!==3 set "permerror=Error Found In S-1-5-20 SPP" if !errorlevel!==3 set "permerror=Error Found In S-1-5-20 SPP"
) )
) )

View File

@ -1581,7 +1581,7 @@ if not defined permerror (
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && ( reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && (
set "pol=HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Policies" set "pol=HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Policies"
reg query "!pol!" %nul% || reg add "!pol!" %nul% reg query "!pol!" %nul% || reg add "!pol!" %nul%
%psc% "$acl = (Get-Acl 'Registry::!pol!' | fl | Out-String); if (-not ($acl -match 'NT AUTHORITY\\NETWORK SERVICE Allow FullControl') -or ($acl -match 'NT AUTHORITY\\NETWORK SERVICE Deny')) {Exit 3}" %nul% %psc% "$acl = (Get-Acl 'Registry::!pol!' | fl | Out-String); if (-not ($acl -match 'NT AUTHORITY\\NETWORK SERVICE Allow FullControl' -or $acl -match 'NT SERVICE\\sppsvc Allow FullControl') -or ($acl -match 'Deny')) {Exit 3}" %nul%
if !errorlevel!==3 set "permerror=Error Found In S-1-5-20 SPP" if !errorlevel!==3 set "permerror=Error Found In S-1-5-20 SPP"
) )
) )

View File

@ -1170,11 +1170,7 @@ reg delete HKLM\SOFTWARE\Microsoft\Office\15.0\ClickToRun\Configuration /v Share
:: Clear device-based-licensing :: Clear device-based-licensing
:: https://learn.microsoft.com/deployoffice/device-based-licensing :: https://learn.microsoft.com/deployoffice/device-based-licensing
if defined _o16c2rIds ( for /f %%# in ('reg query "%o16c2r_reg%\Configuration" /f *.DeviceBasedLicensing %nul6% ^| findstr REG_') do reg delete "%o16c2r_reg%\Configuration" /v %%# /f %nul%
for /f "tokens=1 delims= " %%A in ('reg query "%o16c2r_reg%\Configuration" %nul6%') do (
echo %%A | find /i ".DeviceBasedLicensing" %nul% && reg delete "%o16c2r_reg%\Configuration" /v "%%A" /f %nul%
)
)
:: Remove OEM registry key :: Remove OEM registry key
:: https://support.microsoft.com/office/office-repeatedly-prompts-you-to-activate-on-a-new-pc-a9a6b05f-f6ce-4d1f-8d49-eb5007b64ba1 :: https://support.microsoft.com/office/office-repeatedly-prompts-you-to-activate-on-a-new-pc-a9a6b05f-f6ce-4d1f-8d49-eb5007b64ba1
@ -1895,7 +1891,7 @@ if not defined permerror (
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && ( reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && (
set "pol=HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Policies" set "pol=HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Policies"
reg query "!pol!" %nul% || reg add "!pol!" %nul% reg query "!pol!" %nul% || reg add "!pol!" %nul%
%psc% "$acl = (Get-Acl 'Registry::!pol!' | fl | Out-String); if (-not ($acl -match 'NT AUTHORITY\\NETWORK SERVICE Allow FullControl') -or ($acl -match 'NT AUTHORITY\\NETWORK SERVICE Deny')) {Exit 3}" %nul% %psc% "$acl = (Get-Acl 'Registry::!pol!' | fl | Out-String); if (-not ($acl -match 'NT AUTHORITY\\NETWORK SERVICE Allow FullControl' -or $acl -match 'NT SERVICE\\sppsvc Allow FullControl') -or ($acl -match 'Deny')) {Exit 3}" %nul%
if !errorlevel!==3 set "permerror=Error Found In S-1-5-20 SPP" if !errorlevel!==3 set "permerror=Error Found In S-1-5-20 SPP"
) )
) )

View File

@ -1226,11 +1226,7 @@ reg delete HKLM\SOFTWARE\Microsoft\Office\15.0\ClickToRun\Configuration /v Share
:: Clear device-based-licensing :: Clear device-based-licensing
:: https://learn.microsoft.com/deployoffice/device-based-licensing :: https://learn.microsoft.com/deployoffice/device-based-licensing
if defined _o16c2rIds ( for /f %%# in ('reg query "%o16c2r_reg%\Configuration" /f *.DeviceBasedLicensing %nul6% ^| findstr REG_') do reg delete "%o16c2r_reg%\Configuration" /v %%# /f %nul%
for /f "tokens=1 delims= " %%A in ('reg query "%o16c2r_reg%\Configuration" %nul6%') do (
echo %%A | find /i ".DeviceBasedLicensing" %nul% && reg delete "%o16c2r_reg%\Configuration" /v "%%A" /f %nul%
)
)
:: Remove OEM registry key :: Remove OEM registry key
:: https://support.microsoft.com/office/office-repeatedly-prompts-you-to-activate-on-a-new-pc-a9a6b05f-f6ce-4d1f-8d49-eb5007b64ba1 :: https://support.microsoft.com/office/office-repeatedly-prompts-you-to-activate-on-a-new-pc-a9a6b05f-f6ce-4d1f-8d49-eb5007b64ba1
@ -2896,7 +2892,7 @@ if not defined permerror (
reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && ( reg query "HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion" %nul% && (
set "pol=HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Policies" set "pol=HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Policies"
reg query "!pol!" %nul% || reg add "!pol!" %nul% reg query "!pol!" %nul% || reg add "!pol!" %nul%
%psc% "$acl = (Get-Acl 'Registry::!pol!' | fl | Out-String); if (-not ($acl -match 'NT AUTHORITY\\NETWORK SERVICE Allow FullControl') -or ($acl -match 'NT AUTHORITY\\NETWORK SERVICE Deny')) {Exit 3}" %nul% %psc% "$acl = (Get-Acl 'Registry::!pol!' | fl | Out-String); if (-not ($acl -match 'NT AUTHORITY\\NETWORK SERVICE Allow FullControl' -or $acl -match 'NT SERVICE\\sppsvc Allow FullControl') -or ($acl -match 'Deny')) {Exit 3}" %nul%
if !errorlevel!==3 set "permerror=Error Found In S-1-5-20 SPP" if !errorlevel!==3 set "permerror=Error Found In S-1-5-20 SPP"
) )
) )