This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Write-LogMessage{ | |
[CmdletBinding()] | |
param ( | |
[Parameter()] | |
[string] $Message, | |
[Parameter()] | |
[string] $LogType = 'Info' | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Test-ExistInEnvPath($fileName) { | |
$envPaths = ($env:Path -split ';') | Where-Object {$_ -ne ''} | |
$envPaths | ForEach-Object { | |
if (Test-Path -Path (Join-Path -Path $_ -ChildPath $fileName)) { | |
Write-Output $true | |
} else { | |
Write-Output $false | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Copy-FileWithStructure($Path,$Destination) { | |
$fileObject = Get-Item -Path $Path | |
$pathParts = ($fileObject.Directory.ToString()).split([System.IO.Path]::DirectorySeparatorChar) | |
$newDestination = Join-Path -Path $Destination -ChildPath (($pathParts | Select-Object -Skip 1) -join([System.IO.Path]::DirectorySeparatorChar)) | |
$script:newPath = $Destination | |
# Loop through and re-create the folder structure | |
foreach ($pathPart in ($pathParts | Select-Object -Skip 1)) { | |
$newPath = Join-Path -Path $newPath -ChildPath $pathPart | |
if (-not(Test-Path -Path $newPath)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function New-Thread { | |
[CmdletBinding()] | |
param ( | |
[Parameter(ValueFromPipeline)] | |
[scriptblock] $Script, | |
# Timeout in seconds | |
[Parameter()] | |
[int] $TimeOut = 60 | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-ADUserTokenGroups { | |
[CmdletBinding()] | |
param ( | |
[Parameter(Position = 0, ValueFromPipeline)] | |
[ValidateNotNullOrEmpty()] | |
[Alias('u','User')] | |
[string] $ADUserName = $env:USERNAME | |
) | |
try { | |
Add-Type -AssemblyName System.DirectoryServices.AccountManagement |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DNS_NAME="some.domain.tld" | |
openssl s_client -connect ${DNS_NAME}:443 -servername ${DNS_NAME} 2>/dev/null </dev/null | openssl x509 -noout -dates -issuer -subject |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-CertInfoHttp { | |
[CmdletBinding()] | |
param ( | |
[Parameter(Position = 0, Mandatory)] | |
[string] $URL, | |
[Parameter()] | |
[switch] $ReturnCertificate | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-CertInfoTcp { | |
[CmdletBinding()] | |
param ( | |
[Parameter(Position = 0, Mandatory)] | |
[string] $ComputerName, | |
[Parameter(Position = 1)] | |
[int] $Port = 443, | |
[Parameter()] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SP_NAME=$1 | |
SP_PW=$2 | |
SP_TENANT=$3 | |
# Authenticate to Azure | |
if [ -z "$SP_NAME" ] || [ -z "$SP_PW" ] || [ -z "$SP_TENANT" ] | |
then | |
LOGIN_RESULT=$(az login) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
IF [%1]==[] ( | |
IF [%2]==[] ( | |
IF [%3]==[] ( | |
az login | |
) | |
) | |
) ELSE ( | |
az login --username %1 --password %2 --tenant %3 --service-principal | |
) |
NewerOlder