Keybase proof
I hereby claim:
- I am windos on github.
- I am windosnz (https://keybase.io/windosnz) on keybase.
- I have a public key ASAfWmAOfO_MviM60G-tNVJBpgl43PTNPJlsiFzi2IyYtQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
Add-Type -Path 'C:\temp\microsoft.toolkit.uwp.notifications.7.0.0\lib\net461\Microsoft.Toolkit.Uwp.Notifications.dll' | |
$CompatMgr = [Microsoft.Toolkit.Uwp.Notifications.ToastNotificationManagerCompat] | |
Register-ObjectEvent -InputObject $CompatMgr -EventName OnActivated -Action { | |
if ($Event.SourceArgs.Argument -eq 'SubmitButton') { | |
switch ($Event.SourceArgs.UserInput.Value) { | |
Item1 { | |
$Text1 = 'GIF: Picard Facepalm' | |
$ImagePath = 'C:\Demos\Gifs\facepalm.gif' | |
} |
# See challenge prompt here: https://jdhitsolutions.com/blog/powershell/8107/scripting-challenge-meetup/ | |
$HelpAbout = help about_Splatting | |
$Words = $HelpAbout -replace '_', ' ' -split '\b' | Where-Object {$_ -match '\w+' -and $_ -ne 'the'} | |
$GroupedWords = $Words | Group-Object | Sort-Object -Property Count -Descending | |
[PSCustomObject] @{ | |
Name = $HelpAbout.Name | |
WordCount = $Words.Count |
# May need to update the "Chrome Driver", run this from the module path (it's not an imported command) | |
# .\Selenium-Binary-Updater.ps1 | |
# Start the driver (this is headless so you shouldn't see anything. Do this once. | |
$StartUri = 'https://www.twitch.tv/' | |
$Driver = Start-SeChrome -Arguments "incognito" -HideVersionHint -StartURL $StartUri -Quiet -Headless | |
# Repeat this part for each profile | |
# Specify the user you're looking for | |
$UserName = 'WindosNZ' |
# Install-Module BurntToast | |
$Text1 = New-BTText -Content 'Help!' | |
$Text2 = New-BTText -Content "Please send help." | |
$Audio1 = New-BTAudio -Source 'ms-winsoundevent:Notification.Mail' | |
# Point the source at a gif that exists... | |
$HeroImage = New-BTImage -Source 'C:\Temp\Help.gif' -HeroImage | |
$Binding1 = New-BTBinding -Children $Text1, $Text2 -AppLogoOverride $Image1 -HeroImage $HeroImage |
# Needs the SharePoint Online PnP module, install if haven't got it already: | |
# Install-Module SharePointPnPPowerShellOnline | |
$Uri = 'https://tenant.sharepoint.com/sites/Common' | |
Connect-PnPOnline -Url $Uri -UseWebLogin | |
$DeletedAt = (Get-Date -Day 24 -Month 05 -Hour 0 -Minute 0 -Second 0) | |
$DeletedBy = 'first.last@tenant.com' |
$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> |
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 | |
$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 |
$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 |