From 307e4719e0d22d729c71074bdf47296a1c71a372 Mon Sep 17 00:00:00 2001 From: silversword411 Date: Thu, 18 Nov 2021 12:23:52 -0500 Subject: [PATCH] wip script - user enable/disabling --- scripts_wip/Win_User_EnableDisable.ps1 | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 scripts_wip/Win_User_EnableDisable.ps1 diff --git a/scripts_wip/Win_User_EnableDisable.ps1 b/scripts_wip/Win_User_EnableDisable.ps1 new file mode 100644 index 00000000..f15ef7f5 --- /dev/null +++ b/scripts_wip/Win_User_EnableDisable.ps1 @@ -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 +}