Home » Posts tagged 'powershell'

Tag Archives: powershell

Microsoft Teams & Skype for Business Online Back-end Provisioning Monitor Script

Working in the Cloud should be fast. But sometimes you just got to wait it out. One of the biggest pain points for me is the lag between licensing a user in Office 365 and Skype for Business Online to complete its back-end provisioning so I can actually start assigning policies and phone number etc.

This delay can range from a minimum of 30 minutes to 24 hours! There is nothing I can do to speed it up and the biggest challenge is providing a predictable experience to the end user. Typically, I want to license and then do something in Skype. With this delay, I am not going to sit around and keep checking when I can actually complete the task. I’m going to do other stuff.

The problem with this is that I am introducing a lag between the back-end ready state and bringing myself back to this task. This could lead to end user realising functionality before I have tailored it to their needs.

Skype Online applies to Microsoft Teams as well. So this is needed if you’re deploying Teams too. Skype for Business Online gives out two properties, assigned plan and provisioned plan. You can access these properties by calling the user object out of PowerShell. Assigned Plan is the core functionality we have given the user based on their Office 365 licenses and Provisioned Plan is the current plan that has been provisioned. There may / will be a drift between these 2 properties when a user is first licensed. This is what takes time to get into sync.

Having been tired of this problem, I created a script that monitors the license provision in Office 365 every 5 minutes, if all assigned Skype licenses return a success the script will continue to Skype Online and check the provisioned plan against these licenses. The script will continue to check the provisioned plan every 5 minutes until all assigned plans return a success. Upon which I can then add my in band configuration commands such as Grant-CsTeamsMeetingPolicy etc.

This now means all I need to do is enter the user’s UPN into the script and hit enter. Simply call the script from the PS window

 .\SkypeProvisioningStatus.ps1 -upn user@mvc-labs.com

Remove User From AzureAD Group Script

Just a quick post to share a simple PowerShell script that will allow administrators to remove a User from an AzureAD Group.

Script will prompt for the UPN of the user that you want to manage and produce a menu list of all their group memberships

Simply enter the number in the square brackets [] when prompted by the script

Connect-AzureAD
$user = Read-Host "Please enter the UPN of the user you want to remove"
$azureUser = Get-AzureADUser -ObjectId $user
$groupMembership = Get-AzureADUserMembership -ObjectId $azureUser.ObjectId
$x = 1
$groupArray = @()
ForEach($grp in $groupMembership){
Write-Host "[$($x)] - $($grp.DisplayName)"
$groupArray += New-Object -TypeName psobject -Property @{Id = $x; GroupId = $grp.ObjectId; GroupName = $grp.DisplayName}
$x++
}
$removeFromGroup = Read-Host "Please enter the ID of the Group you want to remove the user from"
$GroupId = $groupArray | where {$_.Id -eq $removeFromGroup}
Write-Host "Removing $($user) From Group $($GroupId.GroupName)" -ForegroundColor Yellow
$confirm = Read-Host "Are you sure you want to proceed (y/n)?"
if ($confirm -ieq "y"){
Remove-AzureADGroupMember -ObjectId $GroupId.GroupId -MemberId $azureUser.ObjectId
Write-Host "User $($user) has been removed from the group" -ForegroundColor Green
}else{
Write-Host "Process Cancelled, no changes have been made" -ForegroundColor Red
}
Disconnect-AzureAD

Certificate Generator & Request Tool / Script

This tool was born out of my frustrations of having to pre-create certificate requests on servers without IIS or Skype for Business management tools.  A while back I posted an article that showed how to do this through Certreq.exe on any Windows workstation or server. You can see this post here: https://skype4b.uk/2015/05/05/generating-csr-using-certreq-exe/

However, I am bored of having to create an inf file all the time, and there are times where I forget and spend unaffordable minutes of my day wasting time with Google. So this script I have created does all the heavy lifting I need. It allows me to answer some simple questions and then goes off and does it’s thing!

(more…)

Give Your Skype for Business PowerShell Scripts a UI In 10 minutes

First off, this is not really a Skype for Business post, and I do not pretend to be a Dev, so if you are looking for in depth coding then there are others out there who are way better than me. However, I wanted to share with you a method that can be easily adopted to give your PowerShell scripts a nice User Interface.

Previously, designing a UI in PowerShell meant you had to either write hundreds of lines of code referencing the Windows.Forms library, drawing out objects, assigning styles to them etc. etc. Or buy expensive software such as Sapien’s PowerShell Studio that did most of the heavy lifting for you, but you needed to be somewhat of a PowerShell wizard to create even basic scripts. Neither solution for me was ideal, PowerShell Studio just made my head hurt, while going old school and writing line by line was inefficient and often a simple script would bloat out from 50-60 lines of code to easily 2 or 300 lines. This of course may be down to my n00b coding skills but I imagine there are many people out there like me.

