add pode and api scripts

This commit is contained in:
Alex Kup 2023-10-14 12:06:13 +03:00 committed by GitHub
parent 30a3d7711e
commit 94bc297ea1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 783 additions and 3 deletions

View file

@ -0,0 +1,42 @@
function Get-RemoteDNS {
<#
.SYNOPSIS
Module for remote view zones DNS, as well view and remove records
Using module DNS Server (from RSAT set) via Invoke-Command (module installation is not required)
.DESCRIPTION
Example:
Get-RemoteDNS dc-01
.LINK
https://github.com/Lifailon
#>
Param (
$srv
)
if (!$srv) {
Write-Host (Get-Help Get-RemoteDNS).DESCRIPTION.Text -ForegroundColor Cyan
return
}
$zone = icm $srv {Get-DnsServerZone} | select ZoneName,ZoneType,DynamicUpdate,ReplicationScope,SecureSecondaries,
DirectoryPartitionName | Out-GridView -Title "DNS Server: $srv" PassThru
$zone_name = $zone.ZoneName
if ($zone_name -ne $null) {
$A = icm $srv {
Get-DnsServerResourceRecord -ZoneName $using:zone_name | sort RecordType | select RecordType,HostName, @{
Label="IPAddress"; Expression={$_.RecordData.IPv4Address.IPAddressToString}},TimeToLive,Timestamp
} | select RecordType,HostName,IPAddress,TimeToLive,Timestamp | Out-GridView -Title "DNS Server: $srv | Zone: $zone_name" PassThru
}
if ($A -ne $null) {
$RT = $A.RecordType
$HN = $A.HostName
$wshell = New-Object -ComObject Wscript.Shell
$output = $wshell.Popup("Romove record $HN (type: $RT)",0,"Select",4)
if ($output -eq 6) {
icm $srv {
Remove-DnsServerResourceRecord -ZoneName $using:zone_name -RRType $using:RT -Name $using:HN Force
}
}
if ($output -eq 7) {
Write-Host "Canceled"
}
}
}