Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Disable Local user on a 2012 r2 server

$
0
0

I got this figured out on a 2008 server, but it does't work on a 2012 r2.  I would love to get some Ideas of where I can look up figuring out on my own how to get this script working on a 2012 server:

[string ] $userName = "tstest"
[ string] $description = "modified via powershell"
[ string] $computerName = $env:ComputerName
$DisableUser = 2  # ADS_USER_FLAG_ENUM enumeration value from SDK
$User = [ADSI ] "WinNT://$computerName / $userName,User"
$User .description = $description
$User .userflags = $DisableUser
$User .setinfo()  
So how do I get ADSI and where can I learn how to make changes to it in PowerShell?
Can I be walked through the process of figuring out my own problems here?

Viewing all articles
Browse latest Browse all 6937

Trending Articles