EUCweb / BIS-F

Base Image Script Framework (BIS-F)
https://eucweb.com
GNU General Public License v3.0
99 stars 34 forks source link

[Feature request]: Remove ActiveSetup StubPath #373

Open matthias-schlimm opened 1 year ago

matthias-schlimm commented 1 year ago

Is your feature request related to a problem? Please describe.

User logon duration increased with ActiveSetup StubPath entries

Describe the solution you'd like

Remove Active Setup StubPath to boost the logon performance as described here https://james-rankin.com/features/the-ultimate-guide-to-windows-logon-time-optimizations-part-7/

Describe alternatives you've considered

Use Powershell instead of batch, snippset below is not BIS-F ready but it works too

clear-host
$Repath = @("HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components","HKLM:\SOFTWARE\WOW6432Node\Microsoft\Active Setup\Installed Components")

ForEach ($Path in $Repath) {
    Write-Host "- - - Processing $Path - - -" -ForegroundColor White 
    get-childitem $Path -Recurse -ErrorAction SilentlyContinue | 
        where-object {
            if ((Get-ItemProperty -Path $_.PsPath) -match "StubPath") {$_.PsPath}
                $test = (Get-ItemProperty  $_.PsPath).PSObject.Properties.Name -contains "StubPath"
                IF ($test -eq $true) {
                    Write-Host "Remove Stubpath in $($_.PsPath)" -ForegroundColor Green
                    Remove-ItemProperty $_.PsPath -Name "StubPath"
                } else {
                    Write-Host "Stubpath in $($_.PsPath) doesn't exist" -ForegroundColor Yellow
                }

           }
 }

Screenshots

No response

Additional context

No response

matthias-schlimm commented 1 year ago

Here is a BIS-F Custom Script for it copy it to the folder C:\Program Files (x86)\Base Image Script Framework (BIS-F)\Framework\Subcall\Preparation\Custom

20_PrepBISF_ActiveSetup.txt

BalintOberrauch commented 1 year ago

I use the following script as a custom script:

Write-Host "Querying and deleting 32bit STUB paths..." $path = "HKLM:\Software\Microsoft\Active Setup\Installed Components"

$keys = Get-ChildItem $path -Recurse | Where-Object { $_.Property -eq 'STUBPATH' }

foreach ($key in $keys) { Write-Host "Deleting STUBPATH from $key" Remove-ItemProperty -Path $key.PSPath -Name 'STUBPATH' -ErrorAction SilentlyContinue -Verbose }

Write-Host "Querying and deleting 64bit STUB paths..." $path = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Active Setup\Installed Components"

$keys = Get-ChildItem $path -Recurse | Where-Object { $_.Property -eq 'STUBPATH' }

foreach ($key in $keys) { Write-Host "Deleting STUBPATH from $key" Remove-ItemProperty -Path $key.PSPath -Name 'STUBPATH' -ErrorAction SilentlyContinue -Verbose }