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
$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' |
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
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 | |
} |
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-AuthorizationHeader | |
{ | |
[cmdletbinding()] | |
Param( | |
[Parameter( | |
ValueFromPipeline)] | |
[PSCredential] | |
$Credential | |
) |
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
$CreateFileEndpoint = New-UDEndpoint -Url "/file/" -Method "Post" -Endpoint { | |
Param( | |
$Authorization | |
, | |
$FileName | |
, | |
$Content | |
) | |
$secretBytes = [System.Convert]::FromBase64String(($Authorization -replace "Basic ")) |
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
$GetFileEndpoint = New-UDEndpoint -Url "/file/" -Method "GET" -Endpoint { | |
Param( | |
$Authorization | |
) | |
if ($request.headers.ContainsKey("Authorization")) | |
{ | |
$Authorization = $request.headers["Authorization"].ToString() | |
} |
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
Install-Module -Name UniversalDashboard -Force |
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
$keys = $PSCmdlet.MyInvocation.BoundParameters.Keys | |
foreach ($key in $keys) | |
{ | |
$keyValue = @{ | |
$true = ",$key" | |
$false = "?patchFields=$key" | |
} | |
$queryParams += $keyValue.($PSCmdlet.MyInvocation.BoundParameters.ContainsKey($key)) | |
} |
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
@{ | |
Name = "Tore"; | |
SpecialNumber = 255; | |
StartDate = New-Date 636224205370520563; | |
EndDate = New-Date 637170285370520563; | |
Temperature = 23.11; | |
IsPowershell = $True; | |
} |
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
$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 |
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
Set-Mailbox -Identity $User -GrantSendOnBehalfTo @{remove=$UserAccess} | |
$setMailbox = @{ | |
Identity = $User | |
GrantSendOnBehalfTo = @{ | |
remove = $UserAccess | |
} | |
WhatIf = $true | |
} |