- Short link to this Gist: timw.info/bicep2022
- Tim's website
- Tim's Twitter
- Tim's "Frankenstein" repository
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
<# | |
.Synopsis | |
Facilitates the loading of specific properties of a Microsoft.SharePoint.Client.ClientObject object or Microsoft.SharePoint.Client.ClientObjectCollection object. | |
.DESCRIPTION | |
Replicates what you would do with a lambda expression in C#. | |
For example, "ctx.Load(list, l => list.Title, l => list.Id)" becomes | |
"Load-CSOMProperties -object $list -propertyNames @('Title', 'Id')". | |
.EXAMPLE | |
Load-CSOMProperties -parentObject $web -collectionObject $web.Fields -propertyNames @("InternalName", "Id") -parentPropertyName "Fields" -executeQuery | |
$web.Fields | select InternalName, Id |
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
using namespace System.Net.Http | |
#requires -version 7.2 | |
# This is the bootstrap script for Modules | |
[CmdletBinding(PositionalBinding = $false)] | |
param ( | |
#Specify a specific release to use, otherwise 'latest' is used | |
[string]$Release = 'latest', | |
#Specify the user | |
[string]$User = 'JustinGrote', | |
#Specify the repo |
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
# THIS HASN'T BEEN ADDED TO THE KBUPDATE REPO YET BUT WILL BE WHEN I GET A MOMENT | |
function Install-KbPatch { | |
<# | |
.SYNOPSIS | |
Installs KBs on local and remote servers on Windows-based systems | |
.DESCRIPTION | |
Installs KBs on local and remote servers on Windows-based systems | |
PowerShell 5.1 must be installed and enabled on the target machine and the target machine must be Windows-based |
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
[CmdletBinding(DefaultParameterSetName='Version')] | |
param | |
( | |
[Parameter(ParameterSetName='Latest', Mandatory = $true)] | |
[Parameter(ParameterSetName='Version', Mandatory = $true)] | |
[String] | |
$SaveToPath, | |
[Parameter(ParameterSetName='Version', Mandatory = $true)] | |
[String] |
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
using namespace System.Numerics | |
class Mandelbrot : System.Collections.IEnumerator { | |
# From the constructor? | |
# Sadly, PowerShell doesn't support optional parameters | |
[double]$HorizontalViewOffset = -0.5 | |
[double]$VerticalViewOffset = 0 | |
$Columns = 120 | |
$Rows = 28 | |
$ZoomViewDistance = 6.75 |
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-DirectoryContent { | |
<# | |
.SYNOPSIS | |
Function to get directory content | |
.EXAMPLE | |
Get-DirectoryContent -Path "C:\" -HeaderName "poshserver.net" -RequestURL "http://poshserver.net" -SubfolderName "/" | |
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 Out-JSONView { | |
[cmdletbinding()] | |
Param ( | |
[parameter(ValueFromPipeline)] | |
[psobject]$InbutObject, | |
[int]$Depth = 2 |
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
<# | |
.SYNOPSIS | |
The synopsis goes here. This can be one line, or many. | |
This version of the template has inbuilt functions to capture credentials and store it securely for reuse | |
Avoids the need to have plaintext passwords in the script | |
.DESCRIPTION | |
The description is usually a longer, more detailed explanation of what the script or function does. | |
Take as many lines as you need. |
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
#requires -version 7 -module Microsoft.Graph.Applications | |
using namespace Microsoft.Graph.PowerShell.Models | |
using namespace System.Collections.Generic | |
enum MicrosoftGraphServicePrincipalType { | |
Application | |
Delegated | |
} | |
class MgServicePrincipalPermission { |