Skip to content

Instantly share code, notes, and snippets.

View gravejester's full-sized avatar

Øyvind Kallstad gravejester

View GitHub Profile
function Get-ADUserTokenGroups {
[CmdletBinding()]
param (
[Parameter(Position = 0, ValueFromPipeline)]
[ValidateNotNullOrEmpty()]
[Alias('u','User')]
[string] $ADUserName = $env:USERNAME
)
try {
Add-Type -AssemblyName System.DirectoryServices.AccountManagement
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
function Get-CertInfoHttp {
[CmdletBinding()]
param (
[Parameter(Position = 0, Mandatory)]
[string] $URL,
[Parameter()]
[switch] $ReturnCertificate
)
function Get-CertInfoTcp {
[CmdletBinding()]
param (
[Parameter(Position = 0, Mandatory)]
[string] $ComputerName,
[Parameter(Position = 1)]
[int] $Port = 443,
[Parameter()]
#!/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)
@echo off
IF [%1]==[] (
IF [%2]==[] (
IF [%3]==[] (
az login
)
)
) ELSE (
az login --username %1 --password %2 --tenant %3 --service-principal
)
[System.Diagnostics.CodeAnalysis.SuppressMessage('AvoidUsingPlainTextForPassword', '', Target='ProcessParameter')]
[CmdletBinding()]
param (
[Parameter()]
[Alias('SPName','Username','un')]
[string] $ServicePrincipalName,
[Parameter()]
[Alias('SPPassword','Password','pw')]
[string] $ServicePrincipalPassword,
[CmdletBinding(DefaultParameterSetName = 'Credential')]
param (
[Parameter(ParameterSetName = 'Credential')]
[System.Management.Automation.PSCredential] $Credential,
[Parameter(ParameterSetName = 'ClearText')]
[string] $ApplicationId,
[Parameter(ParameterSetName = 'ClearText')]
[string] $Password,
adm cmd:
install node for windows
- node v6.10.3
- npm 3.10.10
cd c:\..\..\EditorSyntax
npm init
function Update-AzureRmTag {
[CmdletBinding()]
param (
[Parameter(ValueFromPipeline, ValueFromPipelineByPropertyName, Position = 0)]
[string[]] $ResourceId,
[Parameter()]
[hashtable] $Tags = [hashtable]::new()
)