Skip to content

Instantly share code, notes, and snippets.

Avatar
🤓

James Callaghan jcallaghan

🤓
View GitHub Profile
View PowerPlatform-GetFlowConnections.ps1
Add-PowerAppsAccount
Get-AdminPowerAppEnvironment
#Get-AdminPowerAppConnection | Where-Object {$_.ConnectionName -like "shared-sharepointonl*" -and $_.DisplayName -notlike "*tenantname*" }| format-table ConnectionName, DisplayName
Get-AdminPowerAppConnection| Select-Object * | Where-Object {$_.ConnectionName -like "shared-sharepointonl*" } | Export-Csv .\FlowConnections.csv -NoTypeInformation
Get-AdminPowerAppConnection| Select-Object * | Export-Csv .\FlowConnections.csv -NoTypeInformation
View PowerPlatform-Commands.ps1
Install-Module -Name Microsoft.PowerApps.Administration.PowerShell
Install-Module -Name Microsoft.PowerApps.PowerShell -AllowClobber
# This call opens prompt to collect credentials (Azure Active Directory account and password) used by the commands
Add-PowerAppsAccount
# Here is how you can pass in credentials (avoiding opening a prompt)
$pass = ConvertTo-SecureString "password" -AsPlainText -Force
Add-PowerAppsAccount -Username foo@bar.com -Password $pass
View TeamsCacheClear.ps1
<#
This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment.
THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. We grant
You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code
form of the Sample Code, provided that You agree: (i) to not use Our name, logo, or trademarks to market Your software
product in which the Sample Code is embedded; (ii) to include a valid copyright notice on Your software product in which the
Sample Code is embedded; and (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims
or lawsuits, including attorneys’ fees, that arise or result from the use or distribution of the Sample Code.
Please note: None of the conditions
View TeamsGuestUsers.ps1
# Created by SAMCOS @ MSFT, Collaboration with others!
## You must first connect to Microsoft Teams Powershell & Exchange Online Powershell for this to work.
## Links:
## Teams: https://www.powershellgallery.com/packages/MicrosoftTeams/1.0.0
## Exchange: https://docs.microsoft.com/en-us/powershell/exchange/exchange-online/connect-to-exchange-online-powershell/connect-to-exchange-online-powershell?view=exchange-ps
## Have fun! Let me know if you have any comments or asks!
$AllTeamsInOrg = (Get-Team).GroupID
$TeamList = @()
Write-Output "This may take a little bit of time... Please sit back, relax and enjoy some GIFs inside of Teams!"
Write-Host ""
View RemovePendingGuestInvites.ps1
# Script requires AAD and CredentialManaer modules, AAD B2b user management permissions
Import-Module AzureADPreview
function Remove-PendingGuestInvites{
Param(
[Parameter(Mandatory=$false,
ValueFromPipeline=$true)]
[switch]
View New-SPContentDatabase.ps1
# Remotely create a number of content databases using New-SPContentDatabase
# https://docs.microsoft.com/en-us/powershell/module/sharepoint-server/new-spcontentdatabase
$SPServers = @("server1")
$webApp = "https://webapp.domain.com"
$databasesRequired = 10
$databasePrefix = "AG5Q_Prefix_Content"
$databaseServer = "DBserver.domain.com"
# Prepare remote PS session and load SP module
@jcallaghan
jcallaghan / Home-Assistant - Air Freshener Deep Sleep.yaml
Created Mar 13, 2020
The following is used to operate the air fresheners when they're in deep sleep mode.
@jcallaghan
jcallaghan / Home-Assistant - Toilet Flush Automation.yaml
Created Mar 13, 2020
This automation is triggered in Home Assistant when the toilet is flushed. It activates the air freshener and also nags through text-to-speech to close the seat lid if it is left open.
View Home-Assistant - Toilet Flush Automation.yaml
alias: 'Bathroom - Toilet flush air freshener + tts'
trigger:
# Trigger when the toilet is flushed usng a sensor on the cistern flush arm.
platform: state
entity_id: binary_sensor.toilet_flusher_contact
to: "on"
action:
@jcallaghan
jcallaghan / ESPHome - Air Freshener Config - Deep Sleep.yaml
Created Mar 13, 2020
This is the ESPHome configuration I've used to enable deep sleep.
@jcallaghan
jcallaghan / Home-Assistant - Sonos Say - Automation.yaml
Last active Mar 13, 2020
I use the following components to play text-to-speech (TTS) on one or many of my Sonos speakers.
View Home-Assistant - Sonos Say - Automation.yaml
# https://www.home-assistant.io/docs/automation/
automation: !include_dir_list ../automations
alias: 'Bathroom - Bath full alarm'
id: bath_full
trigger:
# Trigger when the water sensor in the bath turns on
You can’t perform that action at this time.