Skip to content

Instantly share code, notes, and snippets.

View markekraus's full-sized avatar
😀

Mark Kraus markekraus

😀
View GitHub Profile
@markekraus
markekraus / AzCmdletMapping.md
Last active February 18, 2024 17:34
Az to AzureRm Cmdlet Mappings

Az to AzureRM command Mappings

Source

Az.Aks

Az Command AzureRm Command
Get-AzAks Get-AzureRmAks
New-AzAks New-AzureRmAks
@markekraus
markekraus / HttpClient-Example.ps1
Created November 25, 2020 21:03
Example using HttpClient in PowerShell
# Create single HttpClient
$client = [System.Net.Http.HttpClient]::new()
# Perform multiple GETs
foreach ($url in $urls) {
$clientResult = $client.GetStringAsync($url).
GetAwaiter().
GetResult()
$clientResult | ConvertFrom-Json
}
@markekraus
markekraus / Change prefix or suffix to Editor ID.pas
Created February 1, 2022 21:49
xEdit script that will change prefixes or suffixes on the EditorID field of every selected record.
{
This script will change prefixes or suffixes on the EditorID field
of every selected record.
Doesn't modify records that already have the correct prefix/suffix.
}
unit UserScript;
var
DoPrepend: boolean;
@markekraus
markekraus / ConvertKMSEncryptedStrings.ps1
Created February 18, 2018 19:41
PowerShell Functions to convert a string to a base64 representation of the KMS encryoted string and to convert back to an unencrypted string
function ConvertTo-Base64KMSEncryptedString {
[CmdletBinding()]
param (
[Parameter(
Mandatory = $true,
ValueFromPipeline = $true
)]
[String[]]
$String,
@markekraus
markekraus / Demo.ps1
Last active May 12, 2021 05:42
Format the Pipeline as Markdown
Invoke-WebRequest 'google.com' | Out-MarkDown
@markekraus
markekraus / Add-SharePointSiteExternalUser.ps1
Last active May 7, 2021 13:56
PowerShell function to invite an external user or list of external users to a SharePoint site
<#
.SYNOPSIS
Invites an external user or list of external users to a SharePoint site.
.DESCRIPTION
Invites an external user or list of external users to a SharePoint site.
External users can be granted View, Edit, or Owner permissions within
the site. A custom e-mail message can be included or the invitation email
can be suppressed.
.PARAMETER SiteURL
URL string of the SharePoint site to which the user(s) will be invited.
@markekraus
markekraus / examples.ps1
Created July 15, 2020 15:11
PowerShell Core HTTP Redircet Capture
# PowerShell 7
$uri = 'https://microsoft.com'
$result = Invoke-WebRequest -SkipHttpErrorCheck -Uri $uri -MaximumRedirection 0 -ErrorAction SilentlyContinue -ErrorVariable $err
$location = $result.Headers.Location
# PowerShell 6
$uri = 'https://microsoft.com'
try {
Invoke-WebRequest -Uri $uri -MaximumRedirection 0 -ErrorAction Stop
} catch {
@markekraus
markekraus / README.md
Last active May 22, 2020 14:41
PSConfBook3 Author Expectations

PSConfBook3 Author Expectations

While we want this to be a fun, collaborative, and creative process, we still wish to produce a high-quality book we can all be proud of, and readers will be happy to purchase. Editing large numbers of chapters, each from different authors is a significant effort. We have the following expectations of our authors to ease the editing process and ensure a baseline of quality.

What does the project expect of the authors?

  • The authors must follow our style and writing guidelines we publish in the GitHub repository.
  • The authors must proofread their chapters at least three (3) times before submitting their final draft.
@markekraus
markekraus / README.md
Last active March 5, 2020 01:54
PSConfBook3 Copyright Information

Copyright Agreement

This document sets forth an understanding of copyright related issues between you, Contributor and the editors of the Book, tentatively titled The PowerShell Conference Book Volume 3. The Book is being developed and sold as a charitable, not-for-profit, venture. Your participation is considered entirely voluntary. Your contributions to the project, which includes your time, written material, and PowerShell code are to be considered charitable contributions. The only Contributor compensation will be one (1) free electronic copy of the Book from the original publisher.

All royalties and income generated from sales of the Book will be contributed to charitable cause. That cause is currently designated to support scholarships as part of the OnRamp program sponsored by The DevOps Collective.

@markekraus
markekraus / ExampleBracketFileUpload.ps1
Created March 6, 2019 02:45
Example of uploading a file with brackets in the name
New-Item -ItemType File -Path 'c:\temp\[a].txt' -value 'Test' -Force
Invoke-RestMethod -InFile 'c:\temp\`[a`].txt' -Method Post -Uri https://httpbin.org/post -ContentType 'text/plain'
<#
Result:
args :
data : Test
files :