Script Creating DNS Records

This script creates Host A records for a list of hosts.

$records = "mimsvc,10.39.0.78","mimsps,10.39.0.78","mimsync,10.36.1.53","mimsvcsql,10.36.1.52","mimspssql,10.36.1.52","mimsyncsql,10.36.1.52"
$DNSServer = "DC"
$Zone = "domain.tld"

foreach ($record in $records)
    {
    $Name = $record.split(",")[0]
    $Ip = $record.split(",")[1]
    
    Add-DnsServerResourceRecordA -ComputerName $DNSServer -ZoneName $Zone -Name $Name -IPv4Address $Ip -PassThru
    }

Set Aging on All DNS Zones

A quick script to set the aging on all zones. In this case it’s only doing reverse lookup zones.

$zones = Get-DnsServerZone -ComputerName dc | ? {($_.IsReverseLookupZone -eq $True) -and ($_.IsDsIntegrated -eq $True)}
    
foreach ($zone in $zones) 
    {
    Set-DnsServerZoneAging -ComputerName dc -Name $zone.zonename -RefreshInterval 4.00:00:00 -NoRefreshInterval 4.00:00:00
    }

Find GPOs that aren’t linked or Don’t Contain Policies

Creates a list of all Group Policy objects that are not linked or don’t have any policies configured.

Import-Module grouppolicy

Write-Host "`nUnlinked GPOs`n"
$allGPOs = Get-GPO -All | sort DisplayName
ForEach ($gpo in $allGPOs) {
    $xml = [xml](Get-GPOReport $gpo.Id xml)
    If (!$xml.GPO.LinksTo) {
        $gpo.DisplayName
        }
    }

Write-Host "`nGPOs with no settings`n"
$allGPOs = Get-GPO -All | sort DisplayName
ForEach ($gpo in $allGPOs) {
    $xml = [xml](Get-GPOReport $gpo.Id xml)
    If ($xml.GPO.LinksTo) {
        If (!$xml.GPO.Computer.ExtensionData -and !$xml.GPO.User.ExtensionData) {
            $gpo.DisplayName
            }
        }
    }