Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Cannot set local user account property for PasswordChangeable

$
0
0

I've been using Powershell to automate a lot of what I'm doing in conjunction with my unattend file. I create accounts in the unattend, and then use powershell to set the property "passwordexpires" without issue. However, I can't seem to set the property for "PasswordChangeable", for some unknown reason. I've tried a couple of different methods, based on other posts I've found. Listed below, but none of these work. I need help, and fast please! :)

I tried:

Get-WmiObject -Class Win32_UserAccount -Filter "name = 'MyUser'" | Set-WmiInstance -Argument @{PasswordChangeable = 0}

This results in an error "Set-Wmiinstance " Generic failure at line:1 char:76

I have also tried:

$Acct = Get-WmiObject -Class Win32_UserAccount -Filter "name = 'MyUser'"
$Acct.PasswordChangeable = $false
$Acct.Put()

This results in an error "Exception calling "Put" with "0" argument(s): "Generic failure" at line:3 char:1

What am I doing wrong here folks? The property is listed as one I can change, but yet, I can't seem to. If I replace the "PasswordChangeable" property with "PasswordExpires" in either case, it works just fine.

Please help!

mpleaf


Viewing all articles
Browse latest Browse all 15028

Trending Articles