Remove old name server from Windows DNS

You can’t delete name servers from the DNS console. Run this powershell on the dns server.

Remove-DnsServerResourceRecord -ZoneName “” -RRType “Ns” -Name “@” -RecordData “”


Remove-DnsServerResourceRecord -ZoneName “” -RRType “Ns” -Name “@” -RecordData “”

Powershell for loop syntax

$servers = @(“dc1″,”dc2″,”backup”,”server”,”wds”,”wsus”)

foreach ($server in $servers) {
Write-Output “Updating” $server
Invoke-GPUpdate -Computer $server

Reset AD password from PowerShell

Set-ADAccountPassword ‘CN=<User’s Full Name>,OU=something,DC=corp,DC=domain,DC=com’ -Reset -NewPassword (ConvertTo-SecureString -AsPlainText “YourPasswordHere” -Force)

You can get the full CN/OU/DC path by running Get-ADUser <username>

Get all AD users password expiration dates

Get-ADUser -filter {Enabled -eq $True -and PasswordNeverExpires -eq $False} –Properties “DisplayName”,”msDS-UserPasswordExpiryTimeComputed”|Select-Object -Property “Displayname”,@{Name=”ExpiryDate”;Expression={[datetime]::FromFileTime($_.”msDS-UserPasswordExpiryTimeComputed”)}}|Sort-Object ExpiryDate -Descending

Blog at

Up ↑