How can I import a security template in Windows 7 using command line?

5,188

You can try method 1 from ibsk8in31's answer over at ServerFault:

https://serverfault.com/questions/678149/use-script-to-edit-local-group-policy-windows-server-2012

TLDR:

secedit /configure /db c:\windows\security\local.sdb /cfg {.\path\to.inf}

Share:
5,188

Related videos on Youtube

Sopalajo de Arrierez
Author by

Sopalajo de Arrierez

Updated on September 18, 2022

Comments

  • Sopalajo de Arrierez
    Sopalajo de Arrierez over 1 year

    I would like to remotely deploy some specific change in Security Policies to several computers via remote console (SSH). This is my just exported security template .inf file, extracted according (mostly) to these instructions :

    [Unicode]
    Unicode=yes
    [Registry Values]
    [Privilege Rights]
    SeCreateTokenPrivilege = CRON
    [Version]
    signature="$CHICAGO$"
    Revision=1
    [Profile Description]
    Description=PruebaCRON
    

    It just adds the user "CRON" (homemade) to Local Security Policy snap-in to allow that user to 'Create a token object'.
    When I try to import it in another computer (both Windows 7 SP1, 64 bits) doing this:

    secedit /import /db secedit.sdb /cfg PruebaCRON.inf /overwrite /log MyLog.txt
    

    ... I get a warning message ("overwriting is dangerous, blah blah blah..."), I accept, and there is no error message, but nothing happens. There is no changes at all at secpol.msc.
    The log file is a 2 bytes size, with no content (?).
    Does anyone know how this command work, or any other method to import this simple change (just adding the user "CRON" to 'Create a token object') to Security Policies in Windows 7 via command line?

    • EliadTech
      EliadTech about 10 years
      Check the Event viewer to see if there are any errors recorded there.
    • EliadTech
      EliadTech about 10 years
      1. Try running this on a clean Windows VM installation, perhaps something in your system gets in it way. 2. Test this command with slightly different switches, maybe there's something wrong with the syntax. 3. Try monitoring it with ProcMon and see where it falls.
    • alpha_989
      alpha_989 almost 6 years
      @SopalajodeArrierez, I am getting exactly the same issue as you are.. did you figure out what was the problem?
    • Sopalajo de Arrierez
      Sopalajo de Arrierez almost 6 years
      Not yet. Sorry, @alpha_989 .