From 9105bedfaddad80ecab5538435440c1a007a20d9 Mon Sep 17 00:00:00 2001 From: JakubPiegza <45433779+JakubPiegza@users.noreply.github.com> Date: Wed, 29 Jan 2020 23:46:25 +0100 Subject: [PATCH 01/16] Update description.md --- .../description.md | 39 +++++-------------- 1 file changed, 10 insertions(+), 29 deletions(-) diff --git a/Content Types/Content Types Management Setting/Allow content type management for all lists in site collection/description.md b/Content Types/Content Types Management Setting/Allow content type management for all lists in site collection/description.md index bc34af8c..eec2be23 100644 --- a/Content Types/Content Types Management Setting/Allow content type management for all lists in site collection/description.md +++ b/Content Types/Content Types Management Setting/Allow content type management for all lists in site collection/description.md @@ -1,29 +1,17 @@ A short Powershell script to allow management of content types for all SharePoint Online lists and libraries across all sites in a site collection - - -It is an equivalent of List>>List Settings>>Advanced>>Content types in Graphic User Interface (see screenshot) - - - - - - +It is an equivalent of **List**>>**List Settings**>>**Advanced**>>**Content types in Graphic User Interface** ([see screenshot](https://github.com/PowershellScripts/AllGalleryScriptsSamples/blob/develop/Content%20Types/Content%20Types%20Management%20Setting/Allow%20content%20type%20management%20for%20all%20lists%20in%20site%20collection/contentTypeManagement.png)) Applies to lists and libraries. - - -It requires installed SharePoint Online SDK +*It requires installed* [SharePoint Online SDK](www.microsoft.com/en-us/download/details.aspx?id=42038) You have to enter the list information before running the script: - - ```PowerShell # Paths to SDK. Please verify location on your computer. @@ -36,33 +24,26 @@ $AdminPassword="Pass" $Url="https://trialtrial123.sharepoint.com/sites/teamsitewithlists" $ContentTypesEnabled=$true ``` - - - - - -Please share your thoughts in the Q&A section! - - +### Please share your thoughts in the Q&A section! -Wiki article with detailed code description: +#### Wiki article with detailed code description: [SharePoint Online: Turn on support for multiple content types in a list or library using Powershell](http://social.technet.microsoft.com/wiki/contents/articles/30038.sharepoint-online-turn-on-support-for-multiple-content-types-in-a-list-or-library-using-powershell.aspx) -Related scripts -Set-SPOList properties (module) +#### Related scripts +[Set-SPOList properties (module)](https://gallery.technet.microsoft.com/office/Set-SPOList-properties-9d16f2ba) -Disable or enable attachments to list items using Powershell +[Disable or enable attachments to list items using Powershell](https://gallery.technet.microsoft.com/scriptcenter/Disable-or-enable-12cf3795) -Change search setting for all lists in a site using CSOM and Powershell +[Change search setting for all lists in a site using CSOM and Powershell](https://gallery.technet.microsoft.com/scriptcenter/Change-search-setting-for-8e842a48) -Allow content type management for all lists in a site using Powershell +[Allow content type management for all lists in a site using Powershell](https://gallery.technet.microsoft.com/scriptcenter/Allow-content-type-5bca5157) -Set content type management setting for SharePoint Online list using Powershell +[Set content type management setting for SharePoint Online list using Powershell](https://gallery.technet.microsoft.com/scriptcenter/Set-content-type-39ae4bce)

From 0f71c38dedec432b8b64503fddc0949bd0171f8e Mon Sep 17 00:00:00 2001 From: JakubPiegza <45433779+JakubPiegza@users.noreply.github.com> Date: Wed, 29 Jan 2020 23:51:00 +0100 Subject: [PATCH 02/16] Update ContentTypeManagementSubsitesIncluded.ps1 --- .../ContentTypeManagementSubsitesIncluded.ps1 | 87 +++++++++---------- 1 file changed, 39 insertions(+), 48 deletions(-) diff --git a/Content Types/Content Types Management Setting/Allow content type management for all lists in site collection/ContentTypeManagementSubsitesIncluded.ps1 b/Content Types/Content Types Management Setting/Allow content type management for all lists in site collection/ContentTypeManagementSubsitesIncluded.ps1 index 9e762df4..71ad751b 100644 --- a/Content Types/Content Types Management Setting/Allow content type management for all lists in site collection/ContentTypeManagementSubsitesIncluded.ps1 +++ b/Content Types/Content Types Management Setting/Allow content type management for all lists in site collection/ContentTypeManagementSubsitesIncluded.ps1 @@ -3,61 +3,52 @@ # Created by Arleta Wanat, 2015 # -function Set-SPOListsContentTypesEnabled -{ -param ( - [Parameter(Mandatory=$true,Position=1)] +function Set-SPOListsContentTypesEnabled{ + param ( + [Parameter(Mandatory=$true,Position=1)] [string]$Username, [Parameter(Mandatory=$true,Position=2)] [string]$AdminPassword, - [Parameter(Mandatory=$true,Position=3)] + [Parameter(Mandatory=$true,Position=3)] [string]$Url, - [Parameter(Mandatory=$true,Position=4)] + [Parameter(Mandatory=$true,Position=4)] [bool]$ContentTypesEnabled -) - -$password = ConvertTo-SecureString -string $AdminPassword -AsPlainText -Force - $ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url) - $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $password) - $ctx.ExecuteQuery() - -$Lists=$ctx.Web.Lists - $ctx.Load($ctx.Web) - $ctx.Load($ctx.Web.Webs) -$ctx.Load($Lists) -$ctx.ExecuteQuery() - -Foreach($ll in $Lists) -{ - $ll.ContentTypesEnabled = $ContentTypesEnabled - $ll.Update() - - - try - { - $ctx.ExecuteQuery() - Write-Host $ll.Title " Done" -ForegroundColor Green - } - - catch [Net.WebException] - { - - Write-Host "Failed" $_.Exception.ToString() -ForegroundColor Red - } + ) + + $password = ConvertTo-SecureString -string $AdminPassword -AsPlainText -Force + $ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url) + $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $password) + $ctx.ExecuteQuery() + + $Lists=$ctx.Web.Lists + $ctx.Load($ctx.Web) + $ctx.Load($ctx.Web.Webs) + $ctx.Load($Lists) + $ctx.ExecuteQuery() + + Foreach($ll in $Lists){ + $ll.ContentTypesEnabled = $ContentTypesEnabled + $ll.Update() + + try{ + $ctx.ExecuteQuery() + Write-Host $ll.Title " Done" -ForegroundColor Green + } + catch [Net.WebException]{ + Write-Host "Failed" $_.Exception.ToString() -ForegroundColor Red + } + } + + if($ctx.Web.Webs.Count -gt 0){ + Write-Host "--"-ForegroundColor DarkGreen + + for($i=0;$i -lt $ctx.Web.Webs.Count ;$i++){ + Set-SPOListsContentTypesEnabled -Username $Username -Url $ctx.Web.Webs[$i].Url -AdminPassword $AdminPassword -ContentTypesEnabled $ContentTypesEnabled + } + } } -if($ctx.Web.Webs.Count -gt 0) - { - Write-Host "--"-ForegroundColor DarkGreen - for($i=0;$i -lt $ctx.Web.Webs.Count ;$i++) - { - Set-SPOListsContentTypesEnabled -Username $Username -Url $ctx.Web.Webs[$i].Url -AdminPassword $AdminPassword -ContentTypesEnabled $ContentTypesEnabled - } - } - -} - @@ -80,4 +71,4 @@ $ContentTypesEnabled=$true -Set-SPOListsContentTypesEnabled -Username $Username -AdminPassword $AdminPassword -Url $Url -ContentTypesEnabled $ContentTypesEnabled \ No newline at end of file +Set-SPOListsContentTypesEnabled -Username $Username -AdminPassword $AdminPassword -Url $Url -ContentTypesEnabled $ContentTypesEnabled From b3bc53f7b9c36b4d3de5113e16e15a007d47da6c Mon Sep 17 00:00:00 2001 From: JakubPiegza <45433779+JakubPiegza@users.noreply.github.com> Date: Fri, 31 Jan 2020 00:30:13 +0100 Subject: [PATCH 03/16] Update GetCTNamesinAllLists.ps1 --- .../GetCTNamesinAllLists.ps1 | 74 +++++++------------ 1 file changed, 26 insertions(+), 48 deletions(-) diff --git a/Content Types/Get/Get Names of all content types added to your lists/GetCTNamesinAllLists.ps1 b/Content Types/Get/Get Names of all content types added to your lists/GetCTNamesinAllLists.ps1 index d5c99a27..8eef5e5a 100644 --- a/Content Types/Get/Get Names of all content types added to your lists/GetCTNamesinAllLists.ps1 +++ b/Content Types/Get/Get Names of all content types added to your lists/GetCTNamesinAllLists.ps1 @@ -1,64 +1,42 @@  -function Get-SPOList -{ - - param ( - [Parameter(Mandatory=$true,Position=1)] +function Get-SPOList{ + param ( + [Parameter(Mandatory=$true,Position=1)] [string]$Username, [Parameter(Mandatory=$true,Position=2)] $AdminPassword, - [Parameter(Mandatory=$true,Position=3)] + [Parameter(Mandatory=$true,Position=3)] [string]$Url - ) - - $ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url) - $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $AdminPassword) - $ctx.ExecuteQuery() - - $ctx.Load($ctx.Web.Lists) - $ctx.ExecuteQuery() - Write-Host - Write-Host $ctx.Url -BackgroundColor White -ForegroundColor DarkGreen - foreach( $ll in $ctx.Web.Lists) - { + ) - $ctx.Load($ll.ContentTypes) + $ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url) + $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $AdminPassword) + $ctx.ExecuteQuery() - try - { - $ctx.ExecuteQuery() - } - catch - { - } + $ctx.Load($ctx.Web.Lists) + $ctx.ExecuteQuery() + Write-Host + Write-Host $ctx.Url -BackgroundColor White -ForegroundColor DarkGreen + foreach( $ll in $ctx.Web.Lists){ + $ctx.Load($ll.ContentTypes) - - - Write-Host $ll.Title -ForegroundColor Green - - foreach($cc in $ll.ContentTypes) - { - Write-Output $cc.Name - } + try{ + $ctx.ExecuteQuery() + } + catch{} - - + Write-Host $ll.Title -ForegroundColor Green - - - } - - - - } - - + foreach($cc in $ll.ContentTypes){ + Write-Output $cc.Name + } + } +} - - + # Paths to SDK. Please verify location on your computer. @@ -71,4 +49,4 @@ $AdminPassword=Read-Host -Prompt "Password" -AsSecureString $AdminUrl="https://tenant.sharepoint.com/sites/teamsitewithlibraries" -Get-SPOList -Username $Username -AdminPassword $AdminPassword -Url $AdminUrl \ No newline at end of file +Get-SPOList -Username $Username -AdminPassword $AdminPassword -Url $AdminUrl From 48c51aa69736a9ecb39e902d441490763c78d427 Mon Sep 17 00:00:00 2001 From: PowershellScripts <42035526+PowershellScripts@users.noreply.github.com> Date: Tue, 11 Feb 2020 13:24:38 +0200 Subject: [PATCH 04/16] Update GetCTNamesinAllLists.ps1 --- .../GetCTNamesinAllLists.ps1 | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Content Types/Get/Get Names of all content types added to your lists/GetCTNamesinAllLists.ps1 b/Content Types/Get/Get Names of all content types added to your lists/GetCTNamesinAllLists.ps1 index 8eef5e5a..45c10140 100644 --- a/Content Types/Get/Get Names of all content types added to your lists/GetCTNamesinAllLists.ps1 +++ b/Content Types/Get/Get Names of all content types added to your lists/GetCTNamesinAllLists.ps1 @@ -1,5 +1,3 @@ - - function Get-SPOList{ param ( [Parameter(Mandatory=$true,Position=1)] @@ -22,16 +20,17 @@ function Get-SPOList{ foreach( $ll in $ctx.Web.Lists){ $ctx.Load($ll.ContentTypes) - try{ - $ctx.ExecuteQuery() - } - catch{} + try{ + $ctx.ExecuteQuery() + } + catch{ + } Write-Host $ll.Title -ForegroundColor Green - foreach($cc in $ll.ContentTypes){ - Write-Output $cc.Name - } + foreach($cc in $ll.ContentTypes){ + Write-Output $cc.Name + } } } From 9f37fd0fbbb6e7cff94c715e6f1ee7d49c88bf0b Mon Sep 17 00:00:00 2001 From: JakubPiegza <45433779+JakubPiegza@users.noreply.github.com> Date: Thu, 27 Feb 2020 23:36:07 +0100 Subject: [PATCH 05/16] Update description.md --- .../description.md | 34 +++++-------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/Items Management/Attachments/Enable or disable attachments to items of a chosen list/description.md b/Items Management/Attachments/Enable or disable attachments to items of a chosen list/description.md index e17f799d..ae4331ff 100644 --- a/Items Management/Attachments/Enable or disable attachments to items of a chosen list/description.md +++ b/Items Management/Attachments/Enable or disable attachments to items of a chosen list/description.md @@ -1,22 +1,10 @@ -A short Powershell script to set the EnableAttachments property for a SharePoint Online list. The property is responsible for the Attach File icon under new item tab. If you disable the button, you and your users will not be able to add the attachments to list items. +A short Powershell script to set the EnableAttachments property for a SharePoint Online list. The property is responsible for the **Attach File** icon under **new item** tab. If you disable the button, you and your users will not be able to add the attachments to list items. -A short Powershell script to set the EnableAttachments property for a SharePoint Online list. The property is responsible for the Attach File icon under new item tab (see screenshot). The button allows you to add attachments to the list item. - - - - - - - - + If you disable the button, you and your users will not be able to add the attachments to list items: - - - - - + Applies to lists. @@ -24,7 +12,7 @@ Applies to lists. -It requires installed SharePoint Online SDK +It requires installed [SharePoint Online SDK](https://www.microsoft.com/en-us/download/details.aspx?id=42038) You have to enter the list information before running the script: @@ -45,18 +33,14 @@ $ListName="Tasks list" $Attachments =$false ``` -### Related scripts -Set direction of the reading order for a single list +## **Related scripts** +[Set direction of the reading order for a single list](https://gallery.technet.microsoft.com/office/Set-the-direction-of-the-f17ca66a) -Set-SPOList properties (module) - - - - +[Set-SPOList properties (module)](https://gallery.technet.microsoft.com/office/Set-SPOList-properties-9d16f2ba) -### Related article +## **Related article** -SharePoint Online: Disable or enable attachments to list items using Powershell +[SharePoint Online: Disable or enable attachments to list items using Powershell](https://social.technet.microsoft.com/wiki/contents/articles/30024.sharepoint-online-disable-or-enable-attachments-to-list-items-using-powershell.aspx)

From a37898138e7ee68cf6c16318ad913e8920686564 Mon Sep 17 00:00:00 2001 From: JakubPiegza <45433779+JakubPiegza@users.noreply.github.com> Date: Thu, 27 Feb 2020 23:36:41 +0100 Subject: [PATCH 06/16] Update ListAttachments.ps1 --- .../ListAttachments.ps1 | 50 ++++++++----------- 1 file changed, 21 insertions(+), 29 deletions(-) diff --git a/Items Management/Attachments/Enable or disable attachments to items of a chosen list/ListAttachments.ps1 b/Items Management/Attachments/Enable or disable attachments to items of a chosen list/ListAttachments.ps1 index 275e2759..874aabc2 100644 --- a/Items Management/Attachments/Enable or disable attachments to items of a chosen list/ListAttachments.ps1 +++ b/Items Management/Attachments/Enable or disable attachments to items of a chosen list/ListAttachments.ps1 @@ -1,57 +1,49 @@ - + # # Created by Arleta Wanat, 2015 # -function Set-SPOList -{ -param ( +function Set-SPOList{ + param ( [Parameter(Mandatory=$true,Position=0)] - [string]$ListName, + [string]$ListName, [Parameter(Mandatory=$true,Position=1)] - [bool]$Attachments - ) + [bool]$Attachments + ) -$ll=$ctx.Web.Lists.GetByTitle($ListName) + $ll=$ctx.Web.Lists.GetByTitle($ListName) -$ll.EnableAttachments = $Attachments - $ll.Update() + $ll.EnableAttachments = $Attachments + $ll.Update() - try - { + try{ $ctx.ExecuteQuery() Write-Host "Done" -ForegroundColor Green - } - - catch [Net.WebException] - { - - Write-Host "Failed" $_.Exception.ToString() -ForegroundColor Red - } - - + } + catch [Net.WebException] { + Write-Host "Failed" $_.Exception.ToString() -ForegroundColor Red + } } -function Connect-SPOCSOM -{ - param ( - [Parameter(Mandatory=$true,Position=1)] +function Connect-SPOCSOM{ + param ( + [Parameter(Mandatory=$true,Position=1)] [string]$Username, [Parameter(Mandatory=$true,Position=2)] [string]$AdminPassword, [Parameter(Mandatory=$true,Position=2)] [string]$Url -) + ) -$password = ConvertTo-SecureString -string $AdminPassword -AsPlainText -Force + $password = ConvertTo-SecureString -string $AdminPassword -AsPlainText -Force $ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url) $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $password) $ctx.ExecuteQuery() -$global:ctx=$ctx + $global:ctx=$ctx } @@ -78,4 +70,4 @@ $Attachments =$true Connect-SPOCSOM -Username $Username -AdminPassword $AdminPassword -Url $Url -Set-SPOList -ListName $ListName -Attachments $Attachments \ No newline at end of file +Set-SPOList -ListName $ListName -Attachments $Attachments From 8661821bf3f4c9210fe730fb641aab2bcd802757 Mon Sep 17 00:00:00 2001 From: JakubPiegza <45433779+JakubPiegza@users.noreply.github.com> Date: Fri, 28 Feb 2020 01:08:21 +0100 Subject: [PATCH 07/16] Update readme.md --- .../readme.md | 30 ++++--------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/Licensing/Check User Licenses using plan type/readme.md b/Licensing/Check User Licenses using plan type/readme.md index e63ae021..122e9903 100644 --- a/Licensing/Check User Licenses using plan type/readme.md +++ b/Licensing/Check User Licenses using plan type/readme.md @@ -8,15 +8,13 @@ EXCHANGE_S_STANDARD available in Office 365 Business and EXCHANGE_S_ENTERPRISE -If you have multiple subscriptions in your tenant and would like to check a particular service, e.g. only Exchange_S_Enterprise, use the Check user licenses using Service Name script here: +If you have multiple subscriptions in your tenant and would like to check a particular service, e.g. only Exchange_S_Enterprise, use the Check user licenses using Service Name script [here](https://gallery.technet.microsoft.com/Check-user-licenses-using-461b317c). -https://gallery.technet.microsoft.com/Check-user-licenses-using-461b317c +
- - -### How to use? +## **How to use?** -1. Make sure you have installed Azure AD module available here: https://msdn.microsoft.com/en-us/library/azure/jj151815(v=azure.98).aspx +1. Make sure you have installed Azure AD module available [here](https://msdn.microsoft.com/en-us/library/azure/jj151815(v=azure.98).aspx) 2. Download the script and open it (in Notepad, ISE, whatever you prefer). @@ -40,40 +38,24 @@ Plans to choose from. Please enter only one value above * MicrosoftCommunicationsOnline * Exchange - - In $PlanToCheck="Enter the name of the plan you want to check" In $CSVPath leave as it is if you don't want a csv report, or if you do, enter path in inverted commas like in the example below: - ```PowerShell $CSVPath="E:\technet\UsersWithDisabledEXO.csv" ``` - ```$ChecksWhetherThePlanIs ``` if set to "Disable" (as it is) will check for all disabled plans. If you want to check successfully provisioned or pending activation, enter "Success" or "PendingActivation". Important! Disabled are only the services where you assigned the license but not all services are active (e.g. E3 is assigned, but Exchange Online is unmarked). See example below: - - Here the license is disabled: - - - - - + Here it is NOT: - - - - - - - + 4. Save the script and drag&drop it to Powershell. It will ask you for credentials and display a list of users on the screen. From d12c72c6abc0c8d8ef3192d070342e76590eef3f Mon Sep 17 00:00:00 2001 From: JakubPiegza <45433779+JakubPiegza@users.noreply.github.com> Date: Fri, 28 Feb 2020 01:08:59 +0100 Subject: [PATCH 08/16] Update CheckingLicensesWithPlanType.ps1 --- .../CheckingLicensesWithPlanType.ps1 | 30 ++++++++----------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/Licensing/Check User Licenses using plan type/CheckingLicensesWithPlanType.ps1 b/Licensing/Check User Licenses using plan type/CheckingLicensesWithPlanType.ps1 index e2cc800b..04e46cab 100644 --- a/Licensing/Check User Licenses using plan type/CheckingLicensesWithPlanType.ps1 +++ b/Licensing/Check User Licenses using plan type/CheckingLicensesWithPlanType.ps1 @@ -1,4 +1,4 @@ -<# +<# This script works only in limited number of scenarios. If you have more than one subscription, use another script 'CheckLicensesWithServiceName' also published on Technet Gallery ((Get-Msoluser -UserPrincipalName test2@trial765.onmicrosoft.com).licenses.servicestatus | where {$_.ServicePlan.ServiceType -eq "Exchange"}) @@ -31,31 +31,25 @@ Connect-MsolService #Gets the users $Users = Get-MSolUser -All -if($Users -ne $null) -{ -Write-Host "Loaded all users." +if($Users -ne $null){ + Write-Host "Loaded all users." } -else -{ -Write-Host "Couldn't get the users." +else{ + Write-Host "Couldn't get the users." } -if($CSVPath) -{ - Write-Host "Users will be saved to" $CSVPath +if($CSVPath){ + Write-Host "Users will be saved to" $CSVPath } -foreach($user in $users) -{ +foreach($user in $users){ #returns ServicePlan and ProvisioningStatus $serviceStatus=((Get-Msoluser -UserPrincipalName $user.userPrincipalName).licenses.servicestatus | where {$_.ServicePlan.ServiceType -eq $PlanToCheck}) - if($serviceStatus.ProvisioningStatus -eq "Disabled") - { - Write-Host $user.UserPrincipalName - if($CSVPath) - { - Export-Csv -InputObject $user -LiteralPath $CSVPath -Append + if($serviceStatus.ProvisioningStatus -eq "Disabled"){ + Write-Host $user.UserPrincipalName + if($CSVPath){ + Export-Csv -InputObject $user -LiteralPath $CSVPath -Append } } } From 63127743d3e352ceec1788404b65828969ec5398 Mon Sep 17 00:00:00 2001 From: JakubPiegza <45433779+JakubPiegza@users.noreply.github.com> Date: Fri, 28 Feb 2020 01:11:37 +0100 Subject: [PATCH 09/16] Update description.md --- .../description.md | 32 +++++-------------- 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/Licensing/Check user licenses using Service Name/description.md b/Licensing/Check user licenses using Service Name/description.md index f4b3b1d4..62d50337 100644 --- a/Licensing/Check user licenses using Service Name/description.md +++ b/Licensing/Check user licenses using Service Name/description.md @@ -1,9 +1,7 @@ Powershell script to check user licenses by the service name. - - Possible service names: - +``` PROJECTWORKMANAGEMENT SWAY @@ -29,16 +27,16 @@ SHAREPOINTENTERPRISE EXCHANGE_S_STANDARD EXCHANGE_S_ENTERPRISE - +``` - +
-### How to use? +## **How to use?** -1. Make sure you have installed Azure AD module available here: https://msdn.microsoft.com/en-us/library/azure/jj151815(v=azure.98).aspx +1. Make sure you have installed Azure AD module available [here](https://msdn.microsoft.com/en-us/library/azure/jj151815(v=azure.98).aspx). 2. Download the script and open it (in Notepad, ISE, whatever you prefer). @@ -83,29 +81,15 @@ $CSVPath="E:\technet\UsersWithDisabledEXO.csv" Important! Disabled are only the services where you assigned the license but not all services are active (e.g. E3 is assigned, but Exchange Online is unmarked). See example below: - - Here the license is disabled: - - - - - + Here it is NOT: - - - - - - - + 4. Save the script and drag&drop it to Powershell. It will ask you for credentials and display a list of users on the screen. - -

-Enjoy and please share feedback! \ No newline at end of file +Enjoy and please share feedback! From 40029384aff44d9b91301a5d656104634c491375 Mon Sep 17 00:00:00 2001 From: JakubPiegza <45433779+JakubPiegza@users.noreply.github.com> Date: Fri, 28 Feb 2020 01:12:45 +0100 Subject: [PATCH 10/16] Update CheckLicensesWithServiceName.ps1 --- .../CheckLicensesWithServiceName.ps1 | 32 ++++++++----------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/Licensing/Check user licenses using Service Name/CheckLicensesWithServiceName.ps1 b/Licensing/Check user licenses using Service Name/CheckLicensesWithServiceName.ps1 index 74594b95..f4a0ced0 100644 --- a/Licensing/Check user licenses using Service Name/CheckLicensesWithServiceName.ps1 +++ b/Licensing/Check user licenses using Service Name/CheckLicensesWithServiceName.ps1 @@ -1,4 +1,4 @@ - + <# Possible serviceNames: PROJECTWORKMANAGEMENT @@ -36,31 +36,27 @@ Connect-MsolService #Gets the users $Users = Get-MSolUser -All -if($Users -ne $null) -{ -Write-Host "Loaded all users." +if($Users -ne $null){ + Write-Host "Loaded all users." } -else -{ -Write-Host "Couldn't get the users." +else{ + Write-Host "Couldn't get the users." } -if($CSVPath) -{ - Write-Host "Users will be saved to" $CSVPath +if($CSVPath){ + Write-Host "Users will be saved to" $CSVPath } -foreach($user in $users) -{ +foreach($user in $users){ #returns ServicePlan and ProvisioningStatus $serviceStatus=((Get-Msoluser -UserPrincipalName $user.userPrincipalName).licenses.servicestatus | where {$_.ServicePlan.ServiceName -eq $PlanToCheck}) - if($serviceStatus.ProvisioningStatus -eq "Disabled") - { - Write-Host $user.UserPrincipalName - if($CSVPath) - { - Export-Csv -InputObject $user -LiteralPath $CSVPath -Append + + if($serviceStatus.ProvisioningStatus -eq "Disabled"){ + Write-Host $user.UserPrincipalName + + if($CSVPath){ + Export-Csv -InputObject $user -LiteralPath $CSVPath -Append } } } From 1c4b7f33c91e27919e73640c21afa2de22ec3958 Mon Sep 17 00:00:00 2001 From: JakubPiegza <45433779+JakubPiegza@users.noreply.github.com> Date: Fri, 28 Feb 2020 01:16:52 +0100 Subject: [PATCH 11/16] Update description.md --- .../description.md | 33 +++++-------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/Licensing/Export all assigned licenses and services provisioning statuses/description.md b/Licensing/Export all assigned licenses and services provisioning statuses/description.md index 2158b271..fe902cff 100644 --- a/Licensing/Export all assigned licenses and services provisioning statuses/description.md +++ b/Licensing/Export all assigned licenses and services provisioning statuses/description.md @@ -2,22 +2,13 @@ Short Powershell script to export user licenses and services' provisioning statu -The script is a variation on Get user licenses and services' provisioning statuses . It accounts for the fact that one user may have more than one license assigned and creates records per given user's license. +The script is a variation on [Get user licenses and services' provisioning statuses](https://gallery.technet.microsoft.com/scriptcenter/Get-user-licenses-and-f20e5e42) . It accounts for the fact that one user may have more than one license assigned and creates records per given user's license. That means that in the exported csv file, a user with 2 licenses will appear twice, like this: - - - + - - - - - - -How to use? - +## How to use? 1. Download and run the script. @@ -27,28 +18,20 @@ How to use? - - -PowerShell +```PowerShell $CSVPath="C:\Users\Arletka\Documents\usss34.csv" - + ``` -Expected results +## Expected results During script execution: - - - - - + In a csv file: - - - + From 4ffc948052298e10cb11c041b210383cfc19f3e7 Mon Sep 17 00:00:00 2001 From: JakubPiegza <45433779+JakubPiegza@users.noreply.github.com> Date: Fri, 28 Feb 2020 01:18:52 +0100 Subject: [PATCH 12/16] Update GetLicensesProvisioningStatusDoubleLicenses.ps1 --- ...censesProvisioningStatusDoubleLicenses.ps1 | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/Licensing/Export all assigned licenses and services provisioning statuses/GetLicensesProvisioningStatusDoubleLicenses.ps1 b/Licensing/Export all assigned licenses and services provisioning statuses/GetLicensesProvisioningStatusDoubleLicenses.ps1 index ed2aabd4..da3345b1 100644 --- a/Licensing/Export all assigned licenses and services provisioning statuses/GetLicensesProvisioningStatusDoubleLicenses.ps1 +++ b/Licensing/Export all assigned licenses and services provisioning statuses/GetLicensesProvisioningStatusDoubleLicenses.ps1 @@ -17,28 +17,24 @@ Connect-MsolService #Gets the users $Users = Get-MSolUser -All -if($Users -ne $null) -{ -Write-Host "Loaded all users." +if($Users -ne $null){ + Write-Host "Loaded all users." } -else -{ +else{ return "Couldn't get the users." } -if($CSVPath) -{ +if($CSVPath){ Write-Host "Users will be saved to" $CSVPath } # Check each user for licenses -foreach($user in $users) -{ +foreach($user in $users){ # If user has more than 1 license assigned, he will appear twice in the report - foreach($license in (Get-Msoluser -UserPrincipalName $user.userPrincipalName).licenses) - { + + foreach($license in (Get-Msoluser -UserPrincipalName $user.userPrincipalName).licenses){ $ss=$license.ServiceStatus $count=$ss.Count $uss=New-Object PSObject @@ -47,18 +43,17 @@ foreach($user in $users) $uss | Add-Member -MemberType NoteProperty -Name "Office" -Value (Get-Msoluser -UserPrincipalName $user.userPrincipalName).Office # Looping through all the services, like TEAMS1, SharePointWAC, etc. and their statuses - for($i=0;$i -lt $count; $i++) - { - $uss | Add-Member -MemberType NoteProperty -Name $ss[$i].ServicePlan.ServiceName -Value $ss[$i].ProvisioningStatus + + for($i=0;$i -lt $count; $i++){ + $uss | Add-Member -MemberType NoteProperty -Name $ss[$i].ServicePlan.ServiceName -Value $ss[$i].ProvisioningStatus } #Printing out the user info $uss # If the path to CSV is specified, all info will be exported - if($CSVPath) - { - $uss | export-csv $CSVPath -Append -Force + if($CSVPath){ + $uss | export-csv $CSVPath -Append -Force } } } From 35fd652fc016bd24d422be90f32be9b98c36f5ac Mon Sep 17 00:00:00 2001 From: JakubPiegza <45433779+JakubPiegza@users.noreply.github.com> Date: Fri, 28 Feb 2020 01:20:55 +0100 Subject: [PATCH 13/16] Update description.md --- .../description.md | 28 ++++--------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/Licensing/Get user licenses and services provisioning statuses/description.md b/Licensing/Get user licenses and services provisioning statuses/description.md index e53d98f5..c27e86e1 100644 --- a/Licensing/Get user licenses and services provisioning statuses/description.md +++ b/Licensing/Get user licenses and services provisioning statuses/description.md @@ -1,11 +1,6 @@ Short Powershell script to export user licenses and services' provisioning status. - - - - -How to use? - +## How to use? 1. Download and run the script. @@ -15,26 +10,15 @@ How to use? -PowerShell +```PowerShell $CSVPath="C:\Users\Arletka\Documents\usss34.csv" +``` +## Expected results -Expected results - - During script execution: - - - - - + In a csv file: - - - - - - - + From 8705dfc4656644d2a9389d08922483c1c61178bc Mon Sep 17 00:00:00 2001 From: JakubPiegza <45433779+JakubPiegza@users.noreply.github.com> Date: Fri, 28 Feb 2020 01:21:51 +0100 Subject: [PATCH 14/16] Update GetLicensesProvisioningStatus.ps1 --- .../GetLicensesProvisioningStatus.ps1 | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/Licensing/Get user licenses and services provisioning statuses/GetLicensesProvisioningStatus.ps1 b/Licensing/Get user licenses and services provisioning statuses/GetLicensesProvisioningStatus.ps1 index 625add09..467bf5ee 100644 --- a/Licensing/Get user licenses and services provisioning statuses/GetLicensesProvisioningStatus.ps1 +++ b/Licensing/Get user licenses and services provisioning statuses/GetLicensesProvisioningStatus.ps1 @@ -17,42 +17,36 @@ Connect-MsolService #Gets the users $Users = Get-MSolUser -All -if($Users -ne $null) -{ -Write-Host "Loaded all users." +if($Users -ne $null){ + Write-Host "Loaded all users." } -else -{ +else{ return "Couldn't get the users." } -if($CSVPath) -{ +if($CSVPath){ Write-Host "Users will be saved to" $CSVPath } -foreach($user in $users) -{ - +foreach($user in $users){ $ss=(Get-Msoluser -UserPrincipalName $user.userPrincipalName).licenses.servicestatus $count=$ss.Count $uss=New-Object PSObject $uss | Add-Member -MemberType NoteProperty -Name "UPN" -Value $user.UserPrincipalName $uss | Add-Member -MemberType NoteProperty -Name "License" -Value (Get-Msoluser -UserPrincipalName $user.userPrincipalName).licenses.accountskuid $uss | Add-Member -MemberType NoteProperty -Name "Office" -Value (Get-Msoluser -UserPrincipalName $user.userPrincipalName).Office - for($i=0;$i -lt $count; $i++) - { - $uss | Add-Member -MemberType NoteProperty -Name $ss[$i].ServicePlan.ServiceName -Value $ss[$i].ProvisioningStatus + + for($i=0;$i -lt $count; $i++){ + $uss | Add-Member -MemberType NoteProperty -Name $ss[$i].ServicePlan.ServiceName -Value $ss[$i].ProvisioningStatus } $uss - if($CSVPath) - { - $uss | export-csv $CSVPath -Append -Force + + if($CSVPath){ + $uss | export-csv $CSVPath -Append -Force } #(Get-Msoluser -UserPrincipalName $user.userPrincipalName) | select UserPrincipalName, licenses | export-csv C:\Users\Arleta.Wanat\Documents\userrr4.csv -Append -Force #.servicestatus - } From 1011c2b1e805007eb8615de4e5d657929bc4f17c Mon Sep 17 00:00:00 2001 From: JakubPiegza <45433779+JakubPiegza@users.noreply.github.com> Date: Fri, 28 Feb 2020 01:22:55 +0100 Subject: [PATCH 15/16] Update description.md --- .../description.md | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/Licensing/Remove SharePoint Online licenses for all users/description.md b/Licensing/Remove SharePoint Online licenses for all users/description.md index 47cf1ab0..fd1c9252 100644 --- a/Licensing/Remove SharePoint Online licenses for all users/description.md +++ b/Licensing/Remove SharePoint Online licenses for all users/description.md @@ -4,15 +4,7 @@ A short script to remove SharePoint Online license from all the users. The result for all users should be similar to: - - - - - - - - - + The script will ask you for admin credentials. @@ -51,11 +43,11 @@ foreach($user in $Users) -Though a different scenario and on a different occassions, I have been using this article http://blogs.technet.com/b/treycarlee/archive/2013/11/01/list-of-powershell-licensing-sku-s-for-office-365.aspx by Trey Carlee for a long time and the script above would not exist without Trey's initial help. I do recommend his insights for all who struggle with user licensing. +Though a different scenario and on a different occassions, I have been using this [article](http://blogs.technet.com/b/treycarlee/archive/2013/11/01/list-of-powershell-licensing-sku-s-for-office-365.aspx) by [Trey Carlee](https://social.technet.microsoft.com/profile/Trey%20Carlee) for a long time and the script above would not exist without Trey's initial help. I do recommend his insights for all who struggle with user licensing.

-Enjoy and please share your comments and questions! \ No newline at end of file +Enjoy and please share your comments and questions! From 22fd0a6d7567f71028604d73a3e4f7138578aedb Mon Sep 17 00:00:00 2001 From: JakubPiegza <45433779+JakubPiegza@users.noreply.github.com> Date: Fri, 28 Feb 2020 01:23:14 +0100 Subject: [PATCH 16/16] Update NoSpoLicense.ps1 --- .../NoSpoLicense.ps1 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Licensing/Remove SharePoint Online licenses for all users/NoSpoLicense.ps1 b/Licensing/Remove SharePoint Online licenses for all users/NoSpoLicense.ps1 index 64d22504..94770e1f 100644 --- a/Licensing/Remove SharePoint Online licenses for all users/NoSpoLicense.ps1 +++ b/Licensing/Remove SharePoint Online licenses for all users/NoSpoLicense.ps1 @@ -1,4 +1,4 @@ -Connect-MsolService +Connect-MsolService # Disabled Plans $disabledPlans= @() $disabledPlans +="SHAREPOINTENTERPRISE" @@ -14,8 +14,7 @@ $Users = Get-MsolUser -All Write-Host $Plan - foreach($user in $Users) - { + foreach($user in $Users){ Set-MsolUser -UserPrincipalName $user.UserPrincipalName -UsageLocation "US" Set-MsolUserLicense -UserPrincipalName $user.UserPrincipalName -RemoveLicenses $Plan Set-MsolUserLicense -UserPrincipalName $user.UserPrincipalName -AddLicenses $Plan -LicenseOptions $noSPO