View TeslaCam.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
Format-Volume -DriveLetter G -FileSystem FAT32 -Full -Force | |
New-Item -Path G:\ -Name 'TeslaCam' -Type Directory |
View prompt.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
$forePromptColor = 0 | |
[System.Collections.Generic.List[ScriptBlock]]$global:PromptRight = @( | |
# right aligned | |
{ "$FG;${er}m{0}" -f $LeftArrow } | |
{ "$FG;${forePromptColor}m$BG;${er}m{0}" -f $(if (@(get-history).Count -gt 0) {(get-history)[-1] | % { "{0:c}" -f (new-timespan $_.StartExecutionTime $_.EndExecutionTime)}}else {'00:00:00.0000000'}) } | |
{ "$FG;7m$BG;${er}m{0}" -f $LeftArrow } | |
{ "$FG;0m$BG;7m{0}" -f $(get-date -format "hh:mm:ss tt") } | |
) |
View Infrastructure as Code: Azure AD Group Creation
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
# Pester testing | |
## Prep work | |
## Depends - Pester, AzureADPreview, and xAzureAD.DirectorySettings modules | |
## Get original values - Get-AzureADDirectorySetting -Name Group.Unified | Export-Csv <Path> -NoTypeInformation | |
$ExpectedSettings = Import-Csv <Path> | |
Describe 'Azure AD Group Creation Settings' { | |
$ActualSettings = Get-AzureADDirectorySetting -Name Group.Unified |
View Never ending while loop
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
While ($True) { | |
Write-Output "This is my output" | |
Get-Date | |
Start-Sleep -s 300 # Sleep for 5 minutes | |
} |
View Get-Food
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-Food { | |
Param( | |
[Parameter(ValueFromPipeline)] | |
[String[]]$Types | |
) | |
$Seed = Get-Random -Minimum 0 -Maximum $($Types.Count - 1) | |
Write-Output $Types[$Seed] | |
} |
View Tacos or Gyros
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-TacosOrGyros { | |
$Seed = Get-Random -Minimum 0 -Maximum 100 | |
If(($Seed % 2) -eq 0) { | |
Write-Output "Tacos" | |
} Else { | |
Write-Output "Gyros" | |
} | |
} |
View Verbose examples
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-CmdletbindingExample { | |
[CmdletBinding()] | |
Param ( | |
[String[]]$Name | |
) | |
Begin {# Runs once} | |
Process { | |
# Runs for each instance of $Name |
View Cmdletbinding Function
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-CmdletbindingExample { | |
[CmdletBinding()] | |
Param ( | |
[String[]]$Name | |
) | |
Begin {# Runs once} | |
Process {# Runs for each instance of $Name} | |
View Connect-MicrosoftTeams
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
Connect-MicrosoftTeams |
View JoinedTeams
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
/beta/me/joinedTeams |
NewerOlder