Convert Windows Server to Workstation (Offline)

Discussion in 'Windows Server' started by freddie-o, Dec 5, 2021.

  1. freddie-o

    freddie-o MDL Addicted

    Jul 29, 2009
    949
    1,236
    30
    #1 freddie-o, Dec 5, 2021
    Last edited: Dec 8, 2021
    * Tested on Server 2022. Should work on Server 2019


    1.)
    Mount and copy your Windows Server ISO to your hard drive


    2.) Export your target image / index
    i.e. To export "Windows Server 2022 Standard (Desktop Experience)"
    Code:
    @echo off
    Dism /Export-Image /SourceImageFile:install.wim /SourceIndex:2 /DestinationImageFile:install2.wim /CheckIntegrity
    pause
    
    Rename install2.wim to install.wim


    3.) Create a folder at the root of the partition (i.e. C:\Server). Put your BAT script/s and the (exported) install.wim in the folder.

    Modify / add / remove entries in the script below depending on how you setup your Workstation
    Code:
    @echo off
    
    rem == create mount and scratch folders ==
    mkdir mount
    mkdir temp
    
    rem == mount install.wim ==
    dism /mount-wim /wimfile:install.wim /index:1 /mountdir:mount
    
    rem == modify the registry ==
    reg load HKLM\SOFTHIVE mount\Windows\System32\config\SOFTWARE
    
    rem == disable server manager from launching at logon ==
    reg add "HKLM\SOFTHIVE\Microsoft\ServerManager" /v "DoNotOpenServerManagerAtLogon" /t REG_DWORD /d "1" /f
    
    rem == disable users must enter a user name and password ==
    reg add "HKLM\SOFTHIVE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d "0" /f
    
    rem == disable shutdown event tracker when you shut down the computer ==
    reg add "HKLM\SOFTHIVE\Policies\Microsoft\Windows NT\Reliability" /v "ShutDownReasonOn" /t REG_DWORD /d "0" /f
    
    rem == disable Ctrl+Alt+Del to log on to Windows ==
    reg add "HKLM\SOFTHIVE\Microsoft\Windows\CurrentVersion\RunOnce" /v "disablecad" /t REG_SZ /d "reg delete \"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\" /v \"disablecad\" /f" /f
    
    rem == display the shutdown button in the logon dialog box ==
    reg add "HKLM\SOFTHIVE\Microsoft\Windows\CurrentVersion\RunOnce" /v "shutdownwithoutlogon" /t REG_SZ /d "reg add \"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\" /v \"shutdownwithoutlogon\" /t REG_DWORD /d \"1\" /f" /f
    
    rem == disable remote management ==
    reg add "HKLM\SOFTHIVE\Microsoft\Windows\CurrentVersion\WSMAN\Service" /v "allow_remote_requests" /t REG_DWORD /d "0" /f
    
    rem == turn on DEP for essential windows programs and services only ==
    reg add "HKLM\SOFTHIVE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\NoExecuteState" /v "LastNoExecuteRadioButtonState" /t REG_DWORD /d "14012" /f
    
    rem == turn off internet explorer enhanced security configuration
    reg add "HKLM\SOFTHIVE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}" /v "IsInstalled" /t REG_DWORD /d "0" /f
    reg add "HKLM\SOFTHIVE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}" /v "IsInstalled" /t REG_DWORD /d "0" /f
    
    reg unload HKLM\SOFTHIVE
    reg load HKLM\SYSHIVE mount\Windows\System32\config\SYSTEM
    
    rem == disable Structured Exception Handling Overwrite Protection (SEHOP) ==
    reg add "HKLM\SYSHIVE\ControlSet001\Control\Session Manager\Kernel" /v "DisableExceptionChainValidation" /t REG_DWORD /d "1" /f
    
    rem == change windows audio startup type to automatic ==
    reg add "HKLM\SYSHIVE\ControlSet001\Services\AudioEndpointBuilder" /v "Start" /t REG_DWORD /d "2" /f
    reg add "HKLM\SYSHIVE\ControlSet001\Services\Audiosrv" /v "Start" /t REG_DWORD /d "2" /f
    
    rem == allocate processor resources for best performance of programs ==
    reg add "HKLM\SYSHIVE\ControlSet001\Control\PriorityControl" /v "Win32PrioritySeparation" /t REG_DWORD /d "38" /f
    
    reg unload HKLM\SYSHIVE
    reg load HKLM\NTUSER mount\Users\Default\NTUSER.DAT
    
    rem == adjust visual effects for best appearance ==
    reg add "HKLM\NTUSER\Control Panel\Desktop" /v "UserPreferencesMask" /t REG_BINARY /d "9e3e078012000000" /f
    reg add "HKLM\NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" /v "VisualFXSetting" /t REG_DWORD /d "1" /f
    reg add "HKLM\NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\AnimateMinMax" /v "DefaultApplied" /t REG_DWORD /d "1" /f
    reg add "HKLM\NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\ComboBoxAnimation" /v "DefaultApplied" /t REG_DWORD /d "1" /f
    reg add "HKLM\NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\ControlAnimations" /v "DefaultApplied" /t REG_DWORD /d "1" /f
    reg add "HKLM\NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\CursorShadow" /v "DefaultApplied" /t REG_DWORD /d "1" /f
    reg add "HKLM\NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\DragFullWindows" /v "DefaultApplied" /t REG_DWORD /d "1" /f
    reg add "HKLM\NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\DropShadow" /v "DefaultApplied" /t REG_DWORD /d "1" /f
    reg add "HKLM\NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\DWMAeroPeekEnabled" /v "DefaultApplied" /t REG_DWORD /d "1" /f
    reg add "HKLM\NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\DWMEnabled" /v "DefaultApplied" /t REG_DWORD /d "1" /f
    reg add "HKLM\NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\DWMSaveThumbnailEnabled" /v "DefaultApplied" /t REG_DWORD /d "1" /f
    reg add "HKLM\NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\ListBoxSmoothScrolling" /v "DefaultApplied" /t REG_DWORD /d "1" /f
    reg add "HKLM\NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\ListviewAlphaSelect" /v "DefaultApplied" /t REG_DWORD /d "1" /f
    reg add "HKLM\NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\ListviewShadow" /v "DefaultApplied" /t REG_DWORD /d "1" /f
    reg add "HKLM\NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\MenuAnimation" /v "DefaultApplied" /t REG_DWORD /d "1" /f
    reg add "HKLM\NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\SelectionFade" /v "DefaultApplied" /t REG_DWORD /d "1" /f
    reg add "HKLM\NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\TaskbarAnimations" /v "DefaultApplied" /t REG_DWORD /d "1" /f
    reg add "HKLM\NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\Themes" /v "DefaultApplied" /t REG_DWORD /d "1" /f
    reg add "HKLM\NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\ThumbnailsOrIcon" /v "DefaultApplied" /t REG_DWORD /d "1" /f
    reg add "HKLM\NTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\TooltipAnimation" /v "DefaultApplied" /t REG_DWORD /d "1" /f
    reg add "HKLM\NTUSER\Software\Microsoft\Windows\CurrentVersion\ThemeManager" /v "ThemeActive" /t REG_SZ /d "1" /f
    
    reg unload HKLM\NTUSER
    rem == done editing registry ==
    
    rem == enable wireless lan feature ==
    dism /scratchdir:temp /image:mount /enable-feature /featurename:WirelessNetworking /all
    dism /scratchdir:temp /image:mount /get-featureinfo /featurename:WirelessNetworking
    
    rem == unmount wim ==
    dism /unmount-wim /mountdir:mount /commit
    
    rem == delete mount and scratch folders ==
    rd /s /q mount
    rd /s /q temp
    
    pause
    exit
    


    4.) After unmounting the install.wim, move it to the Windows Server (sources) folder -- replacing the original install.wim -- and create your Workstation ISO



    + + +​



    Add drivers
    Create a "drivers" folder in the "C:\Server" folder and unpack drivers to it
    Add this code to the above script
    Code:
    rem == add drivers ==
    dism /scratchdir:temp /image:mount /Add-Driver /Driver:drivers /recurse
    

     
  2. (\_/)^(\_/)

    (\_/)^(\_/) MDL Member

    May 31, 2020
    1,758
    1,488
    60
    #2 (\_/)^(\_/), Dec 5, 2021
    Last edited: Dec 5, 2021
    Thank you sir . Great thread :)

    Edit:

    Sir might be This Script to remove M$ telemetry package also will be usefull :
    Code:
    Powershell -EP Bypass -MTA -NOL -NONI -NOP -C "Set-ItemProperty -Path 'HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\*Microsoft-OneCore-AllowTelemetry*' -Name Visibility -Value 1 -Force -EA SilentlyContinue -Verbose"
    Powershell -C "Remove-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\*Microsoft-OneCore-AllowTelemetry*' -Include *Owner* -Recurse -Force -EA SilentlyContinue -Verbose"
    Powershell -C "Get-ChildItem -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\*Microsoft-OneCore-AllowTelemetry*' -Name | ForEach-Object  {dism /online /remove-package /PackageName:$_ /NoRestart}"
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Atari800XL

    Atari800XL MDL Addicted

    Apr 3, 2011
    929
    1,629
    30
    Interesting Powershell code. This replaces the "InstallWimTweak" tool like below, correct?

    Code:
    install_wim_tweak.exe /p d:\mount /c Microsoft-OneCore-AllowTelemetry-Reduced-Default-Package /r
     
  4. (\_/)^(\_/)

    (\_/)^(\_/) MDL Member

    May 31, 2020
    1,758
    1,488
    60
    Yes Sir . Thank You :)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. vladnil

    vladnil MDL Senior Member

    Jan 19, 2019
    323
    246
    10
    Have you tried putting a sandbox on Windows Server Preview Build 22509?
    I ran the script but it gives me an error when I start the sandbox.

    dir /b %SystemRoot%\servicing\Packages\*Containers*.mum >sandbox.txt

    for /f %i in ('findstr /i . sandbox.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%i"

    del sandbox.txt

    dir /b %SystemRoot%\servicing\Packages\*HyperV*.mum >hv.txt

    for /f %i in ('findstr /i . hv.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%i"

    del hv.txt

    dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >h-v.txt

    for /f %i in ('findstr /i . h-v.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%i"

    del h-v.txt

    dir /b %SystemRoot%\servicing\Packages\*remote*.mum >remote.txt

    for /f %i in ('findstr /i . remote.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%i"

    del remote.txt

    set REGWAY="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Containers\CmService\Policy"

    reg add %REGWAY% /v DisableClone /t REG_DWORD /d 1

    reg add %REGWAY% /v DisableSnapshot /t REG_DWORD /d 1

    pause

    exit
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. freddie-o

    freddie-o MDL Addicted

    Jul 29, 2009
    949
    1,236
    30
    #6 freddie-o, Dec 6, 2021
    Last edited: Dec 7, 2021
    (OP)
    This is how I disable telemetry
    https://forums.mydigitallife.net/th...lemetry-repository.63874/page-66#post-1686849

     
  7. freddie-o

    freddie-o MDL Addicted

    Jul 29, 2009
    949
    1,236
    30
    Sorry no experience with either
     
  8. (\_/)^(\_/)

    (\_/)^(\_/) MDL Member

    May 31, 2020
    1,758
    1,488
    60
    is there any repo thread by you for all your scripts on MDL . i think it will be great for you to create "Freddie-o Scripts Repo" for others to get benefits of them :)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. freddie-o

    freddie-o MDL Addicted

    Jul 29, 2009
    949
    1,236
    30
    #9 freddie-o, Dec 6, 2021
    Last edited: Dec 7, 2021
    (OP)
    It's in my sig. Most of the scripts I post -- either somebody helped me put together or copy-paste or someone else's script I modified :p
     
  10. (\_/)^(\_/)

    (\_/)^(\_/) MDL Member

    May 31, 2020
    1,758
    1,488
    60
    as you suggested this way you disable tlmtry https://forums.mydigitallife.net/th...lemetry-repository.63874/page-66#post-1686849
    user have to search it from all your posts but can find it if a repo thread of yours is there on the go . i hope my concern is crystal cleared.

    :)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. (\_/)^(\_/)

    (\_/)^(\_/) MDL Member

    May 31, 2020
    1,758
    1,488
    60
    Credits Always Yours Sir & Pleasure Always Remains Mine :)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...