Setupcomplete.cmd ignore some commands

Discussion in 'Scripting' started by ogoriaipfds, Feb 14, 2020.

  1. ogoriaipfds

    ogoriaipfds MDL Novice

    Joined:
    Feb 12, 2020
    Messages:
    17
    Likes Received:
    1
    Trophy Points:
    0
    #1 ogoriaipfds, Feb 14, 2020
    Last edited: Feb 14, 2020
    Code:
    @echo off
    reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "EnableLUA" /t REG_DWORD /d "0" /f
    reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows" /v "NoLockScreen" /t REG_DWORD /d "1" /f
    reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\AdvertisingInfo" /v "DisabledByGroupPolicy" /t REG_DWORD /d "1" /f
    reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\AppCompat" /v "AITEnable" /t REG_DWORD /d "0" /f
    reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\AppCompat" /v "DisableInventory" /t REG_DWORD /d "0" /f
    reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\AppCompat" /v "DisableUAR" /t REG_DWORD /d "0" /f
    reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v "AllowTelemetry" /t REG_DWORD /d "0" /f
    reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v "DisableDeviceDelete" /t REG_DWORD /d "1" /f
    reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v "DisableDiagnosticDataViewer" /t REG_DWORD /d "1" /f
    reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v "DoNotShowFeedbackNotifications" /t REG_DWORD /d "1" /f
    reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\GameDVR" /v "AllowGameDVR" /t REG_DWORD /d "0" /f
    reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\System" /v "AllowClipboardHistory" /t REG_DWORD /d "0" /f
    reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\System" /v "AllowCrossDeviceClipboard" /t REG_DWORD /d "0" /f
    reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\System" /v "EnableActivityFeed" /t REG_DWORD /d "0" /f
    reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\System" /v "EnableCdp" /t REG_DWORD /d "0" /f
    reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\System" /v "EnableSmartScreen" /t REG_DWORD /d "0" /f
    reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\System" /v "PublishUserActivities" /t REG_DWORD /d "0" /f
    reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\System" /v "UploadUserActivities" /t REG_DWORD /d "0" /f
    reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender" /v "DisableAntiSpyware" /t REG_DWORD /d "1" /f
    reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" /v "SpynetReporting" /t "REG_DWORD" /d "0" /f
    reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" /v "SubmitSamplesConsent" /t "REG_DWORD" /d "2" /f
    reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\Software Protection Platform" /v "NoGenTicket" /t "REG_DWORD" /d "1" /f
    reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\SystemRestore" /v "DisableSR" /t REG_DWORD /d "1" /f
    reg add "HKLM\SOFTWARE\Policies\Microsoft\WMDRM" /v "DisableOnline" /t "REG_DWORD" /d "1" /f
    start /wait "" "%~dp0Software\WinRAR\winrar-x64-580.exe" /s
    xcopy "%~dp0Software\WinRAR\rarreg.key" "%programfiles%\WinRAR\" /c /q /h /r /y
    shutdown /r
    rmdir /s /q "%windir%\Setup\Scripts"
    exit
    Why Setupcomplete ignores some commands, i.e. they are added to the registry, but the registry tweaks themselves do not work?

    Here are some EnableCdp, NoLockScreen that do not want to work or are not added at all. Are there really any restrictions in Setupcomplete?
     
  2. abbodi1406

    abbodi1406 MDL KB0000001

    Joined:
    Feb 19, 2011
    Messages:
    12,067
    Likes Received:
    55,424
    Trophy Points:
    340
    setupcomplete.cmd privileges are like Administrators, it cannot write to keys protected by TrustedInstaller or some other services
     
  3. ogoriaipfds

    ogoriaipfds MDL Novice

    Joined:
    Feb 12, 2020
    Messages:
    17
    Likes Received:
    1
    Trophy Points:
    0
    The key has been added to the registry, but it does not work!

    I do not need TrustedInstaller privileges when I do this from the command line and everything works.