Menu

Powershell

This script will check if the password for a given username is correct.
If the authentication failed using the provided Domain\Username and Password, The script will do some checks and provide clues why the authentication failed.
The checks are:

Domain is reachable.

User Name exists in the domain.

The account is Enabled.

The account is Unlocked.

You can run the script from powershell as .\Test-UserCredentials.ps1 or Right click the script and select “Run with PowerShell”,
The script will ask for the user credentials as Domain\Username, and Password in a friendly Windows authentication window, and report the status of the combination.
Screenshots:

Get User Input:

Example for correct username and password

Example for failed authentication due to: domain is not found/unreachable:

In one of the scripts I came across, The users have to input IP addresses in the form of: IP1,IP2,IP3,…etc. The Powershell script will take this input and build an array to be passed to NETSH and other network commands. The problem is, the users will for different reasons enter the IPs in the form of: IP1, IP2, IP3, … adding an extra space after “,” sometimes there’s a leading or trailing spaces from copy and paste from other places. The result is ==> the network commands was failing to process these extra spaces. Anyway, to solve this, and to avoid similar situations, When you are getting a variable from users, it’s a good practice to do some cleanup, because you will never know what users will enter. One good example, is to utilize –replace parameter with \s to remove all spaces, tabs So:

Working on Windows Server 2008 in a RemoteDesktoption (remote desktop inside remote desktop inside remote desktop), It’s a challenge to point the mouse curser to the exact lower left pixel to open the start menu.

Good News, Just open Powershell, and past this one-liner to simply open the start menu without changing anything or creating any files on the server.

You can replace $_.DNSServerSearchOrder by the required value ( $_.IPAddress, $_.DefaultIPGateway,…..etc)

In on of the rel life examples, I wanted to make a script to modify the DNS settings of Network connections with a specific DNS servers value regardless the name of the connection, so I can run the script on multiple servers. The final script looked something like this: