Aaron
·
August 12, 2023
·
Microsoft, Scripting, Uncategorized
·
Active Directory, AD password reset, Automation, checking password changes, how to check if a user changed their password, how to check if a user has change their password, how to use powershell to check a users password change, IT Admin, Last Login, password reset times, powershell, powershell scripting, simple powershell checking users password, Techtips, User management, Wordpressit
Let’s query Active Directory using PowerShell to determine the last time a user has reset or changed their password. I will use the ‘Get-ADUser’ cmdlet to retrieve user properties and the ‘Get-ADUserResultantPasswordPolicy’ for password last set information. If have documented the script you will find it below.
# Ensure ActiveDirectory module is imported
Import-Module ActiveDirectory
# Define the user you want to check
$user = "username" # replace 'username' with the actual username
# Retrieve user info
$userInfo = Get-ADUser -Identity $user -Properties "PasswordLastSet", "LastLogon", "LastLogonTimestamp"
# Convert the LastLogonTimestamp (which is more reliable) to datetime
$lastLogonDate = [DateTime]::FromFileTime($userInfo.LastLogonTimestamp)
# Display information
Write-Output "User: $($userInfo.SamAccountName)"
Write-Output "Password Last Set: $($userInfo.PasswordLastSet)"
Write-Output "Last Login Time: $lastLogonDate"
Below you will find an example output, I hope this helps and feel free to add, export, or change this as needed.
User: username
Password Last Set: 05/02/2023 16:04:44
Last Login Time: 05/02/2023 16:16:10
Aaron
·
June 20, 2023
·
Microsoft, CMD, Microsoft
·
CMD, cmd prompt, Desktop tips, how to map network drives on Windows, Mapping drives, mapping drives the easy way, mapping network drives, powershell, unreal-labs, Windows 10 drive mapping
Here are three methods specifically for mapping a network drive on a Windows machine.
Using File Explorer
- Open File Explorer by pressing Win + E.
- Click on “This PC” in the left sidebar.
- In the top menu, click on “Map Network Drive”.
- Choose a drive letter from the drop down menu.
- In the “Folder” field, enter the network path of the shared folder you want to map.
- Check the box “Reconnect at sign-in” if you want the map drive to be connecting after you reboot the computer.
- Click “Finish” to complete the drive mapping.
Command Prompt:
- Open Command Prompt by pressing Win + R, typing “cmd” and pressing Enter.
- In the Command Prompt window, type the following command and press Enter.
net use <drive-letter>: \\server\sharedfolder
Replace <drive-letter> with the letter you want to assign to the network drive (e.g., Z:), and \\server\sharedfolder with the actual network path.
- If prompted, provide the username and password for the network location.
- The network drive should now be mapped and accessible through the drive letter you have chosen.
Powershell:
- Open PowerShell by pressing Win + X and selecting “Windows Powershell” or “Windows PowerShell (Admin).”
- In the PowerShell window, type the following command and press Enter.
New-PSDrive -Name <drive-letter> -PSProvider FileSystem -Root \\server\sharedfolder
- If Prompted, provide the username and password for the network location.
- The network drive should now be mapped and available through the drive letter you have chosen.
I have provided you with some ways of mapping a network drive on a Windows system, but remember to replace \\server\sharedfolder with the actual network path you would like to map.