'I am trying to install specific windows patch, i am getting Result Code: 4 and that patch is not downloading and installing,

I was working on automate windows patches which filter approved patchs from sever and download and install in local machine. but i am getting Result Code: 4 for both download and installation,
input patch example: 2022-03 Cumulative Update for Windows 11 for x64-based Systems (KB5011493)

from vb2py.vbfunctions import *
from vb2py.vbdebug import *
import sys


updateSession = CreateObject('Microsoft.Update.Session')
updateSession.ClientApplicationID = 'MSDN Sample Script'
#Get update title to search for
print('Enter the title of the update: ' + '(for example, Update for Windows Rights 
Management client 1.0)')
updateTitle = input('Enter title')
print('Searching for: ' + updateTitle + '...')
updateSearcher = updateSession.CreateupdateSearcher()
#Search for all software updates, already installed and not installed
searchResult = updateSearcher.Search('Type=\'Software\'')
updateToInstall = CreateObject('Microsoft.Update.UpdateColl')
updateIsApplicable = False
#Cycle through search results to look for the update title
for i in range(0, searchResult.Updates.Count - 1):
    update = searchResult.Updates.Item(i)
    if update.Title == updateTitle:
        #Update in list of applicable updates
        #Determine if it is already installed or not

        if update.IsInstalled == False:
            print('Result: Update applicable, not installed.')
            updateIsApplicable = True
            updateToInstall.Add(update)
        else:
            #Update is installed so notify user and quit
            print('Result: Update applicable, already installed.')
            updateIsApplicable = True
            sys.exit()
if updateIsApplicable == False:
    print('Result: Update is not applicable to this machine.')
print('Would you like to install now? (Y/N)')
stdInput = input('Enter Choose:')
if stdInput == 'N' or stdInput == 'n' :
    sys.exit()
elif stdInput == 'Y' or stdInput == 'y':
    #Download update
    downloader = updateSession.CreateUpdateDownloader()
    downloader.Updates = updateToInstall
    print('Downloading...')
    downloadResult = downloader.Download()
    print('Download Result: ', downloadResult.ResultCode)
    #Install Update
    installer = updateSession.CreateUpdateInstaller()
    print('Installing...')
    installer.Updates = updateToInstall
    installationResult = installer.Install()
    #Output the result of the installation
    print('Installation Result:' ,installationResult.ResultCode)
    print('Reboot Required: ', installationResult.RebootRequired)

In Terminal:

 Enter the title of the update: (for example, Update for Windows Rights Management 
 client 1.0)
 Enter title2022-03 Cumulative Update for Windows 11 for x64-based Systems (KB5011493)
 Searching for: 2022-03 Cumulative Update for Windows 11 for x64-based Systems 
 (KB5011493)...
 Result: Update applicable, not installed.
 Would you like to install now? (Y/N)
 Enter Choose:y
 Downloading...
 Download Result:  4
 Installing...
 Installation Result: 4
 Reboot Required:  False
 PS C:\Users\Somesh\Desktop\salt>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source