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
# Add required assemblies | |
Add-Type -AssemblyName WindowsBase | |
Add-Type -AssemblyName PresentationCore | |
# Pause to be able to press and hold a key | |
Start-Sleep -Seconds 1 | |
# Key list | |
$Nokey = [System.Windows.Input.Key]::None | |
$key1 = [System.Windows.Input.Key]::LeftCtrl |
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 New-OnPremExchangeSession { | |
param ( | |
[Parameter(ValueFromPipeline = $True, | |
HelpMessage = "Enter preferred Exchange Server")] | |
[ValidateSet('MAIL01', 'MAIL02') ] | |
[string[]]$ComputerName | |
) | |
switch ($ComputerName) { | |
MAIL01 { | |
$Creds = Get-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
jekyll: | |
image: jekyll/jekyll:pages | |
command: jekyll serve --watch --incremental --force_polling | |
ports: | |
- 4000:4000 | |
container_name: blog_server | |
volumes: | |
- ".:/srv/jekyll" | |
- "./vendor/bundle:/usr/local/bundle" |
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 Test-IsAdmin { | |
<# | |
.Synopsis | |
Tests if the user is an administrator | |
.Description | |
Returns true if a user is an administrator, false if the user is not an administrator | |
.Example | |
Test-IsAdmin | |
#> | |
$identity = [Security.Principal.WindowsIdentity]::GetCurrent() |
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
# Display running as Administrator in WindowTitle | |
$whoami = whoami /Groups /FO CSV | ConvertFrom-Csv -Delimiter ',' | |
$MSAccount = $whoami."Group Name" | Where-Object { $_ -like 'MicrosoftAccount*' } | |
$LocalAccount = $whoami."Group Name" | Where-Object { $_ -like 'Local' } | |
#$MSAccount.Split('\')[1] | |
#$env:USERNAME | |
if ((Test-IsAdmin) -eq $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
function Show-IsAdminOrNot { | |
$IsAdmin = Test-IsAdmin | |
if ( $IsAdmin -eq "False") { | |
Write-Warning -Message "Admin Privileges!" | |
} | |
else { | |
Write-Warning -Message "User Privileges" | |
} | |
} |
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 New-AdminTerminal { | |
<# | |
.Synopsis | |
Starts an Elevated Microsoft Terminal. | |
.Description | |
Opens a new Microsoft Terminal Elevated as Administrator. If the user is already running an elevated | |
Microsoft Terminal, a message is displayed in the console session. | |
.Example |
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 New-AdminShell { | |
<# | |
.Synopsis | |
Starts an Elevated PowerShell Console. | |
.Description | |
Opens a new PowerShell Console Elevated as Administrator. If the user is already running an elevated | |
administrator shell, a message is displayed in the console session. | |
.Example |
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 Test-IsAdmin { | |
<# | |
.Synopsis | |
Tests if the user is an administrator | |
.Description | |
Returns true if a user is an administrator, false if the user is not an administrator | |
.Example | |
Test-IsAdmin | |
#> | |
$identity = [Security.Principal.WindowsIdentity]::GetCurrent() |
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 | |
Short function to find recently saved files. | |
.DESCRIPTION | |
Short function that can be used to find/locate recently saved files. | |
Searches are performed by passing the parameters to Get-Childitem which will then | |
recursively search through your specified file path and then perform a sort to output |
NewerOlder