Powershell disable ad user

broken image
broken image

The first example keeps the value as an Int32 (signed int -2147483648) whereas the 2nd example that specifies the unsigned representation of the same decimal as an Int64. One wrench in the works is if you need to deal with the byte representation of decimals. The only benefit I see is that the documentation for the API documents the flags as a hex string and reconciling it later is easier than looking at a random number. Yep agree with what you are saying, hex can be stored as a string but when you do something like $var = 0x1 $var would be an Int32 value. Typically I use the Microsoft Assessment and Planning Toolkit to have it identify Days Since Last Activity for both Active Directory Users and Devices. Here are two PowerShell scripts that I wrote and use to disable old Active Directory user or computer accounts.

broken image

NET, POSH is a full-featured task automation framework for distributed Microsoft platforms and solutions. Using PowerShell to disable and move user and computer accounts. Windows PowerShell (POSH) is a command-line shell and associated scripting language created by Microsoft. Submission Guidelines | Link Flair - How To