reg.present state

114 views
Skip to first unread message

gotm...@gmail.com

unread,
Jul 17, 2017, 4:24:01 PM7/17/17
to Salt-users
Good morning! I am seeing a small problem with that looks like it was all ready fixed - so I think I am doing something wrong. I am trying to do a reg,present on a windows minion. 
 The problem I am having, is that it is going to only the 64 bit location. 

I want it to go to: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\
And it is going to: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Winlogon

Now, after searching for an answer, I found an old bug that says it was fixed. I tried all day yesterday with varius combinations of the use_32bit_registry: true command in the registry. For fun, I also tried the reflections entry as well. Neither worked. Am I missing something somewhere? SLS file and Version report below. I pasted the entire SLS in case my formatting is messed up elsewhere. 

SLS -

CompanyApp Prereq:
  chocolatey
.installed:
   
- name: jre8
   
- name: nircmd


user
:
  user
.present:
   
- groups:
     
- Users


TechAdmin:
  user
.present:
   
- groups:
     
- Administrators
CompanyAdmin:
  user
.present:
   
- groups:
     
- Administrators


'HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Winlogon':
  reg
.present:
   
- vname: Shell
   
- vdata: C:\company\shell.cmd


'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\':
  reg.present:
    - use_32bit_registry: True
    - vname: DefaultUserName
    - vdata: UserASDF1234




'
c:\company\':
  file.recurse:
    - source: salt://desktopvm/files/company/





Master Version report - 
Dependency Versions:
           cffi
: 1.6.0
       cherrypy
: Not Installed
       dateutil
: Not Installed
      docker
-py: Not Installed
          gitdb
: Not Installed
      gitpython
: Not Installed
          ioflo
: Not Installed
         
Jinja2: 2.7.2
        libgit2
: Not Installed
        libnacl
: Not Installed
       M2Crypto
: 0.21.1
           
Mako: Not Installed
   msgpack
-pure: Not Installed
 msgpack
-python: 0.4.8
   mysql
-python: Not Installed
      pycparser
: 2.14
       pycrypto
: 2.6.1
   pycryptodome
: Not Installed
         pygit2
: Not Installed
         
Python: 2.7.5 (default, Nov  6 2016, 00:28:07)
   python
-gnupg: Not Installed
         
PyYAML: 3.11
         
PyZMQ: 15.3.0
           RAET
: Not Installed
          smmap
: Not Installed
        timelib
: Not Installed
       
Tornado: 4.2.1
            ZMQ
: 4.1.4


System Versions:
           dist
: centos 7.3.1611 Core
        machine
: x86_64
        release
: 4.12.1-1.el7.elrepo.x86_64
         system
: Linux
        version
: CentOS Linux 7.3.1611 Core




Minion Version Report:


Salt Version:
           
Salt: 2016.3.6
Dependency Versions:
           cffi
: 1.10.0
       cherrypy
: 5.3.0
       dateutil
: 2.5.3
          gitdb
: 0.6.4
      gitpython
: 2.0.2
          ioflo
: 1.5.3
         
Jinja2: 2.9.4
        libgit2
: Not Installed
        libnacl
: 1.4.5
       M2Crypto
: Not Installed
           
Mako: 1.0.4
   msgpack
-pure: Not Installed
 msgpack
-python: 0.4.7
   mysql
-python: Not Installed
      pycparser
: 2.17
       pycrypto
: 2.6.1
         pygit2
: Not Installed
         
Python: 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:19:22) [MSC v.1500 32 bit (Intel)]
   python
-gnupg: 0.3.8
         
PyYAML: 3.11
         
PyZMQ: 15.3.0
           RAET
: Not Installed
          smmap
: 0.9.0
        timelib
: 0.2.4
       
Tornado: 4.3
            ZMQ
: 4.1.5
System Versions:
           dist
:
        machine
: AMD64
        release
: 10
         system
: Windows
        version
: 10 10.0.15063  Multiprocessor Free

