Skip to content

Instantly share code, notes, and snippets.

@AceOfNitwits
AceOfNitwits / Compare-Dns.ps1
Created August 25, 2020 13:47
Monitor for DNS Changes with PowerShell
<#
.SYNOPSIS
Records and compares DNS entries, checking their expected values against their current values.
.DESCRIPTION
DNS entries are stored in XML files in the current path or the path specified by the -BasePath parameter.
When run with the -AddDomain parameter, performs DNS lookups for SOA, NS, MX, TXT, and A records, as well as an A record for the autodiscover host and both an A and CNAME for the www host. Query responses are saved in .XML files in the current path or the path specified by the -BasePath parameter.
When run with the -AddHost (and optional -QueryType) parameter, performs a DNS lookup for the specified host. Query responses are saved in .xml files in the current path or the path specified by the -BasePath parameter.
When run with the -RunComparison parameter, performs DNS lookups for all previously-generated XML files in the current path, or the path specified by the -BasePath parameter. Alerts to any discrepencies found.
@AceOfNitwits
AceOfNitwits / CredentialStorage.psm1
Last active February 6, 2020 17:58
Securely write and read powershell credentials to disk
Function Export-Credentials{
<#
.PARAMETER Path
The full path to the csv file where credentials will be stored.
.DESCRIPTION
Prompts for a username and password, then saves them to a csv file that the user specifies.
The password will be encrypted, and is only usable on the machine and under the user profile in which it was created.
.NOTES