winutil icon indicating copy to clipboard operation
winutil copied to clipboard

"Secure (Recommended) Settings" (It is giving a bunch of errors: UnauthorizedAccessException, access denied and file does not exist).

Open felipendc opened this issue 2 years ago • 1 comments

Describe the bug: When I click on UPDATES and select the option "Secure (Recommended) Settings" it goes all good, but when I read the PowerShell log, there are a bunch of errors, like: UnauthorizedAccessException, access denied and file does not exist. So, I'm afraid that the settings was not applied 100% successfully.

To Reproduce: Steps to reproduce the behavior:

  1. Open a PowerShell windows as Admin and run this code: iwr -useb https://christitus.com/win | iex

  2. A new window will pop up, then got to UPDATE tab,

  3. Click on 'Secure (Recommended) Settings'

  4. A new window will pop up, saying: "Recommended Update settings loaded".

Expected behavior: Now, if you go back to the PowerShell window and read the log, it will show you all the errors in red lines.

This is the log of the error from my PowerShell window:

PS C:\Users\Felipe> iwr -useb https://christitus.com/win | iex
Transcript started, output file is C:\Users\Felipe\AppData\Local\Temp\Winutil.log
                                                                                                                                                                                                                                                 CCCCCCCCCCCCCTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT                                                                                                                                                                               CCC::::::::::::CT:::::::::::::::::::::TT:::::::::::::::::::::T                                                                                                                                                                              CC:::::::::::::::CT:::::::::::::::::::::TT:::::::::::::::::::::T                                                                                                                                                                             C:::::CCCCCCCC::::CT:::::TT:::::::TT:::::TT:::::TT:::::::TT:::::T                                                                                                                                                                            C:::::C       CCCCCCTTTTTT  T:::::T  TTTTTTTTTTTT  T:::::T  TTTTTT                                                                                                                                                                           C:::::C                     T:::::T                T:::::T                                                                                                                                                                                   C:::::C                     T:::::T                T:::::T
C:::::C                     T:::::T                T:::::T
C:::::C                     T:::::T                T:::::T
C:::::C                     T:::::T                T:::::T
C:::::C                     T:::::T                T:::::T
C:::::C       CCCCCC        T:::::T                T:::::T
C:::::CCCCCCCC::::C      TT:::::::TT            TT:::::::TT
CC:::::::::::::::C       T:::::::::T            T:::::::::T
CCC::::::::::::C         T:::::::::T            T:::::::::T
  CCCCCCCCCCCCC          TTTTTTTTTTT            TTTTTTTTTTT

====Chris Titus Tech=====
=====Windows Toolbox=====
Checking if Chocolatey is Installed...
Seems Chocolatey is not installed, installing now?
Are you Sure You Want To Proceed:(y/n): y
Forcing web requests to allow TLS v1.2 (Required for requests to Chocolatey.org)
Getting latest version of the Chocolatey package for download.
Not using proxy.
Getting Chocolatey from https://community.chocolatey.org/api/v2/package/chocolatey/1.4.0.
Downloading https://community.chocolatey.org/api/v2/package/chocolatey/1.4.0 to C:\Users\Felipe\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip
Not using proxy.
Extracting C:\Users\Felipe\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip to C:\Users\Felipe\AppData\Local\Temp\chocolatey\chocoInstall
Installing Chocolatey on the local machine
WARNING: Setting ChocolateyInstall Environment Variable on USER and not SYSTEM variables.
  This is due to either non-administrator install OR the process you are running is not being run as an Administrator.
Creating ChocolateyInstall as an environment variable (targeting 'User')
  Setting ChocolateyInstall to 'C:\ProgramData\chocolatey'
WARNING: It's very likely you will need to close and reopen your shell
  before you can use choco.
===========================================
--    Chocolatey failed to install      ---
===========================================
Disabling driver offering through Windows Update...
New-Item : Access to the registry key 'HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Device Metadata' is denied.
At line:1907 char:13
+             New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : PermissionDenied: (HKEY_LOCAL_MACH...Device Metadata:String) [New-Item], UnauthorizedAccessException
    + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.NewItemCommand

Set-ItemProperty : Cannot find path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Device Metadata' because it does not exist.
At line:1909 char:9
+         Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Win ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (HKLM:\SOFTWARE\...Device Metadata:String) [Set-ItemProperty], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetItemPropertyCommand

New-Item : Access to the registry key 'HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DriverSearching' is denied.
At line:1911 char:13
+             New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : PermissionDenied: (HKEY_LOCAL_MACH...DriverSearching:String) [New-Item], UnauthorizedAccessException
    + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.NewItemCommand

Set-ItemProperty : Cannot find path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\DriverSearching' because it does not exist.
At line:1913 char:9
+         Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Win ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (HKLM:\SOFTWARE\...DriverSearching:String) [Set-ItemProperty], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetItemPropertyCommand

Set-ItemProperty : Cannot find path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\DriverSearching' because it does not exist.
At line:1914 char:9
+         Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Win ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (HKLM:\SOFTWARE\...DriverSearching:String) [Set-ItemProperty], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetItemPropertyCommand

Set-ItemProperty : Cannot find path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\DriverSearching' because it does not exist.
At line:1915 char:9
+         Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Win ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (HKLM:\SOFTWARE\...DriverSearching:String) [Set-ItemProperty], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetItemPropertyCommand

New-Item : Requested registry access is not allowed.
At line:1917 char:13
+             New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : PermissionDenied: (HKEY_LOCAL_MACH...crosoft\Windows:String) [New-Item], SecurityException
    + FullyQualifiedErrorId : System.Security.SecurityException,Microsoft.PowerShell.Commands.NewItemCommand

Set-ItemProperty : Cannot find path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate' because it does not exist.
At line:1919 char:9
+         Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Win ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (HKLM:\SOFTWARE\...s\WindowsUpdate:String) [Set-ItemProperty], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetItemPropertyCommand

Disabling Windows Update automatic restart...
New-Item : Access to the registry key 'HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU' is denied.
At line:1922 char:13
+             New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : PermissionDenied: (HKEY_LOCAL_MACH...indowsUpdate\AU:String) [New-Item], UnauthorizedAccessException
    + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.NewItemCommand

Set-ItemProperty : Cannot find path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU' because it does not exist.
At line:1924 char:9
+         Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Win ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (HKLM:\SOFTWARE\...indowsUpdate\AU:String) [Set-ItemProperty], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetItemPropertyCommand

Set-ItemProperty : Cannot find path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU' because it does not exist.
At line:1925 char:9
+         Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Win ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (HKLM:\SOFTWARE\...indowsUpdate\AU:String) [Set-ItemProperty], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetItemPropertyCommand

Disabled driver offering through Windows Update
=================================
-- Updates Set to Recommended ---
=================================
Transcript stopped, output file is C:\Users\Felipe\AppData\Local\Temp\Winutil.log
PS C:\Users\Felipe>
´´´

felipendc avatar May 21 '23 23:05 felipendc

Are you sure you are running powershell as admin?

WARNING: Setting ChocolateyInstall Environment Variable on USER and not SYSTEM variables.
  This is due to either non-administrator install OR the process you are running is not being run as an Administrator.

DeveloperDurp avatar May 27 '23 13:05 DeveloperDurp

This shouldn't happen as script will now self elevate.

ChrisTitusTech avatar Jul 15 '23 16:07 ChrisTitusTech