Set Windows network type public private using powershell

List all network interfaces/profiles: Get-NetConnectionProfile

Find the InterfaceIndex number of the adapter you wish to change, then use the command:

Set-NetConnectionProfile -InterfaceIndex <index number> -NetworkCategory Private
Advertisements

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 “ad.domain.com” -RRType “Ns” -Name “@” -RecordData “server.ad.domain.com.”

and

Remove-DnsServerResourceRecord -ZoneName “_msdcs.ad.domain.com” -RRType “Ns” -Name “@” -RecordData “server.ad.domain.com.”

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

Create a free website or blog at WordPress.com.

Up ↑