gotm...@gmail.com

unread,
Jul 18, 2017, 2:48:34 AM7/18/17
to Salt-users
It appears this was a versioning issue on my end. Once I had everything on the same version, the import worked as intended.  

However it created a new problem, I think that it may be related to this:

I am attempting to add this key:

'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Terminal Server Client\PublisherBypassList\AAD59E96B1A568ABE20A927E5A7F1FBB61AA668A00':
State response:


----------
          ID
: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Terminal Server Client\PublisherBypassList\AAD59E96B1A568ABE20A927E5A7F1FBB61AA668A00
   
Function: reg.present
     
Result: False
     
Comment: Failed to add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Terminal Server Client\PublisherBypassList\AAD59E96B1A568ABE20A927E5A7F1FBB61AA668A00 to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Terminal Server Client\PublisherBypassList\AAD59E96B1A568ABE20A927E5A7F1FBB61AA668A00
     
Started: 23:22:27.397000
   
Duration: 1.0 ms
     
Changes:
----------

Minion Debug:


[INFO    ] Running state [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Terminal Server Client\PublisherBypassList\AAD59E96B1A568ABE20A927E5A7F1FBB61AA668A00] at time 23:32:48.077000
[INFO    ] Executing state reg.present for HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Terminal Server Client\PublisherBypassList\AAD59E96B1A568ABE20A927E5A7F1FBB61AA668A00
[ERROR   ] ..\Objects\longobject.c:426: bad argument to internal function
Traceback (most recent call last):
 
File "C:\salt\bin\lib\site-packages\salt\modules\reg.py", line 588, in set_value
   
RegSetValueEx(handle, local_vname, 0, vtype_value, local_vdata)
SystemError: ..\Objects\longobject.c:426: bad argument to internal function
[ERROR   ] Failed to add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Terminal Server Client\PublisherBypassList\AAD59E96B1A568ABE20A927E5A7F1FBB61AA668A00 to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Terminal Server Client\PublisherBypassList\AAD59E96B1A568ABE20A927E5A7F1FBB61AA668A00
[INFO    ] Completed state [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Terminal Server Client\PublisherBypassList\AAD59E96B1A568ABE20A927E5A7F1FBB61AA668A00] at time 23:32:48.077000 duration_in_ms=0.0

SLS entry:
'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Terminal Server Client\PublisherBypassList\AAD59E96B1A568ABE20A927E5A7F1FBB61AA557B00':
  reg
.present:
   
- vdata: 000000ad
   
- vtype: REG_DWORD



I got the same error when I attempted using the vname variable as well. 


Excuse any errors please. 3 AM here, it has just been bugging me so much lately. :) 



Thomas Phipps

unread,
Jul 18, 2017, 3:13:45 AM7/18/17
to Salt-users
shouldn't that be 0x000000AD not 000000ad

[take that with a grain of salt. i don't do windows and the registry is a black magic box to me.]

--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/salt-users/3e661e22-a08a-4bd7-8f6e-9a69de75006f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

gotm...@gmail.com

unread,
Jul 18, 2017, 2:28:12 PM7/18/17
to Salt-users
Good suggestion! Thank you. Unfortunately, it returned the same response. :( Other registry entries appear to work fine. 

I am trying other various things today now that I am well rested. I will post anything if I find it.

t5mark

unread,
Sep 19, 2017, 10:12:00 AM9/19/17
to Salt-users

a couple things.... 

so, i am starting to screw with reg.x

also, oddly the Trusted key... what worked

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Terminal Server Client\PublisherBypassList':
  re.present :
    - vname: {numbers thing}
    - vtype: REG_DWORD
    - vdata: {value in decimal, not hex}

the problem for me, is that a second entry for PublisherBypassList is seen as a duplicate state and won't apply. i cheated and made on HKLM\Software\blaah\blah and it worked... but if i need a third....
Reply all
Reply to author
Forward
0 new messages