This commit is contained in:
2023-07-04 12:59:44 +02:00
parent 2cef42a718
commit 09c2faad93
231 changed files with 261001 additions and 4 deletions

33
Teams/Invoke-Webhook.ps1 Normal file
View File

@ -0,0 +1,33 @@
#Définir l'adresse Webhook du canal Teams
$webhook = ""
#Créer le message
$body = ConvertTo-Json -depth 3 @{
summary = 'Message Teams'
themeColor = '0055DD'
sections = @(
@{
activityTitle = "Titre du message `n"
activityText = "Ceci est un message généré en PowerShell"
}
)
}
#autre exemple de message card
$body = @{
"@type" = "MessageCard"
"@context" = "<http://schema.org/extensions>"
"title" = 'Titre'
"themeColor" = '0055DD'
"text" = "Description"
"sections" = @(
@{
"activityTitle" = 'Titre section'
"activitySubtitle" = 'Sous titre'
"activityText" = 'Texte de la section'
}
)
} | ConvertTo-JSON
#Envoyer le message sur Teams
Invoke-RestMethod -Method post -ContentType 'Application/Json' -Body $body -Uri $webhook

1
Teams/README.md Normal file
View File

@ -0,0 +1 @@
# Teams

View File

@ -0,0 +1,8 @@
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrateur")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit }
$username = '.\Username'
$password = 'Password'
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential $username, $securePassword
Start-Process 'C:\Users\Username\AppData\Local\Microsoft\Teams\Update.exe' '--processStart "Teams.exe"' -Credential $credential