Kaseya Community

Adding Windows user script

This question has suggested answer(s)

Does anyone have a script for adding users locally and in Active Directory?

I am working on something but I need some less convoluted ideas than the ones I am coming up with.

All Replies
  • Can you be a little more specific on what you accually need done?

    There are alot of ways to create users in AD.

    DSadd (built in Windows program)

    VBscript (Lots of Utilities out there for this)

    PowerShell (very powerfull and great for windows 2008 servers)

    I recommend checking out a few books on Active Directory.

  • Easy enough, you can use the Execute Command Shell option and the "net user", "net group" and "net localgroup" commands to add local and domain users.

    The main question will it be the same user accounts for multiple sites or different users for a site. If it is the latter then you will need to go with a VB script that grabs the user accounts out of CSV/excel file in which case it is not really worth scripting in Kaseya unless you do these rollouts very often.

  • I am having problems trying to execute "net user" on Windows 7.  It seems to come back with results and errors (if I run with no parameters).  Any tips?

  • Make sure u run your net user as a AD Admin account (use creds and execute as user)

    I have used this to auto generate and auto change passwords for my clients sites

  • This is for a Workgroup (I have many small clients without AD). I changed my script to "Use Credential" and all subsequent steps to "Execute as the logged on user" and that has done the trick. Thanks so much :-)


    [edited by: Simon Wong at 11:33 PM (GMT -7) on 9-9-2010]
  • Glad I could help

  • -----

    <?xml version="1.0" encoding="utf-8"?>
    <ScriptExport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.kaseya.com/vsa/2008/12/Scripting">
      <Procedure name="NET USER (ADD)" treePres="3">
        <Body>
          <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">
            <Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue" />
            <Parameter xsi:type="StringParameter" name="SourceContent" value="Bob" />
            <Parameter xsi:type="StringParameter" name="VariableName" value="USER" />
          </Statement>
          <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">
            <Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue" />
            <Parameter xsi:type="StringParameter" name="SourceContent" value="t3st3r31" />
            <Parameter xsi:type="StringParameter" name="VariableName" value="PASS" />
          </Statement>
          <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">
            <Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue" />
            <Parameter xsi:type="StringParameter" name="SourceContent" value="Users" />
            <Parameter xsi:type="StringParameter" name="VariableName" value="GROUP" />
          </Statement>
          <Statement description="Use the user logon credentials set for the machine ID to execute a file or shell command - Windows 2000 and above only." name="UseCredential" continueOnFail="false" />
          <Statement description="Execute the given command as if it were typed in at a command prompt." name="ExecuteShellCommand" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">
            <Parameter xsi:type="StringParameter" name="Command" value="NET USER #USER# #PASS# /ADD" />
            <Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="User" />
            <Parameter xsi:type="BooleanParameter" name="Is64Bit" value="False" />
          </Statement>
          <Statement description="Execute the given command as if it were typed in at a command prompt." name="ExecuteShellCommand" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">
            <Parameter xsi:type="StringParameter" name="Command" value="NET LOCALGROUP &quot;#GROUP#&quot; #USER# /ADD" />
            <Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="User" />
            <Parameter xsi:type="BooleanParameter" name="Is64Bit" value="False" />
          </Statement>
        </Body>
      </Procedure>
    </ScriptExport>

    -----



    [edited by: HardKnoX at 2:15 AM (GMT -7) on 9-10-2010]
  • Thanks again!  I think my problems were compounded with the fact that the Administrator account was not active on this particular machine (WIndows 7).

  • Check out this post: community.kaseya.com/.../793.aspx