Jump to content

Account creation, I'm sure this worked before but not anymore.


Recommended Posts

I know there are threads out there for creating local accounts with similar steps and I've used them successfully in the past. When it failed now though I stripped it down to what I assume is the minimum without adding properties or passwords, but still fails and I cannot figure out why.

$oSys = ObjGet("WinNT://" & @ComputerName)
$oUser = $oSys.Create("user", "tester")
$oUser.SetInfo

It fails when autoit thinks SetInfo is a method of the object.

 ==> The requested action with this object has failed.:
$oUser.SetInfo
$oUser^ ERROR

Anyway, I'm using windows 10. Any ideas are appreciated.

Link to comment
Share on other sites

  • Moderators

You are not setting a password, nor (based on what you posted) are you running as Admin. This works just fine for me on Win10:

#RequireAdmin

$oSys = ObjGet("WinNT://" & @ComputerName & "")
$oUser = $oSys.Create("user", "Jimmy")
$oUser.SetPassword("Password1!")
$oUser.SetInfo

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Ah thanks, scite wasn't running with admin apparently and I wasn't actually building the exe to test. I did have setpassword before but took it out when trying to find where they error was coming from.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...