Skip to content

Instantly share code, notes, and snippets.

Tore Groneng torgro

View GitHub Profile
View Get-NumberRange.ps1
function Get-NumberRange
{
[cmdletbinding()]
Param()
DynamicParam {
$Dictionary = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary
$NewDynParam = @{
Name = "Firstnumber"
Alias = "int"
View Get-ChessScore.ps1
function Get-ChessScores
{
[cmdletbinding()]
Param(
[Parameter(ValueFromPipeline)]
[string]$RootPath
)
Begin {
$SharpCode = @'
View Get-LithnetAutoSyncStatus.ps1
function Get-LithnetAutoSyncStatus
{
<#
.Synopsis
Checks the Lithnet AutoSync Execution monitor status
.DESCRIPTION
This command checks the status of the Lithnet AutoSync execution monitor. If the monitor is started it will retun "running". If is
is not running, it will return "stopped". Cmdlet must be executed on host which has the AutoSync service installed.
More information about AutoSync is available here: https://github.com/lithnet/miis-autosync
View log.ps1
function Test-Command
{
[cmdletbinding()]
Param()
write-verbose -Message "Start"
}
function Write-Verbose
{
[cmdletbinding()]
View HelperFunctions.ps1
function Get-AuthorizationHeader
{
[cmdletbinding()]
Param(
[Parameter(
ValueFromPipeline)]
[PSCredential]
$Credential
)
View CreateModule.ps1
$ModuleScript = {
$folders = @('functions', 'private', 'classes')
ForEach ($folder in $folders)
{
$currentPath = $PSScriptRoot | Join-Path -ChildPath $folder
If (Test-Path -Path $currentPath -PathType Container)
{
$functions = Get-ChildItem -Path $currentPath -Filter '*.ps1'
View CreateManifest.ps1
$exportFunctions = (Get-ChildItem -Path .\Functions -Filter "*.ps1").BaseName
$manifestPath = Join-Path -Path .\ -ChildPath FilesAPI.psd1
$newManifest = @{
Path = $manifestPath
Guid = ([guid]::NewGuid())
Author = "SomeDude"
CompanyName = "Contoso"
RootModule = "FilesAPI.psm1"
Description = "Awsome files module"
View Set-FileApi.ps1
function Set-FileApi
{
[cmdletbinding(
SupportsShouldProcess
)]
Param(
[Parameter(Mandatory)]
[hashtable]
$Authorization
,
View NewSet-FileApi.ps1
function Set-FileApi
{
[cmdletbinding(
SupportsShouldProcess
)]
Param(
[Parameter(Mandatory)]
[hashtable]
$Authorization
,
View NewCreateFileEndpoint.ps1
$CreateFileEndpoint = New-UDEndpoint -Url "/file/" -Method "Post" -Endpoint {
Param(
$Authorization
,
$FileName
,
$Content
)
$secretBytes = [System.Convert]::FromBase64String(($Authorization -replace "Basic "))
You can’t perform that action at this time.