Skip to content

Instantly share code, notes, and snippets.

Tore Groneng torgro

Block or report user

Report or block torgro

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View RegisterEndpoint.ps1
Start-UDRestApi -Port 11000 -Endpoint @($CreateFileEndpoint, $GetFileEndpoint)
$securePwd = ConvertTo-SecureString -String bar -AsPlainText -Force
$authKey = [PSCredential]::New("foo", $securePwd) | Get-AuthorizationHeader
$invokeSplat = @{
Uri = "http://localhost:11000/api/file"
Method = 'Get'
Headers = $authKey
}
View HelperFunctions.ps1
function Get-AuthorizationHeader
{
[cmdletbinding()]
Param(
[Parameter(
ValueFromPipeline)]
[PSCredential]
$Credential
)
View CreateFileEndpoint.ps1
$CreateFileEndpoint = New-UDEndpoint -Url "/file/" -Method "Post" -Endpoint {
Param(
$Authorization
,
$FileName
,
$Content
)
$secretBytes = [System.Convert]::FromBase64String(($Authorization -replace "Basic "))
View GetFileEndpoint.ps1
$GetFileEndpoint = New-UDEndpoint -Url "/file/" -Method "GET" -Endpoint {
Param(
$Authorization
)
if ($request.headers.ContainsKey("Authorization"))
{
$Authorization = $request.headers["Authorization"].ToString()
}
View UniversalDashboard.ps1
Install-Module -Name UniversalDashboard -Force
View psboundparameters.ps1
$keys = $PSCmdlet.MyInvocation.BoundParameters.Keys
foreach ($key in $keys)
{
$keyValue = @{
$true = ",$key"
$false = "?patchFields=$key"
}
$queryParams += $keyValue.($PSCmdlet.MyInvocation.BoundParameters.ContainsKey($key))
}
View HashTextObject.ps1
@{
Name = "Tore";
SpecialNumber = 255;
StartDate = New-Date 636224205370520563;
EndDate = New-Date 637170285370520563;
Temperature = 23.11;
IsPowershell = $True;
}
View Hashdata.Object.ps1
$Object = [pscustomobject]@{
Name = "Tore"
SpecialNumber = 255
StartDate = (Get-Date)
EndDate = (Get-Date).AddYears(3)
Temperature = 23.11
IsPowershell = $true
}
$CliXMLlength = [System.Management.Automation.PSSerializer]::Serialize($Object).Length
View SetMailbox.ps1
Set-Mailbox -Identity $User -GrantSendOnBehalfTo @{remove=$UserAccess}
$setMailbox = @{
Identity = $User
GrantSendOnBehalfTo = @{
remove = $UserAccess
}
WhatIf = $true
}
View snapin.psd1
@{
# Script module or binary module file associated with this manifest
ModuleToProcess = 'Microsoft.ResourceManagement.Automation.dll'
# Version number of this module.
ModuleVersion = '1.0'
# ID used to uniquely identify this module
GUID = '73fec12a-fd2a-4ffc-a9e3-9ad6f78bf78b'
You can’t perform that action at this time.