Skip to content

[Bug]: win_lgpo_reg: test=True not working on User policy class values #68566

@dafyddj

Description

@dafyddj

What happened?

Using lgpo_reg.value_present test=True results in an inconclusive return on User policy class values.

Result using v3006.14

# salt DESKTOP-G7IDEEE -t 10 state.single lgpo_reg.value_present ScreenSaveActive key='Software\Policies\Microsoft\Windows\Control Panel\Desktop' v_data='"1"' v_type=REG_SZ policy_class=User test=True
DESKTOP-G7IDEEE:
----------
          ID: ScreenSaveActive
    Function: lgpo_reg.value_present
      Result: True
     Comment: Policy value already present
              Registry value already present
     Started: 21:50:12.203276
    Duration: 17.762 ms
     Changes:   

Summary for DESKTOP-G7IDEEE
------------
Succeeded: 1
Failed:    0
------------
Total states run:     1
Total run time:  17.762 ms

Result using v3006.18

# salt DESKTOP-G7IDEEE -t 10 state.single lgpo_reg.value_present ScreenSaveActive key='Software\Policies\Microsoft\Windows\Control Panel\Desktop' v_data='"1"' v_type=REG_SZ policy_class=User 
DESKTOP-G7IDEEE:                        
----------                   
          ID: ScreenSaveActive
    Function: lgpo_reg.value_present
      Result: True
     Comment: Policy value set
     Started: 21:39:56.422544
    Duration: 29.519 ms   
     Changes:   
              ----------
              new:     
                  ----------
                  pol:                                                                                                                                                                                                                                                         
                      ----------
                      data:               
                          1                    
                      key:                                                                                                                                                                                                                                                     
                          Software\Policies\Microsoft\Windows\Control Panel\Desktop
                      name:
                          ScreenSaveActive
                      type:         
                          REG_SZ
              old:                        
                  ----------                
                  pol:       
                      ----------
                                                                   
Summary for DESKTOP-G7IDEEE
------------               
Succeeded: 1 (changed=1)
Failed:    0
------------
Total states run:     1
Total run time:  29.519 ms
root@local-minion ~# salt DESKTOP-G7IDEEE -t 10 state.single lgpo_reg.value_present ScreenSaveActive key='Software\Policies\Microsoft\Windows\Control Panel\Desktop' v_data='"1"' v_type=REG_SZ policy_class=User test=True
DESKTOP-G7IDEEE:                                                                                                                                                                                                                                                               
----------      
          ID: ScreenSaveActive
    Function: lgpo_reg.value_present
      Result: None                  
     Comment:     
     Started: 21:40:19.400635             
    Duration: 3.775 ms                      
     Changes:                
                                                                   
Summary for DESKTOP-G7IDEEE
------------
Succeeded: 1 (unchanged=1) 
Failed:    0
------------
Total states run:     1
Total run time:   3.775 ms

I believe the state thinks there is more work to be done (setting the registry value) but at the same time isn't supposed to do that.

FAO @twangboy

Type of salt install

Official exe

Major version

3006.x, 3007.x

What supported OS are you seeing the problem on? Can select multiple. (If bug appears on an unsupported OS, please open a GitHub Discussion instead)

windows-desktop-11

salt --versions-report output

Salt Version:
              Salt: 3006.18
     
    Python Version:
            Python: 3.10.19 (heads/main:e8bbdd8, Dec 16 2025, 10:04:27) [MSC v.1944 64 bit (AMD64)]
     
    Dependency Versions:
              cffi: 2.0.0
          cherrypy: 18.6.1
      cryptography: 42.0.5
          dateutil: 2.8.1
         docker-py: Not Installed
             gitdb: 4.0.7
         gitpython: 3.1.41
            Jinja2: 3.1.6
           libgit2: Not Installed
      looseversion: 1.0.2
          M2Crypto: Not Installed
              Mako: Not Installed
           msgpack: 1.0.2
      msgpack-pure: Not Installed
      mysql-python: Not Installed
         packaging: 24.0
         pycparser: 2.21
          pycrypto: Not Installed
      pycryptodome: 3.19.1
            pygit2: Not Installed
      python-gnupg: 0.4.8
            PyYAML: 6.0.1
             PyZMQ: 25.0.2
            relenv: 0.22.1
             smmap: 4.0.0
           timelib: 0.2.4
           Tornado: 4.5.3
               ZMQ: 4.3.4
     
    System Versions:
              dist:   
            locale: utf-8
           machine: AMD64
           release: 10
            system: Windows
           version: 10 10.0.26100 SP0 Multiprocessor Free

Metadata

Metadata

Assignees

Labels

bugbroken, incorrect, or confusing behavior

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions