Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ChatOps for Microsoft Identity Manager - Teams Configuration and Start Script. https://blog.darrenjrobinson.com/chatops-for-microsoft-identity-manager/
# Install Poshbot PowerShell Module if it doesn't already exist
if (-not (Get-Module -Name "Poshbot")) {
install-module Poshbot
}
# Install LithnetRMA PowerShell Module if it doesn't already exist
if (-not (Get-Module -Name "LithnetRMA")) {
install-module LithnetRMA
}
# Install LithnetMIISAutomation PowerShell Module if it doesn't already exist
# The following module is required on your MIM Sync Server. Execute the following there and enable Remote PowerShell.
# See https://blog.darrenjrobinson.com/remotely-managing-your-fimmim-synchronisation-server-using-powershell-and-the-lithnet-miis-automation-powershell-module/
#if (-not (Get-Module -Name "LithnetMIISAutomation")) {
# install-module LithnetMIISAutomation
#}
# Check to see if the Lithnet PostBot RMA Module has been installed
if (-not (Get-Module -Name "PoshBot.LithnetRMA")) {
install-module "PoshBot.LithnetRMA"
}
# Check to see if the Lithnet PostBot MIIS Automation Module has been installed
if (-not (Get-Module -Name "Poshbot.LithnetMiisAutomation")) {
install-module "Poshbot.LithnetMiisAutomation"
}
Import-Module PoshBot
$pbc = New-PoshBotConfiguration
$pbc.BotAdmins = @('MIMGuy@mydomain.com.au')
$pbc.AlternateCommandPrefixes = @('lithnet')
$pbc.PluginConfiguration = @{
'PoshBot.LithnetRMA' = @{
MIMServiceCreds = import-clixml C:\poshbot\MIMAdminSyncCred.xml
MIMServiceAddress = 'http://mimserviceserver:5725'
}
'PoshBot.LithnetMIISAutomation' = @{
MIMSyncCreds = import-clixml C:\Scripts\poshbot\poshbot\MIMAdminSyncCred.xml
MIMSyncAddress = 'mimsyncserver.yourdomain.com' #Must be FQDN
}
}
$PoshbotPath = 'C:\poshbot'
$PoshbotConfig = Join-Path $PoshbotPath config.psd1
$PoshbotPlugins = Join-Path $PoshbotPath plugins
$PoshbotLogs = Join-Path $PoshbotPath logs
$backendConfig = @{
Name = 'TeamsPoshBotBackend'
BotName = 'IdentityBot'
TeamId = '19:162a04c26def41dea1234567890@thread.skype'
ServiceBusNamespace = 'identitybotsb'
QueueName = 'messages'
AccessKeyName = 'receive'
AccessKey = '0a+8ElzKS9F1/iieCZpRC3RtAEBboh0hABCDEFG=' | ConvertTo-SecureString -AsPlainText -Force
Credential = [pscredential]::new('f2b1a38f-0622-4eab-a502-1234567890',('j3*FtBRr4-OR0R/I2oMxd-[ABCDEFG' | ConvertTo-SecureString -AsPlainText -Force)
)
ConfigurationDirectory = $PoshbotPath
LogDirectory = $PoshbotLogs
PluginDirectory = $PoshbotPlugins
}
$backend = New-PoshBotTeamsBackend -Configuration $backendConfig
$bot = New-PoshBotInstance -Configuration $pbc -Backend $backend
$bot | Start-PoshBot -Debug -Verbose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.