Create a local User on my notebook (Access Denied)


hello together,

i trying to compile script capable of creating local user on notebook.

this have:

$computer = [adsi]"winnt://$env:computername,computer"$testuser = $computer.create("user", "test user")$testuser.setpassword("123qazwsx")$testuser.setinfo()

unfortunately, following error message:

------------------------------------------------------------------------------------

exception calling "setinfo" "0" argument(s): "access denied.
"
@ line:1 char:18
+ $testuser.setinfo <<<< ()
    + categoryinfo          : notspecified: (:) [], methodinvocationexception
    + fullyqualifiederrorid : catchfrombaseadaptermethodinvoketi

------------------------------------------------------------------------------------

does may know why system doesnt grant access?

thank in advance.

regards

powershell junior


have tried running script elevated prompt?

grant ward, a.k.a. bigteddy

what's new in powershell 3.0 (technet wiki)



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

for loop and start-job from cmd.exe

Edit Group Policy

File Share Witness is not a valid File share path