Author: Harri Jaakkonen
Hi, Today a customer call me and said that they cannot connect to meeting. In the Blog below is the fix. https://blogs.technet.microsoft.com/uclobby/2017/05/24/lyncsfb-server-event-41026-ls-data-mcu-after-may-2017-net-framework-update/ And script that does this for You. https://gallery.technet.microsoft.com/LyncSfB-Server-Disable-EKU-dab6cb88
So You see this error in NDR when the message bounces back. In my case I had a normal AD User with mail-attribute populated. Exchange figured out that this user has a mailbox inside the organization. It wasn’t. The user…
Yesterday customer had a problem with Direct Access and Citrix. The situation was … Direct Access worked just fine, but applications published thru XenApp didn’t open. The problem was that Citrix XenApp didn’t send Fully Qualified Domain Name (FQDN) response…
Today I was installing my new Surface Book and installed a clean Windows 10 Creators Update. When I tried to add Microsoft Account to sync the settings from the previous laptop I noticed something weird. Sync settings are greyed out….
Hi, When you try to combine Get-mailbox with Get-MailboxStatistics and export it to csv-file, You will get nothing from the last command. So here is a script that will allow You export the following. From Get-Mailbox = Name From Get-Mailbox =…
Hi, Last time when I had updated Polycom IP-phones I noticed that You cannot login from the browser. So You have to open menus from the phone and allow it. Dumn I must say. http://community.polycom.com/t5/VoIP/FAQ-Since-upgrading-to-UCS-5-1-1-and-running-LYNC-unable-to/td-p/59998 Option 1: In order to…
Add these lines to scheduled tasks and run-as System: Exchange logs older than 7 days:
1 |
gci ‘c:\program files\microsoft\exchange server\V15\Logging’ -Directory | gci -Include ‘*.log’,’*.blg’ -Recurse | ? LastWriteTime -lt (Get-Date).AddDays(-7) | Remove-Item |
IIS logs older than 7 days:
1 |
gci ‘C:\inetpub\logs’ -Directory | gci -Include ‘*.log’,’*.blg’ -Recurse | ? LastWriteTime -lt (Get-Date).AddDays(-7) | Remove-Item |
In Exchange 2013 this worked fine, but with Exchange 2016 You will get “Access Denied” for the…
Jos Lieben wrote a really complex script for automating Onedrive For Business provisioning. http://www.lieben.nu/liebensraum/o365migrator/ We have tested it and it works great. It has the following features. We have tested this script and it really works. Here You can download the…
Hi again, Today I found a script export users and licenses to csv-file. This one worked out nicely 🙂 http://sikkepitje.blogspot.fi/2016/10/get-msoluserlicense.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
<# Get-MsolUserLicense.ps1 makes a report of license type and service plans per use , and saves one Excel-sheet (CSV) per uses license type. Original source: https://gallery.technet.microsoft.com/scriptcenter/Export-a-Licence-b200ca2a?tduid=(26fc5a009171934296bd78c7f4dd6590)(256380)(2459594)(TnL5HPStwNw-0Z3.3otQ5VeALpBrI1CXBg)() created by Alan Byrne modified 20161006 by p.wiegmans@bonhoeffer.nl/sikkepitje@hotmail.com Changed separator from comma to semi-comma, fixes formatting errors whene displayname contains comma (very common). Changed: separate output file , one for each license type. Changed: added timestamp to filename. Changed: Fetching all users once, instead of every license type, givea huge speed boost. #> $VerbosePreference = 'Continue' # Makes verbose meldingen zichtbaar : Modify to your needs # The Reports will be written to files in the current working directory # Connect to Microsoft Online IF NEEDED #write-host "Connecting to Office 365..." #Import-Module MSOnline #Connect-MsolService -Credential $Office365credentials # Get a list of all licences that exist within the tenant $licensetype = Get-MsolAccountSku | Where {$_.ConsumedUnits -ge 1} Write-Verbose "License types are:" $lts = $licensetype| select -expandproperty accountskuid | Format-Table -Autosize | Out-String Write-Verbose $lts Write-Verbose "Getting all users (may take a while) ..." $allusers = Get-MsolUser -all Write-Verbose ("There are " + $allusers.count + " users in total") # Loop through all licence types found in the tenant foreach ($license in $licensetype) { # Build and write the Header for the CSV file $LicenseTypeReport = "Office365_" + ($license.accountskuid -replace ":","_") + "_" + (Get-Date -Format "yyyyMMdd-HHmmss") + ".csv" Write-Verbose ("New file: "+ $LicenseTypeReport) $headerstring = "DisplayName;UserPrincipalName;JobTitle;Office;AccountSku" foreach ($row in $($license.ServiceStatus)) { $headerstring = ($headerstring + ";" + $row.ServicePlan.servicename) } Out-File -FilePath $LicenseTypeReport -InputObject $headerstring -Encoding UTF8 -append write-Verbose ("Gathering users with the following subscription: " + $license.accountskuid) # Gather users for this particular AccountSku $users = $allusers | where {$_.isLicensed -eq "True" -and $_.licenses.accountskuid -contains $license.accountskuid} # Loop through all users and write them to the CSV file foreach ($user in $users) { $thislicense = $user.licenses | Where-Object {$_.accountskuid -eq $license.accountskuid} $datastring = (($user.displayname -replace ","," ") + ";" + $user.userprincipalname + ";" + $user.Title + ";" + $user.Office + ";" + $license.SkuPartNumber) foreach ($row in $($thislicense.servicestatus)) { # Build data string $datastring = ($datastring + ";" + $($row.provisioningstatus)) } Out-File -FilePath $LicenseTypeReport -InputObject $datastring -Encoding UTF8 -append } } write-Verbose ("Script Completed.") |
Hi, Again Johan the author at 365lab.net wrote a nice script. It will change user license based on AD Group Membership.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
<# .SYNOPSIS Script that assigns Office 365 licenses based on Group membership in WAAD. .DESCRIPTION The script assigns of licenses for new users based on groups/licenseSKUs in the $licenses hashtable. It switch licensetype if a user is moved from one group to Another. It removes the license if the user no longer is a member in any of the license assignment Groups. Updated 2015-03-25 to support multiple skus for each user. The script REQUIRES PowerShell 3.0 or later! .NOTES Author: Johan Dahlbom Blog: 365lab.net Email: johan[at]dahlbom.eu The script are provided “AS IS” with no guarantees, no warranties, and they confer no rights. #> #Import Required PowerShell Modules Import-Module MSOnline #Office 365 Admin Credentials $CloudUsername = 'admin@365lab.net' $CloudPassword = ConvertTo-SecureString 'Password' -AsPlainText -Force $CloudCred = New-Object System.Management.Automation.PSCredential $CloudUsername, $CloudPassword #Connect to Office 365 Connect-MsolService -Credential $CloudCred $Licenses = @{ 'E1' = @{ LicenseSKU = 'mstlabs:STANDARDPACK' Group = 'E1_Users' } 'E3' = @{ LicenseSKU = 'mstlabs:ENTERPRISEPACK' Group = 'E3_Users' } } $UsageLocation = 'FI' #Get all currently licensed users and put them in a custom object $LicensedUserDetails = Get-MsolUser -All | Where-Object {$_.IsLicensed -eq 'True'} | ForEach-Object { [pscustomobject]@{ UserPrincipalName = $_.UserPrincipalName License = $_.Licenses.AccountSkuId } } #Create array for users to change or delete $UsersToChangeOrDelete = @() foreach ($license in $Licenses.Keys) { #Get current group name and ObjectID from Hashtable $GroupName = $Licenses[$license].Group $GroupID = (Get-MsolGroup -All | Where-Object {$_.DisplayName -eq $GroupName}).ObjectId $AccountSKU = Get-MsolAccountSku | Where-Object {$_.AccountSKUID -eq $Licenses[$license].LicenseSKU} Write-Output "Checking for unlicensed $license users in group $GroupName with ObjectGuid $GroupID..." #Get all members of the group in current scope $GroupMembers = (Get-MsolGroupMember -GroupObjectId $GroupID -All).EmailAddress #Get all already licensed users in current scope $ActiveUsers = ($LicensedUserDetails | Where-Object {$_.License -eq $licenses[$license].LicenseSKU}).UserPrincipalName $UsersToHandle = '' if ($GroupMembers) { if ($ActiveUsers) { #Compare $Groupmembers and $Activeusers #Users which are in the group but not licensed, will be added #Users licensed, but not, will be evaluated for deletion or change of license $UsersToHandle = Compare-Object -ReferenceObject $GroupMembers -DifferenceObject $ActiveUsers -ErrorAction SilentlyContinue -WarningAction SilentlyContinue $UsersToAdd = ($UsersToHandle | Where-Object {$_.SideIndicator -eq '<='}).InputObject $UsersToChangeOrDelete += ($UsersToHandle | Where-Object {$_.SideIndicator -eq '=>'}).InputObject } else { #No licenses currently assigned for the license in scope, assign licenses to all group members. $UsersToAdd = $GroupMembers } } else { Write-Warning "Group $GroupName is empty - will process removal or move of all users with license $($AccountSKU.AccountSkuId)" #If no users are a member in the group, add them for deletion or change of license. $UsersToChangeOrDelete += $ActiveUsers } #Check the amount of licenses left... if ($AccountSKU.ActiveUnits - $AccountSKU.consumedunits -lt $UsersToAdd.Count) { Write-Warning 'Not enough licenses for all users, please remove user licenses or buy more licenses' } foreach ($User in $UsersToAdd){ #Process all users for license assignment, if not already licensed with the SKU in order. if ((Get-MsolUser -UserPrincipalName $User).Licenses.AccountSkuId -notcontains $AccountSku.AccountSkuId) { try { #Assign UsageLocation and License. Set-MsolUser -UserPrincipalName $User -UsageLocation $UsageLocation -ErrorAction Stop -WarningAction Stop Set-MsolUserLicense -UserPrincipalName $User -AddLicenses $AccountSKU.AccountSkuId -ErrorAction Stop -WarningAction Stop Write-Output "SUCCESS: Licensed $User with $license" } catch { Write-Warning "Error when licensing $User" } } } } #Process users for change or deletion if ($UsersToChangeOrDelete -ne $null) { foreach ($User in $UsersToChangeOrDelete) { if ($user -ne $null) { #Fetch users old license for later usage $OldLicense = ($LicensedUserDetails | Where-Object {$_.UserPrincipalName -eq $User}).License #Loop through to check if the user group assignment has been changed, and put the old and the new license in a custom object. #Only one license group per user is currently supported. $ChangeLicense = $Licenses.Keys | ForEach-Object { $GroupName = $Licenses[$_].Group if (Get-MsolGroupMember -All -GroupObjectId (Get-MsolGroup -All | Where-Object {$_.DisplayName -eq $GroupName}).ObjectId | Where-Object {$_.EmailAddress -eq $User}) { [pscustomobject]@{ OldLicense = $OldLicense NewLicense = $Licenses[$_].LicenseSKU } } } if ($ChangeLicense) { #The user were assigned to another group, switch license to the new one. try { Set-MsolUserLicense -UserPrincipalName $User -RemoveLicenses $ChangeLicense.OldLicense -AddLicenses $ChangeLicense.NewLicense -ErrorAction Stop -WarningAction Stop Write-Output "SUCCESS: Changed license for user $User from $($ChangeLicense.OldLicense) to $($ChangeLicense.NewLicense)" } catch { Write-Warning "Error when changing license on $User`r`n$_" } } else { #The user is no longer a member of any license group, remove license Write-Warning "$User is not a member of any group, license will be removed... " try { Set-MsolUserLicense -UserPrincipalName $User -RemoveLicenses $OldLicense -ErrorAction Stop -WarningAction Stop Write-Output "SUCCESS: Removed $OldLicense for $User" } catch { Write-Warning "Error when removing license on user`r`n$_" } } } } } |