Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,26 @@ function DisableADAccountsMenu {
Import-Module PSMenu

# Define the actions
function Disable-KurtisMarsden {
Disable-ADAccount -Identity kurtismarsden.admin
Write-Output "Account kurtismarsden.admin has been disabled."
function Disable-JohnSmith {
Disable-ADAccount -Identity JohnSmith.admin
Write-Output "Account JohnSmith.admin has been disabled."
}
Comment on lines +38 to 41
Copy link

Copilot AI Oct 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoding specific user accounts in a function creates maintenance overhead. Consider making this function more generic by accepting user identities as parameters, or using a configuration file to define the accounts that can be disabled.

Copilot uses AI. Check for mistakes.

function Disable-JamieBeale {
Disable-ADAccount -Identity jamiebeale.admin
Write-Output "Account jamiebeale.admin has been disabled."
function Disable-JackDaniels {
Disable-ADAccount -Identity JackDaniels.admin
Write-Output "Account JackDaniels.admin has been disabled."
}

function Disable-LukeLeigh {
Disable-ADAccount -Identity lukeleigh.admin
Write-Output "Account lukeleigh.admin has been disabled."
function Disable-GeoffGeoffries {
Disable-ADAccount -Identity GeoffGeoffries.admin
Write-Output "Account GeoffGeoffries.admin has been disabled."
}

# Create the menu items
$menuItems = @(
"Disable Kurtis Marsden Account",
"Disable Jamie Beale Account",
"Disable Luke Leigh Account",
"Disable John Smith Account",
"Disable Jack Daniels Account",
"Disable Geoff Geoffries Account",
$(Get-MenuSeparator),
"Exit"
)
Expand All @@ -64,9 +64,9 @@ function DisableADAccountsMenu {

# Use the correct comparison operator and check the value of $Menu
switch ($Menu) {
0 { Disable-KurtisMarsden }
1 { Disable-JamieBeale }
2 { Disable-LukeLeigh }
0 { Disable-JohnSmith }
1 { Disable-JackDaniels }
2 { Disable-GeoffGeoffries }
default { Write-Output "Nothing Selected" }
}
}
Expand Down
Loading