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
Import-Module BurntToast | |
$Text1 = New-BTText -Content 'This is a test' | |
$Text2 = New-BTText -Content 'This more testing' | |
$AppLogo = New-BTImage -Source 'https://raw.githubusercontent.com/Windos/BurntToast/master/Media/BurntToast.png' -Crop Circle -AppLogoOverride | |
$Binding1 = New-BTBinding -Children $Text1, $Text2 -AppLogoOverride $AppLogo | |
$Visual1 = New-BTVisual -BindingGeneric $Binding1 | |
$Content = New-BTContent -Visual $Visual1 | |
$AppId = "{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\WindowsPowerShell\v1.0\powershell.exe" |
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
# For cliackable toast, the toast element needs an activationtype set to protocol and a "launch" argument set to the thing to launch | |
# (be that a website or file, etc.) | |
# Example with BurntToast: https://king.geek.nz/2017/05/08/crouton-clickable/ | |
<?xml version="1.0" encoding="utf-8"?> | |
<toast activationType="protocol" launch="https://google.com"> | |
<visual> | |
<binding template="ToastGeneric"> | |
<text>Google!</text> |
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
$Uri = 'https://king.geek.nz/rss/' | |
$Posts = [System.Collections.ArrayList]::new() | |
$PageNumber = 1 | |
$More = $true | |
while ($More) { | |
try { | |
$Page = Invoke-RestMethod -Uri "$Uri$PageNumber" -ErrorAction Stop | |
} catch { | |
$Page = $null |
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
Import-Module AzureAD | |
Connect-AzureAD | |
# Need to know the License Sku and Service Plan | |
# It is possible to get this from the module itself | |
Get-AzureADSubscribedSku | select SkuId, SkuPartNumber, ServicePlans | |
# May be easier to get online: https://docs.microsoft.com/en-us/azure/active-directory/users-groups-roles/licensing-service-plan-reference |
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
$Files = Get-ChildItem -Path 'C:\Temp' -Filter "*.tsv" -Recurse | |
$Directories = $Files | Group-Object -Property 'DirectoryName' | |
foreach ($Directory in $Directories) { | |
$Outfile = Join-Path -Path $Directory.Name -ChildPath '\HTML-File-Name.html' | |
# Start your HTML file here, add CSS or headings. | |
foreach ($File in $Directory.Group) { | |
Import-Csv -Delimiter "`t" -Path $File.FillName | ConvertTo-Html | Out-File -FilePath $Outfile -Append |
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
$Files = Get-ChildItem -Path C:\Temp -Recurse -File | |
$SplitFiles = @() | |
foreach ($File in $Files) { | |
$SplitFiles += ,$File.FullName.Split('\') | |
} | |
$NumColumns = ($SplitFiles | Measure-Object -Maximum -Property Count).Maximum |
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
$Users = Get-ADUser -Filter 'Enabled -eq $true' | |
$GroupNames = (Get-ADGroup -Filter * | | |
Where-Object {$_.DistinguishedName -notlike '*CN=Builtin,*'}).Name | |
$Report = foreach ($User in $Users) { | |
$Groups = Get-ADPrincipalGroupMembership -Identity $User.DistinguishedName | |
$ReportProp = [Ordered] @{ | |
'Name' = $User.DisplayName | |
'Username' = $User.SamAccountName |
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
break | |
#region Null Coalescing Operator (??) | |
# Returns value on the left if it's not null | |
# Otherwise the right had side is evaluated and returned | |
$Left ?? $Right | |
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
$XmlString = @" | |
<toast> | |
<visual> | |
<binding template="ToastGeneric"> | |
<text>Default Notification</text> | |
<image src="C:\Program Files\PowerShell\7\assets\Powershell_av_colors.ico" placement="appLogoOverride" /> | |
</binding> | |
</visual> | |
<audio src="ms-winsoundevent:Notification.Default" /> | |
</toast> |