Author: Harri Jaakkonen
Hi all, Public Folders and Hybrid mode. Not really a hybrid mode cause all mailboxes reside in the Cloud, also PF Mailboxes. First set Default PF for all mailboxes.
1 |
Get-Mailbox -ResultSize Unlimited -RecipientTypeDetails usermailbox | set-mailbox –defaultpublicfoldermailbox o365PFmailbox |
When sending email from outside organization sender will get. 550…
Hi, When You migrate from a local fileshare, You will have a problem with recursive permissions from parent object. Here is script that can scan thru large library (5000+ items) and reset recursive permissions to them.
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 |
function Restore-SPOListAllItemsInheritance { param ( [Parameter(Mandatory=$true,Position=1)] [string]$Username, [Parameter(Mandatory=$true,Position=2)] [string]$Url, [Parameter(Mandatory=$true,Position=3)] [SecureString]$AdminPassword, [Parameter(Mandatory=$true,Position=4)] [string]$ListTitle ) $ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url) $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $AdminPassword) $ctx.Load($ctx.Web.Lists) $ctx.Load($ctx.Web) $ctx.Load($ctx.Web.Webs) $ctx.ExecuteQuery() $ll=$ctx.Web.Lists.GetByTitle($ListTitle) $ctx.Load($ll) $ctx.ExecuteQuery() ## View XML $qCommand = @" <View Scope="RecursiveAll"> <Query> <OrderBy><FieldRef Name='ID' Ascending='TRUE'/></OrderBy> </Query> <RowLimit Paged="TRUE">5000</RowLimit> </View> "@ ## Page Position $position = $null ## All Items $allItems = @() Do{ $camlQuery = New-Object Microsoft.SharePoint.Client.CamlQuery $camlQuery.ListItemCollectionPosition = $position $camlQuery.ViewXml = $qCommand ## Executing the query $currentCollection = $ll.GetItems($camlQuery) $ctx.Load($currentCollection) $ctx.ExecuteQuery() ## Getting the position of the previous page $position = $currentCollection.ListItemCollectionPosition # Adding current collection to the allItems collection $allItems += $currentCollection Write-Host "Collecting items. Current number of items: " $allItems.Count } while($position -ne $null) Write-Host "Total number of items: " $allItems.Count for($j=0;$j -lt $allItems.Count ;$j++) { Write-Host "Resetting permissions for " $allItems[$j]["Title"] ".." $allItems[$j]["FileRef"] $allItems[$j].ResetRoleInheritance() $ctx.ExecuteQuery() } } # Paths to SDK. Please verify location on your computer. Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" #Enter the data $AdminPassword=Read-Host -Prompt "Enter password" -AsSecureString $username="user@tenant.onmicrosoft.com" $Url="https://tenant.sharepoint.com" $ListTitle="library or list" Restore-SPOListAllItemsInheritance -Username $username -Url $Url -AdminPassword $AdminPassword -ListTitle $ListTitle |
Orginal source for…
Today easy catch. When VPN connections is stuck on disconnecting or connecting state, open admin mode shell and type.
1 |
net stop netman && net start netman |
Hi, Just wanted to share this one to make it easier for others. Check currently activated Onedrive sites from a tenant: >Onedrive share<
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 |
# Specifies the URL for your organization's SPO admin service $AdminURI = "https://your organization name-admin.sharepoint.com" # Specifies the User account for an Office 365 global admin in your organization $AdminAccount = "global admin account" $AdminPass = "password for global admin account" # Specifies the location where the list of URLs should be saved $LogFile = 'C:\Users\youralias\Desktop\ListOfMysites.txt' # Begin the process $loadInfo1 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client") $loadInfo2 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime") $loadInfo3 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.UserProfiles") # Convert the Password to a secure string, then zero out the cleartext version ;) $sstr = ConvertTo-SecureString -string $AdminPass -AsPlainText –Force $AdminPass = "" # Take the AdminAccount and the AdminAccount password, and create a credential $creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($AdminAccount, $sstr) # Add the path of the User Profile Service to the SPO admin URL, then create a new webservice proxy to access it $proxyaddr = "$AdminURI/_vti_bin/UserProfileService.asmx?wsdl" $UserProfileService= New-WebServiceProxy -Uri $proxyaddr -UseDefaultCredential False $UserProfileService.Credentials = $creds # Set variables for authentication cookies $strAuthCookie = $creds.GetAuthenticationCookie($AdminURI) $uri = New-Object System.Uri($AdminURI) $container = New-Object System.Net.CookieContainer $container.SetCookies($uri, $strAuthCookie) $UserProfileService.CookieContainer = $container # Sets the first User profile, at index -1 $UserProfileResult = $UserProfileService.GetUserProfileByIndex(-1) Write-Host "Starting- This could take a while." $NumProfiles = $UserProfileService.GetUserProfileCount() $i = 1 # As long as the next User profile is NOT the one we started with (at -1)... While ($UserProfileResult.NextValue -ne -1) { Write-Host "Examining profile $i of $NumProfiles" # Look for the Personal Space object in the User Profile and retrieve it # (PersonalSpace is the name of the path to a user's OneDrive for Business site. Users who have not yet created a # OneDrive for Business site might not have this property set.) $Prop = $UserProfileResult.UserProfile | Where-Object { $_.Name -eq "PersonalSpace" } $Url= $Prop.Values[0].Value # If "PersonalSpace" (which we've copied to $Url) exists, log it to our file... if ($Url) { $Url | Out-File $LogFile -Append -Force } # And now we check the next profile the same way... $UserProfileResult = $UserProfileService.GetUserProfileByIndex($UserProfileResult.NextValue) $i++ } Write-Host "Done!" |
And Bulk provision users based on a text file.
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 |
<# .SYNOPSIS This script adds an entry for each user specified in the input file into the OneDrive provisioning queue .DESCRIPTION This script reads a text file with a line for each user. Provide the User Principal Name of each user on a new line. An entry will be made in the OneDrive provisioning queue for each user up to 200 users. .EXAMPLE .\BulkEnqueueOneDriveSite.ps1 -SPOAdminUrl https://contoso-admin.sharepoint.com -InputfilePath C:\users.txt .PARAMETER SPOAdminUrl The URL for the SharePoint Admin center https://contoso-admin.sharepoint.com .PARAMETER InputFilePath The path to the input file. The file must contain 1 to 200 users C:\users.txt .NOTES This script needs to be run by a SharePoint Online Tenant Administrator This script will prompt for the username and password of the Tenant Administrator #> param ( #Must be SharePoint Administrator URL [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [string] $SPOAdminUrl, [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [string] $InputFilePath ) [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client") | Out-Null [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime") | Out-Null [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.UserProfiles") | Out-Null $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SPOAdminUrl) $Users = Get-Content -Path $InputFilePath if ($Users.Count -eq 0 -or $Users.Count -gt 200) { Write-Host $("Unexpected user count: [{0}]" -f $Users.Count) -ForegroundColor Red return } $web = $ctx.Web Write-Host "Please enter a Tenant Admin username" -ForegroundColor Green $username = Read-Host Write-Host "Please enter your password" -ForegroundColor Green $password = Read-Host -AsSecureString $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username,$password ) $ctx.Load($web) $ctx.ExecuteQuery() $loader = [Microsoft.SharePoint.Client.UserProfiles.ProfileLoader]::GetProfileLoader($ctx) $ctx.ExecuteQuery() $loader.CreatePersonalSiteEnqueueBulk($Users) $loader.Context.ExecuteQuery() Write-Host "Script Completed" |
Links for instructions. https://support.office.com/en-us/article/create-a-list-of-all-onedrive-locations-in-your-organization-8e200cb2-c768-49cb-88ec-53493e8ad80a?ui=en-US&rs=en-US&ad=US https://support.office.com/en-us/article/Pre-provision-OneDrive-for-users-in-your-organization-ceef6623-f54f-404d-8ee3-3ce1e338db07
Hi, Yesterday there was the following scenario with a customer. – User mailboxes were migrated with third party tools to a new Office 365 tenant. – UserPrincipalName stayed the same. – Employees used the same laptop and profiles than before….
Hi, Today I found this excellent script for the job. All the credit goes to http://jasonwarren.ca/clearspconfigcache/
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 |
<# .SYNOPSIS Clear the Configuration Cache in a SharePoint 2010, 2013, or 2016 farm .DESCRIPTION Clear-SPConfigCache.ps1 will: 1. Stop the SharePoint Timer Service on all servers in the farm 2. Delete all xml files in the configuration cache folder on all servers in the farm 3. Copy the existing cache.ini files as a backup 4. Clear the cache.ini files and reset them to a value of 1 5. Start the SharePoint Timer Service on all servers in the farm Clear-SPConfigCache.ps1 will work in either single-server and multi-server farms. Run in an elevated SharePoint Management Shell Author: Jason Warren .LINK http://jasonwarren.ca/ClearSPConfigCache ClearSPConfigCache.ps1 .EXAMPLE .\Clear-SPConfigCache.ps1 .INPUTS None. Clear-SPConfigCache.ps1 does not take any input. .OUTPUTS Text output that describes the current task being performed. #> Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction Stop $farm = Get-SPFarm $ConfigDB = Get-SPDatabase | where {$_.Name -eq $Farm.Name} # Configuration Cache is stored in %PROGRAMDATA\Microsoft\SharePoint\Config\[Config ID GUID] # %PROGRAMDATA% is C:\ProgramData by default, it is assumed it's in the same location on all servers in the farm # i.e. if it's X:\ProgramData on one server, it will be X:\ProgramData on the others # We'll be connecting via UNC paths, so we'll also change the returned DRIVE: to DRIVE$ $ConfigPath = "$(($env:PROGRAMDATA).Replace(':','$'))\Microsoft\SharePoint\Config\$($ConfigDB.Id.Guid)" # Stop the timer service on all farm servers $TimerServiceName = "SPTimerV4" foreach ($server in $farm.TimerService.Instances.Server) { Write-Output "Stopping $TimerServiceName on $($server.Address)..." $service = Get-Service -ComputerName $server.Address -Name $TimerServiceName Stop-Service -InputObject $service -Verbose } # Foreach server $TimeStamp = Get-Date -Format "yyyymmddhhmmssms" # Clear and reset the cache on each server in the farm foreach ($server in $farm.TimerService.Instances.Server) { Write-Output $server.Address # build the UNC path e.g. \\server\X$\ProgramData\Microsoft\SharePoint\Config\00000000-0000-0000-0000-000000000000 $ServerConfigPath = "\\$($server.Address)\$($ConfigPath)" # Delete the XML files Write-Output "Remove XML files: $ServerConfigPath..." Remove-Item -Path "$ServerConfigPath\*.xml" # Backup the old cache.ini Write-Output "Backup $ServerConfigPath\cache.ini..." Copy-Item -Path "$ServerConfigPath\cache.ini" -Destination "$ServerConfigPath\cache.ini.$TimeStamp" # Save the value of "1" to cache.ini Write-Output "Set cache.ini to '1'..." "1" | Out-File -PSPath "$ServerConfigPath\cache.ini" Write-Output "" } #foreach server #Start the timer service on all farm servers foreach ($server in $farm.TimerService.Instances.Server) { Write-Output "Starting $TimerServiceName on $($server.Address)..." $service = Get-Service -ComputerName $server.Address -Name $TimerServiceName Start-Service -InputObject $service -Verbose } |
If You want to archive this You have to use Powershell. Connect to Exchange Online Powershell and use the command below:
1 |
Set-UnifiedGroup -Identity GroupMailboxIdentity@domain.fi -EmailAddresses @{Add='alias@domain.fi'} |
Happy Powershelling,
Sharepoint gathers usage and health data to database called WSS_Logging. By Default retention period is 14 days. If You want to make it lower, lets say 2 days use the below oneliner for it.
1 |
Get-SPUsageDefinition | Set-SPUsageDefinition -DaysRetained 2 |
And then just a quick…
If You have to get something out to a csv-file from Direct Access Reporting. You have to use powershell. For the last 30 days use below script.
1 2 3 4 5 |
$startdate = (Get-Date).AddDays(-30) $enddate = Get-Date Get-RemoteAccessConnectionStatistics –StartDateTime $startdate –EndDateTime $enddate | Export-Csv -nti -enc utf8 –Path c:\dir\da.csv |
Updates have been released for Exchange 2013 and 2016. https://blogs.technet.microsoft.com/exchange/2017/09/19/released-september-2017-quarterly-exchange-updates/ If You are using a Hybrid, You have to update these to be supported.