This commit is contained in:
Zack Meier
2026-04-15 15:45:50 -05:00
commit 1d304511b8
613 changed files with 140998 additions and 0 deletions
@@ -0,0 +1,32 @@
<#
.Synopsis
Short description
.DESCRIPTION
Long description
.EXAMPLE
$servers=@"
server1.xyz.com
servers2.xyz.com
@"
$servers = ConvertTo-Array -MultiLineString $servers
.EXAMPLE
Another example of how to use this cmdlet
#>
function ConvertTo-Array {
[CmdletBinding()]
Param
(
[string]
$MultiLineString
)
Begin {
}
Process {
$result = @($MultiLineString -split '[\r\n]+')
}
End {
return $result
}
}
@@ -0,0 +1,43 @@
<#
.SYNOPSIS
A short one-line action-based description, e.g. 'Tests if a function is valid'
.DESCRIPTION
A longer description of the function, its purpose, common use cases, etc.
.NOTES
Information or caveats about the function e.g. 'This function is not supported in Linux'
.LINK
Specify a URI to a help page, this will show when Get-Help -Online is used.
.EXAMPLE
Test-MyTestFunction -Verbose
Explanation of the function or its result. You can include multiple examples with additional .EXAMPLE lines
#>
function Get-SslCertificate {
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[string]$DNSName
)
process {
Write-Verbose "Checking certificate for $DNSName"
$tcp = [Net.Sockets.TcpClient]::new($DNSName, 443)
$ssl = [Net.Security.SslStream]::new(
$tcp.GetStream(),
$false,
{ $true }
)
$ssl.AuthenticateAsClient($DNSName)
$cert = [Security.Cryptography.X509Certificates.X509Certificate2]::new(
$ssl.RemoteCertificate
)
$ssl.Dispose()
$tcp.Dispose()
$cert
}
}
@@ -0,0 +1,49 @@
<#
.Synopsis
Verify AD credentials are valid
.DESCRIPTION
Verify AD credentials are valid ##
.EXAMPLE
Test-ADCredential -Credential <PSCredential>
#>
function Test-ADCredential {
[CmdletBinding()]#
Param
(
[Parameter(Mandatory = $true)]
[PSCredential]
$Credential
)
Begin {
}
Process {
If ($Credential -eq $null) {
Write-Warning "Credentials empty"
$status = $true
}
Else {
$username = $Credential.username
$password = $Credential.GetNetworkCredential().password
$CurrentDomain = "LDAP://" + ([ADSI]"").distinguishedName
Add-Type -AssemblyName System.DirectoryServices.AccountManagement
$DS = New-Object System.DirectoryServices.AccountManagement.PrincipalContext('domain')
#($ValidateCredential = ) | Out-Null
If ($DS.ValidateCredentials($UserName, $Password) -eq $false) {
$password = $null
Write-Error "Invalid credentials or locked account."
$status = $false
}
Else {
$status = $true
}
$password = $null
}
}
End {
}
}
@@ -0,0 +1,50 @@
<#
.SYNOPSIS
Removes old versions of ITD modules
.DESCRIPTION
Long description
.EXAMPLE
Example of how to use this cmdlet
.EXAMPLE
Another example of how to use this cmdlet
.INPUTS
Inputs to this cmdlet (if any)
.OUTPUTS
Output from this cmdlet (if any)
.NOTES
General notes
.COMPONENT
The component this cmdlet belongs to
.ROLE
The role this cmdlet belongs to
.FUNCTIONALITY
The functionality that best describes this cmdlet
#>
function Uninstall-ITDModuleOldVersion {
[CmdletBinding()]
Param
(
)
begin {
}
process {
$InstalledModules = Get-InstalledModule -Name ITD.*
try {
$InstalledModules | ForEach-Object {
$CurrentVersion = $_.Version
Get-InstalledModule -Name $_.Name -AllVersions | Where-Object -Property Version -LT -Value $CurrentVersion
} | Uninstall-Module -Verbose
}
catch {
}
}
end {
}
}
@@ -0,0 +1,33 @@
<#
.SYNOPSIS
A short one-line action-based description, e.g. 'Tests if a function is valid'
.DESCRIPTION
A longer description of the function, its purpose, common use cases, etc.
.NOTES
Information or caveats about the function e.g. 'This function is not supported in Linux'
.LINK
Specify a URI to a help page, this will show when Get-Help -Online is used.
.EXAMPLE
Test-MyTestFunction -Verbose
Explanation of the function or its result. You can include multiple examples with additional .EXAMPLE lines
#>
function Update-ITDModule {
[CmdletBinding()]
param (
)
begin {
}
process {
$InstalledModules = Get-InstalledModule -Name ITD.*
Update-Module -Name $InstalledModules.Name
}
end {
}
}