O365 Skype for Business – Import 3rd Party Conference Credentials

Connect to O365

$cred = Get-Credential
$session = NewCsOnlineSession -Credential $cred -Verbose
Import-PSSession $session

Next, assign the CSV containing the user list to a variable

$accts = Import-Csv "C:\temp\users.csv"

Loop through the accounts in the CSV file and assign the credentials to the users

foreach ($user in $accts) { Set-CsUserAcp -Identity $user.Acct -TollNumber $user.TollNumber -TollFreeNumbers $user.TollFreeNumber -ParticipantPasscode $user.Passcode -Domain "lync.pgi.com" -Name "PGi" -URL "http://www.pgi.com/lynconline/localnums.php" }

If you do not know your Domain or URL, compare with an existing assignment

$user = Get-CsUserAcp

Remove/Add Rights to Shared O365 Mailbox

Full access rights

Add-MailboxPermission -Identity shared@domain.com -User user@domain.com -AccessRights FullAccess -InheritanceType All
Remove-MailboxPermission -Identity shared@domain.com -User user@domain.com -AccessRights FullAccess -IneritanceType All

Send As

Add-RecipientPermission -Identity shared@domain.com -AccessRights SendAs -Trustee user@domain.com
Remove-MailboxPermission -Identity shared@domain.com -AcccessRights SendAs -Trustee user@domain.com

Send on Behalf

Set-Mailbox -Identity shared@domain.com -GrantSendOnBehalfTo @{remove="user@domain.com"}
Set-Mailbox -Identity shared@domain.com -GrantSendOnBehalfTo @{add="user@domain.com"}

Function to add all permissions for User to Shared Mailbox

function addperms ($sharedmb, $user)
Add-MailboxPermission -Identity $sharedmb -User $user -AccessRights FullAccess -InheritanceType All
Add-RecipientPermission -Identity $sharedmb -AccessRights SendAs -Trustee $user
Set-Mailbox -Identity $sharedmb -GrantSendOnBehalfTo @{add="$user"}}

Function to remove all permissions for User to Shared Mailbox

function remperms ($sharedmb, $user)
Remove-MailboxPermission -Identity $sharedmb -User $user -AccessRights FullAccess -InheritanceType All
Remove-RecipientPermission -Identity $sharedmb -AccessRights SendAs -Trustee $user
Set-Mailbox -Identity $sharedmb -GrantSendOnBehalfTo @{remove="$user"}}

Remove/Add Email Address O365

Connect to O365 Exchange Online

Then confirm that the user doesn’t already have the email address

Get-Mailbox user_alias@domain.com

Set-Mailbox user@domain.com -EmailAddresses @{add="user_alias@domain.com"}

Review the assigned addresses

$userAcc = Get-Mailbox user@domain.com

$userAcc.EmailAddresses | fl

To remove an address

Set-Mailbox user@domain.com -EmailAddresses @{remove="user_alias@domain.com"}

Send alert for Windows Service Error

First, we need to create the Powershell script (Source from HowToGeek.com):

$EmailFrom = "emailID@emaildomain.com"
$EmailTo = "destination@somedomain.com"
$Subject = "The subject of your email"
$Body = "What do you want your email to say"
$SMTPServer = "smtp.email.server.address"
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)
$SMTPClient.EnableSsl = $true
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("usr", "pass");
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)

Then we need a script to invoke the powershell script

powershell & "C:\PathToPowerShellScript\myPowerShellEmailScript.ps1"

Finally, modify the service to execute a command on failure:

SC failure serviceName command="C:\PathToBat\MyScript.bat"

Power Query VLOOKUP Function

<pThis is a custom VLOOKUP function for Power Query, created by Ken Puls

let pqVLOOKUP = (lookup_value as any, table_array as table, col_index_number as number, optional approximate_match as logical ) as any =>
/*Provide optional match if user didn't */
matchtype =
if approximate_match = null
then true
else approximate_match,
/*Get name of return column */
Cols = Table.ColumnNames(table_array),
ColTable = Table.FromList(Cols, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
ColName_match = Record.Field(ColTable{0},"Column1"),
ColName_return = Record.Field(ColTable{col_index_number - 1},"Column1"),
/*Find closest match */
SortData = Table.Sort(table_array,{{ColName_match, Order.Descending}}),
RenameLookupCol = Table.RenameColumns(SortData,{{ColName_match, "Lookup"}}),
RemoveExcess = Table.SelectRows(RenameLookupCol, each [Lookup] <= lookup_value),
if Table.IsEmpty(RemoveExcess)=true
then "#N/A"
else Record.Field(RemoveExcess{0},"Lookup"),
/*What should be returned in case of approximate match? */
if Table.IsEmpty(RemoveExcess)=true
then "#N/A"
else Record.Field(RemoveExcess{0},ColName_return),
/*Modify result if we need an exact match */
Return =
if matchtype=true
then ClosestReturn
if lookup_value = ClosestMatch
then ClosestReturn
else "#N/A"
in Return