Collect a network trace without installing Wireshark

Quite often when at a client site it is necessary to collect a sample of network traffic for analysis.  However some clients do not want Wireshark or any 3rd party utilities installed.  Fortunately this can be achieved using netsh.

Continue reading “Collect a network trace without installing Wireshark”

How to find out the password expiry dates for your Active Directory Users

If you want to find out when user’s passwords will expire and export them to a .csv file then this will help.  This simple script will list all of your active users, sort the list and list the expiry dates.

Import-Module ActiveDirectory
Get-ADUser -filter {Enabled -eq $True -and PasswordNeverExpires -eq $False} Properties "SamAccountName","msDS-UserPasswordExpiryTimeComputed" | Select-Object -Property "SamAccountName", @{Name="Password Expiry Date"; Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}} | sort "SamAccountName" | export-csv c:\temp\expire.csv -NoTypeInformation 

 

You can also modify the script so that all you need to do is enter the username and get the expiry date:

Import-Module ActiveDirectory
Add-Type -AssemblyName Microsoft.VisualBasic
$username = [Microsoft.VisualBasic.Interaction]::InputBox('Enter users SamAccountName', 'SamAccountName') 

Get-ADUser $username Properties "SamAccountName","msDS-UserPasswordExpiryTimeComputed" | Select-Object -Property "SamAccountName", @{Name="Password Expiry Date"; Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}} | sort "SamAccountName" | Out-GridView 

 
If you are running the script from a desktop machine ensure that PowerShell is running as admin and that you have the RSAT tools installed.