wip script - user enable/disabling

This commit is contained in:
silversword411 2021-11-18 12:23:52 -05:00
parent 5effae787a
commit 307e4719e0
1 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,29 @@
<#
.SYNOPSIS
Used to enable or disable users
.DESCRIPTION
For installing packages using chocolatey. If you're running against more than 10, include the Hosts parameter to limit the speed. If running on more than 30 agents at a time make sure you also change the script timeout setting.
.PARAMETER Name
Required: Username
.PARAMETER Enabled
Required: yes/no
.EXAMPLE
-Name user -Enabled no
.NOTES
11/15/2021 v1 Initial release by @silversword411
#>
param (
[string] $Name,
[string] $Enabled
)
if (!$Enabled -or !$Name) {
write-output "Missing required parameters. Please include Example: `"-Name username - -Enabled yes/no`" `n"
Exit 1
}
else {
net user $Name /active:$Enabled
Write-Output "$Name set as active:$Enabled"
Exit 0
}