Looking around, I found a few projects that had made PowerShell modules you could reference to build your UI, but still there was a dependency on that module being installed on the system the script would eventually run on. I stumbled on a forum post that suggested to use Visual Studio to build your UI and then import it into your PowerShell script.

I have never used Visual Studio before, mainly because I am scared of it and didn’t really know where to start. Plus I am an impatient man, so I just wanted to get things working as fast as I could. However, I was astonished how easy it was.

The process is really simple. Create your UI in Visual Studio using.. you guessed it, a UI to design your UI, drag and drop, select component etc. Once complete copy the code to your PowerShell script, convert into variables, then reference the variables in your code to “do stuff”.

(more…)

Backup your Server Roles and Features

The following short script gathers the installed roles and features on a server and outputs them to PowerShell script that can be used to redeploy them on another server. This can be useful during migration scenarios or when you need to deploy an additional server with the same requirements.

Copy the below code and save it as a ps1 file.

(more…)

Skype for Business 5-minute Admin: Removing Invalid Front Ends from Topology

Have you ever added a Front End server into your topology using just the server name (i.e. Server1) and not the fully qualified domain name (i.e. server1.domain.local)? I have without thinking and published the topology. Easy mistake to make when you are not concentrating. However, you would think that undoing your mistake would be straightforward by removing from the topology and republishing. If you try this you will get an error saying that you cannot remove the server because it contains conferencing data.

To allow the server to be removed you need to delete the conferencing directory first.

First you need to grab the right conference directory identity for the server

Get-CsConferenceDirectory

The identity will be an integer e.g. 5

Then remove the conference directory using

Remove-CsConferenceDirectory –Identity <5> -Force

Once this has been removed you will be able to remove the server from the topology and re-add correctly.

Skype for Business 5 minute Admin: Exporting Archiving Data

Purpose of 5 minute Admin

To provide Skype for Business Administrators with code snippets to help with day to day administration tasks without the need to remember PowerShell commandlets and parameters.

ExportArchivingData.ps1

This script will export archiving data from SQL to a folder of your choice

(more…)

Skype for Business Backup Tool

First off I will admit that this is not ground breaking in terms of no one has done it before. I’ve ummmed and arrrrghhed about releasing this for some time as the backup script by Lasse Wedo is amazing and will do a great job. However, I believe that my script tool brings some added value to the table and offers something a little different. For this reason I have decided it is worth a release to the community.

Overview

The backup tool is a PowerShell script that has several modes of backup, ranging from a full Skype for Business backup to modular backups for backing up policies, or configurations, or topology etc. This script can be run as a scheduled task or ad-hoc using PowerShell. It can be run from a management workstation with the Skype for Business management tools installed or from a front end server. Each backup process has been written as a separate function that allows you to be selective in what you want to backup. When run, the script will create the required root and log directory on the machine using the default path C:\sfb_backup. This can be changed by editing the first few lines of the script.

Features

  • Back up Topology
  • Back up CMS Database
  • Back up Persistent Chat Database
  • Back up User Data
  • Back up File Share
  • Back up All Policies
  • Back up All Configuration
  • Back up Response Groups
  • Send Email to admin on completion (Full Backup Only)
  • Compress Backup file to ZIP (Full Backup Only)
  • Full Logging capabilities
  • Progress indicator

(more…)

Skype for Business – Call via Work Manager

Call via Work (CvW) is the replacement to RCC in Skype for Business. Those wishing to utilise this feature will come to realise that setting the call back number administratively requires a per user based policy. Whilst on the face of it seems rather trivial, imagine having to keep track of potentially hundreds of individual policies? At present there is only one way to manage these policies and that is PowerShell.

To make this feature more accessible and manageable I have created a UI that will display every user who is enabled for CvW and their associated policy configuration.

Features

  • Update user’s call back number
  • Enable, Disable their CvW policy
  • Enforce the use of an admin call back number
  • Update selected user’s or all user’s
  • Remove a user’s CvW Policy
  • Create and Assign new CvW Policies

Current version does not offer a filter capability, currently working on that.

Install Requirements

  • Must be run on workstation / server that has Skype for Business Management Shell

Download

 

Available for Download at: https://gallery.technet.microsoft.com/Skype-for-Business-Call-67ad2b59

Skype for Business – Detailed User Configuration Report

I am pleased to announce and release a new script tool that will allow administrators to export user configuration details from Skype for Business. The script has 3 modes:

  1. User Mode – where administrators can enter the SIP address of the user they want to report on
  2. Domain Mode = where administrators can report on all users who are a member of a specific SIP domain
  3. Enterprise Mode – where administrators can report on all Skype for Business enabled users

The script will produce HTML based reports for each user that can be accessed by a homepage.

(more…)

%d bloggers like this: