Public/Disable-Account.ps1

function Disable-Account {

    <#
    -Taylor Lee
    Modified 05172019
 
    .DESCRIPTION
    Disables a specified Active Directory Account
 
    .NOTES
    Requires the Active Directory Module
 
    .Parameter Account
    Account that is being disabled
 
    .EXAMPLE
    Use the Samaccountname of the account being disabled
 
    Disable-ADAccount -Account JohnDoe
 
    .EXAMPLE
    Use the DistinguishedName of the account being disabled
 
    Disable-ADAccount -Account "CN=John Doe,OU=Finance,OU=UserAccounts,DC=FABRIKAM,DC=COM"
 
    .EXAMPLE
    -Use the UserPrincipalName of the account being disabled
 
    Disable-ADAccount -Account JohnD@Company.com
 
    .Link
    https://github.com/TheTaylorLee/AdminToolbox
    #>


    [CmdletBinding()]

    Param (
        [Parameter(Mandatory = $true)]$Account
    )

    #Check For Admin Privleges
    Get-Elevation

    Import-Module ActiveDirectory

    Disable-ADAccount -Identity $Account -Confirm
}