Create local admin & set password.

Hello!

There are 3 scripts that “kind of” do this.

  1. Manage user accounts in the endpoint using procedure - This one does not allow me to create a custom admin, or allow me to promote a standard user to admin
  2. Enable the admin account and hides the admin account from the login screen. - This one doesn’t allow me to set a password.
  3. Enable the remote control and administrator account. - This one enables RDP on top of enabling an admin account, which I don’t want as a side effect. (personally I think those should be 2 separate scripts.

I am in need of a script to create a local custom admin. The script should allow me to:

  1. Specify local admin name
  2. Specify password

It should be compatible with windows 7, 8, 8.1 and 10.

Hi @Fexception

we analyse your request and update you shortly.
Thank you

I am in need of a script to create a local custom admin. The script should allow me to:

  1. Specify local admin name
  2. Specify password

It should be compatible with windows 7, 8, 8.1 and 10.

Hi @Fexception

Please refer the JSON file to achieve your need.

Let me know your feedback.
Thank you

20180525-Script-to-configure-the-local-account.json (1.51 KB)

Invalid File Specified

Hi @caronet
May we ask where and how do you get that specific message you posted?

The aforementioned link

Hi Fexception

Please refer the JSON file to achieve your need.

20180525-Script-to-configure-the-local-account.json

Hi @caronet
I was able to download the Python script that is attached in @Prabakaran’s post.

Perhaps, the actual Python code will be better. Just create a new procedure in the ITSM Procedures section, copy+paste the code below, edit the necessary variables, and then save. Make sure to run it as a LocalSystem User.

uN = "xxxx"  #provide username for this account
pwd= 'yyyy'  #provide password for this account

import ctypes
import subprocess
import os


class disable_file_system_redirection:
    _disable = ctypes.windll.kernel32.Wow64DisableWow64FsRedirection
    _revert = ctypes.windll.kernel32.Wow64RevertWow64FsRedirection
    def __enter__(self):
        self.old_value = ctypes.c_long()
        self.success = self._disable(ctypes.byref(self.old_value))
    def __exit__(self, type, value, traceback):
        if self.success:
            self._revert(self.old_value)


def createuser():
    with disable_file_system_redirection():
        AddUser= 'net user ' +uN+' '+pwd+ ' /add /passwordreq:yes'
        Createusr=os.popen(AddUser).read()
        acc= 'net localgroup administrators ' + uN + ' /add'
        adminacc=os.popen(acc).read()
        print "successfully executed all the operation "
createuser()

When I create a new procedure with this code, and the try to attach it to a new profile - The procedure does not show up in my procedures list to so I can choose it.

Hi @grahamllewellyn, we have created a ticket for you with regard to your concern. Kindly respond on your convenience for us to investigate.

Also, as a reference, here is a help link on how to create a custom procedure: https://help.comodo.com/topic-399-1-786-10976-Create-a-Custom-Procedure.html#cus_script_proc

A newly created script/procedure needs to be reviewed, and then approved before you can use it.

Thank you Rick C, that was exactly my problem! I’m assuming the above code actually works though :wink: