apply windows 10 theme with cmd or powershell / programming


  1. Posts : 5
    Windows 10 PRO
       #1

    apply windows 10 theme with cmd or powershell / programming


    Hi All,

    I develop the company image and I'm trying to apply a theme with wallpaper and accent color. In the Windows 7 days this VBS line worked for me:

    WshShell.Run "rundll32.exe %SystemRoot%\system32\shell32.dll,Control_RunDLL %SystemRoot%\system32\desk.cpl desk @TheMes /Action:OpenTheme /file:""C:\Windows\Resources\Themes\HHMX.deskthemepack"""

    However when I run this on Windows 10 it doesn't work. Running the following line opens the theme selection window:

    rundll32.exe %SystemRoot%\system32\shell32.dll,Control_RunDLL %SystemRoot%\system32\desk.cpl desk @TheMes

    But the "/Action:OpenTheme" part doesn't work anymore. Does anyone have any suggestions to make this work? Or any other ways. I don't want to lock the theme down with GPO (users complain), and I've tried adding the theme name to my answer file during sysprep, but that also is not working. If anyone has any guidance on apply a theme via an answer file that would be great too. Thanks for any help!
    Last edited by a1manarme; 24 May 2016 at 10:16.
      My Computer


  2. Posts : 42,957
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #2

    Hi, for what it's worth (= not an exact answer), here's how I do it from within an AHK script:
    run, "D:\GUI tweaks\Theme Switcher\ThemeSwitcher\Themeswitcher.exe" "Paler yellow, blue-green title.theme"
    Themeswitcher.exe is a tool produced by Winaero
    Winaero Theme Switcher
      My Computers


  3. Posts : 5
    Windows 10 PRO
    Thread Starter
       #3

    Thanks for your reply. I'd rather not use a tool like that. Also my companies firewall blocks anything from winaero. What is interesting is if I simply execute a theme file using CMD it changes the theme, but when I put it in a script, it doesn't work. Sadness.
      My Computer


  4. Posts : 17,661
    Windows 10 Pro
       #4

    Just to customize the default user profile, including customizing the theme and other visuals, see this tutorial: Default User Profile - Customize in Windows 10 - Windows 10 Forums

    To completely customize your Windows image in Audit Mode with sysprep, see this tutorial: Windows 10 Image - Customize in Audit Mode with Sysprep - Windows 10 Forums

    Kari
      My Computer


  5. Posts : 5
    Windows 10 PRO
    Thread Starter
       #5

    Thanks! Is there any elegant way to enter audit mode after I've already started to set up my image under the local admin? Do I sysprep /audit without answer file into audit mode, make customizations, then sysprep /oobe /unattend ? Thanks for your help!
      My Computer


  6. Posts : 17,661
    Windows 10 Pro
       #6

    WIN + R, type %windir%\system32\sysprep\sysprep.exe /audit /reboot, hit Enter to restart in Audit Mode.

    Notice that as you already have existing user accounts, all customizations will only apply to new user accounts, not existing ones.
      My Computer


  7. Posts : 5
    Windows 10 PRO
    Thread Starter
       #7

    I ended up using the solution provided by dalchina, thank you.
      My Computer


  8. Posts : 1
    10
       #8

    a1manarme said:
    Hi All,

    I develop the company image and I'm trying to apply a theme with wallpaper and accent color. In the Windows 7 days this VBS line worked for me:

    WshShell.Run "rundll32.exe %SystemRoot%\system32\shell32.dll,Control_RunDLL %SystemRoot%\system32\desk.cpl desk @TheMes /Action:OpenTheme /file:""C:\Windows\Resources\Themes\HHMX.deskthemepack"""

    However when I run this on Windows 10 it doesn't work. Running the following line opens the theme selection window:

    rundll32.exe %SystemRoot%\system32\shell32.dll,Control_RunDLL %SystemRoot%\system32\desk.cpl desk @TheMes

    But the "/Action:OpenTheme" part doesn't work anymore. Does anyone have any suggestions to make this work? Or any other ways. I don't want to lock the theme down with GPO (users complain), and I've tried adding the theme name to my answer file during sysprep, but that also is not working. If anyone has any guidance on apply a theme via an answer file that would be great too. Thanks for any help!
    figured this out after my win 7 script failed in 10

    #PS
    Start-Process "C:\Path\to\yourtheme.theme"
    Start-Sleep -s 10
    #US english
    (New-Object -comObject Shell.Application).Windows() | where-object {$_.LocationName -eq "Personalization"} | foreach-object {$_.quit()}
    #UK english
    (New-Object -comObject Shell.Application).Windows() | where-object {$_.LocationName -eq "Personalisation"} | foreach-object {$_.quit()}
      My Computer


  9. Posts : 1
    Windows 10 Pro, 64bit
       #9

    This is my PowerShell Script that worked well on Windows 10.

    Code:
    <#  Theme Changer for Windows 10 #>
    
    [String]$path2Theme = "C:\Users\foo\AppData\Local\Microsoft\Windows\Themes\bar.theme" # Write a path to your theme here.
    
    $killSystemSettings = $true
    if ( (Get-Process | Where-Object { $_.ProcessName -eq "SystemSettings" }) ) {
        Read-Host "Press enter to continue this theme changer script, which redirects the SystemSetting window to the Theme page."
        $killSystemSettings = $false
    }
    
    Start-Process $path2Theme
    
    if ( $killSystemSettings ) {
        for ( $i = 0; $i -lt 100; $i++ ){
            $systemSetting = Get-Process | Where-Object { $_.ProcessName -eq "SystemSettings" }
            if ( $systemSetting ) {
                $systemSetting | ForEach-Object { $_.Kill() } # The SystemSetting window may be displayed for seconds before being killed.
                $i = 100
            }
        } # Does anyone know a better way to wait for the Process to start?
    }
    For someone's information.
      My Computer


  10. SPB
    Posts : 78
    Windows 10 Home 22H2 x64
       #10

    Hi all, if you want to change your desktop wallpaper with a Powershell script, there is an easy way.
    Maybe it is already known, but I didn't find it on tenforums.
    I found it here: Windows 10 – How to Force Refresh of Desktop Wallpaper (without logoff/logon) – Griffon's IT Library
    Code:
    #-------------------------------------------------------------------#
    # ScriptName : SetWall.ps1                                          #
    # Description : Force a Desktop wallpaper Refresh                   #
    # Credits  : Unknown (if you know original creator, let us know)    #
    #                                                                   #
    # Date : 01 July 2020                                               #
    # https://c-nergy.be/blog/?p=15291                                  #
    # how to refresh desktop background image                           #
    #-------------------------------------------------------------------#
    
    #Modify Path to the picture accordingly to reflect your infrastructure
    $imgPath="C:\Users\xxxx\yyyy\zzzz\my_picture.png"
    $code = @' 
    using System.Runtime.InteropServices; 
    namespace Win32{ 
        
         public class Wallpaper{ 
            [DllImport("user32.dll", CharSet=CharSet.Auto)] 
             static extern int SystemParametersInfo (int uAction , int uParam , string lpvParam , int fuWinIni) ; 
             
             public static void SetWallpaper(string thePath){ 
                SystemParametersInfo(20,0,thePath,3); 
             }
        }
     } 
    '@
    
    add-type $code 
    
    #Apply the Change on the system 
    [Win32.Wallpaper]::SetWallpaper($imgPath)
    Just set the path to your picture at $imgPath and run the script.
    The image path can also be something like $imgPath="\\Domain.lab\netlogon\Wallpaper.png"
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 07:53.
Find Us




Windows 10 Forums