<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Cloud Trek 365</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/cloudtrek365/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/cloudtrek365/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:28:52 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Role call!</title>
      <link>https://docs.microsoft.com/archive/blogs/cloudtrek365/roll-call</link>
      <pubDate>Thu, 15 Mar 2018 13:35:21 GMT</pubDate>
      <dc:creator><![CDATA[Glenn Blinckmann]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/cloudtrek365/?p=255</guid>
      <description><![CDATA[On a regular basis, you should be reviewing who holds roles in Office 365. Is everyone using the...]]></description>
      <content:encoded><![CDATA[On a regular basis, you should be reviewing who holds roles in Office 365. Is everyone using the Company Administrator role? Well, you should just be giving the minimum required permissions. Here's a good way to extract the membership for all the roles. The extract makes it easy to give to people to review.
<pre>$roles = Get-MsolRole
Foreach ($role in $roles) {
 $Filename = "C:\temp\"+$role.name+".csv"
 Get-MsolRoleMember -RoleObjectId $role.ObjectId | Export-CSV $Filename -NoTypeInformation
 }</pre>
All this code comes with the normal disclaimers, of course. Try this in a lab, if at all possible. You’re on your own here – there’s no warranty on this. If you use it, please leave a comment.]]></content:encoded>
    </item>
    <item>
      <title>Skype for Business – Applying connection policies to departments or agencies</title>
      <link>https://docs.microsoft.com/archive/blogs/cloudtrek365/skype-for-business-applying-connection-policies-to-departments-or-agencies</link>
      <pubDate>Mon, 16 Oct 2017 09:06:38 GMT</pubDate>
      <dc:creator><![CDATA[Glenn Blinckmann]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/cloudtrek365/?p=245</guid>
      <description><![CDATA[In Office 365, the control to federate your tenant with consumer Skype is a simple checkbox. Well,...]]></description>
      <content:encoded><![CDATA[In Office 365, the control to federate your tenant with consumer Skype is a simple checkbox. Well, this is fine for a lot of small businesses or anyone where there is agreement on doing this. If a more granular approach is needed, this is both possible and fairly easy to do. What is the magic to make this happen? Skype for Business Online connection policies.

Basically, what’s needed is to apply a policy to all users (or at least, all users who will have some restrictions on them). This is done with a PowerShell script that you’ll run periodically. Fortunately, the queries for this script are all indexed attributes, so we can do all the filtering server-side. This makes the script very fast and scalable.

The first step is defining policies. In this example, we have a policy which is blocking all access to consumer Skype, very much like it would be in the tenant if you didn’t have the Skype connectivity box checked.
<pre style="padding-left: 30px">New-CsExternalAccessPolicy -Identity BlockSkype `
    -EnablePublicCloudAccess $False `
    -EnablePublicCloudAudioVideoAccess $False `
    -EnableFederationAccess $True `
    -EnableOutsideAccess $True</pre>
This only needs to be done once to create the “BlockSkype” policy in the tenant.

But creating this policy isn’t necessary most of the time. There are already three pre-defined policies in Skype for Business Online. These should cover most scenarios:
<ul>
 	<li>No Federated or Skype Consumer Access (Tag:NoFederationAndPIC )</li>
 	<li>Federated Access Only (Tag:FederationOnly )</li>
 	<li>Federated and Consumer Access (FederationAndPICDefault)</li>
</ul>
For this example, we have Contoso and Fabrikam sharing a tenant. The Contoso accounting department isn’t permitted access to Skype. (You could use a custom policy, or the pre-built “FederationOnly” one. So how do we block this while allowing everyone else access? Just a one-line PowerShell script does it.
<pre style="padding-left: 30px">Get-CsOnlineUser -Filter {
    (SipProxyAddress -like '*@contoso.com') -and `
    (ExternalAccessPolicy -ne 'BlockSkype') -and `
    (Department -like 'Accounting*')
    } | Grant-CsExternalAccessPolicy -PolicyName 'BlockSkype'</pre>
Yes, that really is one line. I’ve just added line breaks for readability. But it really would fit in just one line if you wanted it to. If you have many domains or departments which need to be blocked, you could keep a CSV file of these, import them, and have this one line use variables which loop though all the policies which need to be set.

Also as a by-product of this, it’s possible to have more restrictive policies around federated communications as well. All that’s needed for this is to create a separate policy similar to above (with a different name, of course, and setting the EnableFederationAccess switch to $False.

All-in-all, this is a much better solution than just blocking Skype access for everybody.

More documentation on the different options for the policies is located here:
<a href="https://docs.microsoft.com/en-us/powershell/module/skype/new-csexternalaccesspolicy?view=skype-ps">https://docs.microsoft.com/en-us/powershell/module/skype/new-csexternalaccesspolicy?view=skype-ps
</a><a href="https://docs.microsoft.com/en-us/powershell/module/skype/grant-csexternalaccesspolicy?view=skype-ps">https://docs.microsoft.com/en-us/powershell/module/skype/grant-csexternalaccesspolicy?view=skype-ps</a>

<span>All this code comes with the normal disclaimers, of course. You’re on your own here - there’s no warranty on this. I always recommend testing everything in a lab, of course. If you use it, please leave a comment.</span>]]></content:encoded>
    </item>
    <item>
      <title>A License to Bill</title>
      <link>https://docs.microsoft.com/archive/blogs/cloudtrek365/a-license-to-bill</link>
      <pubDate>Fri, 24 Mar 2017 14:20:44 GMT</pubDate>
      <dc:creator><![CDATA[Glenn Blinckmann]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/cloudtrek365/?p=216</guid>
      <description><![CDATA[Do you have enough Office 365 licenses? Are you sure? Are they expiring? Is billing getting...]]></description>
      <content:encoded><![CDATA[Do you have enough Office 365 licenses? Are you sure? Are they expiring? Is billing getting everything approved to have the licenses renewed? These are not always easy questions. Many admins don't go to the portal often and check this. I wanted to have a simple check that I could run against any tenant and quickly get an email with the license information. The portal is great, but it doesn't lend itself to making an email that you can get to the people who need to see it. This works well for that. I like tables a whole lot more than emailing screenshots of a website.

You do need to log into Office 365 first, before this will work. Since I'm using Office 365's SMTP relay, this also works from anywhere. It's great when you're traveling.

All this code comes with the normal disclaimers, of course. Try this in a lab, if at all possible. You’re on your own here – there’s no warranty on this. If you use it, please leave a comment.
<pre># Office365-QuickLicenseCount.ps1 - grb - 3/24/2017 - Generates an HTML table of the tenant licenses and emails it.

#Some variables. We need the email addresses and credentials for emailing.
#You need to set a directory for the log and htm files.
$TenantName = (Get-MsolCompanyInformation).DisplayName
$Date = Get-Date -Format 'yyyyMMdd-HHmm'

$to = 'admin@contoso.com'
$from = 'admin@contoso.com'
$LogPath = 'C:\temp\Office365-QuickLicenseCount-'+$Date+'.log'
$FilePath = 'C:\temp\Office365-QuickLicenseCount-'+$Date+'.htm'

$subject = ((Get-MsolCompanyInformation).DisplayName)+' - Office 365 Quick License Count'
$smtpCred = Get-Credential $from

#Start logging what we're doing
Start-Transcript -Path $LogPath

# Set up header information for HTML table.
$Header = @"
 &lt;style&gt;
 TABLE {border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}
 TH {border-width: 1px;padding: 3px;border-style: solid;border-color: black;font-family: Verdana; font-size: 10pt;background-color: #6495ED;}
 TD {border-width: 1px;padding: 3px;border-style: solid;border-color: black;font-family: Verdana; font-size: 10pt;}
 &lt;/style&gt;
"@

# Go get the data
$AccountSkus = Get-MsolAccountSku
$NewAccountSkus = @()

#Add a new column for AvailableUnits
Foreach ($AccountSku in $AccountSkus) {
 $NewAccountSku = $AccountSku

 
 $NewAccountSku | Add-Member -type NoteProperty -name AvailableUnits -value ($AccountSku.ActiveUnits + $AccountSku.WarningUnits - $AccountSku.ConsumedUnits)
 $NewAccountSkus += $NewAccountSku
 }

# display the table as text
$NewAccountSkus | Select SkuPartNumber,ActiveUnits,ConsumedUnits,WarningUnits,AvailableUnits,SuspendedUnits | sort -Property 'SkuPartNumber' | ft

# Define the email body
$body = $NewAccountSkus | Select SkuPartNumber,ActiveUnits,ConsumedUnits,WarningUnits,AvailableUnits,SuspendedUnits | sort -Property 'SkuPartNumber' | ConvertTo-Html -Head $Header | Out-String
Out-File -filepath $FilePath -InputObject $body

#Send the email
Send-MailMessage -From $from -To $to -Subject $subject -Body $body -BodyAsHtml -SmtpServer 'smtp.office365.com' -Port '587' -UseSsl -Credential $smtpCred

# Clean up
Get-PSSession | Remove-PSSession
Stop-Transcript</pre>]]></content:encoded>
    </item>
    <item>
      <title>Simple Surface Hub Account Configuration</title>
      <link>https://docs.microsoft.com/archive/blogs/cloudtrek365/simple-surface-hub-account-configuration</link>
      <pubDate>Fri, 24 Mar 2017 11:56:16 GMT</pubDate>
      <dc:creator><![CDATA[Glenn Blinckmann]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/cloudtrek365/?p=205</guid>
      <description><![CDATA[I was looking through the documentation for setting up an account for a Surface Hub. It's a...]]></description>
      <content:encoded><![CDATA[I was looking through the documentation for setting up an account for a Surface Hub. It's a wonderful set of documentation, but it's also very long! Most of this was just more detailed than I needed, but I wanted a very simple, easy-to-follow script for building this in Office 365. I don't like to do anything by hand, since I may need to do another in the future. I like consistency. This isn't going to be ideal if you need to deploy scores of them, but this works well for deploying a few.

The first thing you'll need is to install the modules that are used for this script:
<ul>
 	<li><a href="https://go.microsoft.com/fwlink/p/?LinkId=286152">Microsoft Online Service Sign-in Assistant for IT Professionals RTW</a></li>
 	<li><a href="https://go.microsoft.com/fwlink/p/?linkid=236297">Windows Azure Active Directory Module for Windows PowerShell (64-bit version)</a></li>
 	<li><a href="https://go.microsoft.com/fwlink/p/?LinkId=532439">Skype for Business Online, Windows PowerShell Module</a></li>
</ul>
Got that working? Good. On to the script and what it does.

I really just stepped through the Surface Hub installation steps and set up sequential commands for each section. You would need to run this several times, 10 minutes or so apart, to give time to create the mailbox and for replication to finish. You know it's working when the errors stop. The Get-CsMeetingRoom at the end is what needs to succeed for this to be completed. If that works, you should be good.

All this code comes with the normal disclaimers, of course. Try this in a lab, if at all possible. You’re on your own here – there’s no warranty on this. If you use it, please leave a comment. And remember, this is only for Office 365. On-premises systems would be done differently.

<em>(Note that I updated this script on 3/31/2017 to take care of making the password not expire. That's very important!)</em>
<pre># New-SurfaceHubAccount.ps1 - grb - 03/31/2017 - Adds and configures a new Surface Hub account.

# Configuration variables. You need to replace these with whatever makes sense
# for your environment - especially the password!
$SurfaceHubDisplayname = 'Surface Hub 01'
$SurfaceHubAlias = 'SurfaceHub01'
$SurfaceHubPassword = 'Super-Secret1Password!'
$SurfaceHubMobilePolicy = "Surface Hubs"
$AdminAcccount = 'admin@contoso.com'


# Login to all necessary shells
$MSOLCred = Get-Credential -credential $AdminAcccount
#Azure
Import-Module MSOnline
Connect-MsolService -Credential $MSOLCred
#Exchange Online
$ExSession = New-PSSession -ConfigurationName Microsoft.Exchange 
	-ConnectionUri https://outlook.office365.com/powershell-liveid/ `
	-Credential $MSOLCred -Authentication Basic –AllowRedirection
Import-PSSession $ExSession –AllowClobber -Verbose
#Skype for Business Online
Import-Module LyncOnlineConnector
$lyncsession = New-CsOnlineSession –credential $MSOLCred
Import-PSSession $lyncsession –AllowClobber -Verbose


# Additional calculated variables
$SurfaceHubLicense = (Get-MsolAccountSku | ? {$_.AccountSkuID -like "*ENTERPRISEPREMIUM"}).AccountSkuID
$MSOLAccountSKU = Get-MsolAccountSku
$TenantId = $MSOLAccountSKU[0].AccountObjectId.Guid 
$TenantName = ($MSOLAccountSKU[0].AccountName)
$TenantDomain = $TenantName+'.onmicrosoft.com'
$SurfaceHubAccount = $SurfaceHubAlias+'@'+$TenantDomain


# Create mailbox and configure
New-Mailbox -MicrosoftOnlineServicesID $SurfaceHubAccount -Alias $SurfaceHubAlias -Name $SurfaceHubDisplayname 
	-Room -EnableRoomMailboxAccount $true -RoomMailboxPassword (ConvertTo-SecureString  `
	-String $SurfaceHubPassword -AsPlainText -Force) -ErrorAction SilentlyContinue

New-MobileDeviceMailboxPolicy -Name $SurfaceHubMobilePolicy -PasswordEnabled $false -ErrorAction silentlycontinue
Set-CASMailbox -Identity $SurfaceHubAccount -ActiveSyncMailboxPolicy $SurfaceHubMobilePolicy

Set-CalendarProcessing -Identity $SurfaceHubAccount -AutomateProcessing AutoAccept -AddOrganizerToSubject $false 
	–AllowConflicts $false –DeleteComments $false -DeleteSubject $false -RemovePrivateProperty $false

Set-CalendarProcessing -Identity $SurfaceHubAccount -AddAdditionalResponse $true `
	-AdditionalResponse "This room is equipped with a Surface Hub"

Set-Msoluser -UserPrincipalName $SurfaceHubAccount -UsageLocation US
Set-MsolUser -UserPrincipalName $SurfaceHubAccount -PasswordNeverExpires $true

# Apply Office 365 License
Set-MsolUserLicense -UserPrincipalName $SurfaceHubAccount -AddLicenses $SurfaceHubLicense `
	-ErrorAction SilentlyContinue

Get-CASMailbox $SurfaceHubAccount | fl Identity,ActiveSyncMailboxPolicy
Get-MsolUser -UserPrincipalName $SurfaceHubAccount | fl DisplayName,UsageLocation

# Skype for Business account and configuration.
$RegistrarPool = (Get-CsOnlineUser -Identity $SurfaceHubAccount).RegistrarPool

Enable-CsMeetingRoom -Identity $SurfaceHubAccount -RegistrarPool $RegistrarPool -SipAddressType EmailAddress
Get-CsMeetingRoom -identity $SurfaceHubAccount | fl DisplayName,IsValid,SipAddress

# Log out of all sessions
Get-PSSession | Remove-PSSession

echo "end of script"</pre>]]></content:encoded>
    </item>
    <item>
      <title>What’s in a CNAME?</title>
      <link>https://docs.microsoft.com/archive/blogs/cloudtrek365/whats-in-a-cname</link>
      <pubDate>Fri, 09 Sep 2016 15:30:50 GMT</pubDate>
      <dc:creator><![CDATA[Glenn Blinckmann]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/cloudtrek365/?p=195</guid>
      <description><![CDATA[Enabling DKIM email signing in Office 365 is much easier than doing this on-premises yourself. Most...]]></description>
      <content:encoded><![CDATA[Enabling DKIM email signing in Office 365 is much easier than doing this on-premises yourself. Most of the hard work is already done for you in the tenant. That doesn’t mean that there’s <strong>no</strong> work to do, but it’s easier. Terry Zink has <a href="https://blogs.msdn.microsoft.com/tzink/2015/10/08/manually-hooking-up-dkim-signing-in-office-365/">a great article on doing this</a>, and I recommend reading it before going too far down this road. Most people don’t even need to go down this path, since DKIM is already added to outbound email automatically. If you’re looking to keep all your domains separate, however, you may want to enable the manual config so that the DKIM signature is aligned with the domain. <a href="https://blogs.msdn.microsoft.com/tzink/2015/12/16/exchange-online-is-rolling-out-default-dkim-signing-to-everyone/">Terry explains this better here</a>.

Are you still with me? Good. So, you’ve decided to deploy this using the manual method, to get the signatures aligned to the domain. And you have tons of domains and need two tons of DNS entries. How do you get them all without any typos? I put together a little script to help with this.
<pre>#DkimCnames.ps1 | grb | 9/9/2016
#Pulls CNAME values from tenant, where DKIM is disabled, and puts these into a csv file

#Some basics. Get &amp; format the date. Define where we are going to write the log file.
$Date = Get-Date -Format 'yyyyMMddhhmm'
$csvPath = 'C:\temp\DkimCnames-'+$Date+'.csv'
$LogPath = 'C:\temp\DkimCnames-'+$Date+'.log'
Start-Transcript -Path $LogPath

$Configs = Get-DkimSigningConfig | ? {$_.Enabled -eq $false} | sort -Property Domain | Select Domain,Selector1CNAME,Selector2CNAME
$NewConfigs=@()

Foreach ($Config in $Configs) {
 $Config | Add-Member -type NoteProperty -name Selector1Host -value ('selector1._domainkey.'+$Config.Domain)
 $Config | Add-Member -type NoteProperty -name Selector2Host -value ('selector2._domainkey.'+$Config.Domain)
 $NewConfigs += $Config
 }

$NewConfigs | Select Domain,Selector1Host,Selector1CNAME,Selector2Host,Selector2CNAME | Export-Csv -LiteralPath $csvPath -NoTypeInformation
Stop-Transcript</pre>
All I'm really doing here is to pull all the DNS records needed for all the domains that are in your tenant, where you've not already enabled DKIM manually. Doing a few domains by hand is easy - but if you have a lot of domains (especially those with hyphens), this can save quite a bit of time.

<span>All this code comes with the normal disclaimers, of course. You’re on your own here - there’s no warranty on this. I always recommend testing everything in a lab, of course. If you use it, please leave a comment.</span>]]></content:encoded>
    </item>
    <item>
      <title>Can you provision an enterprise Office 365 tenant without a provisioning system?</title>
      <link>https://docs.microsoft.com/archive/blogs/cloudtrek365/can-you-provision-an-enterprise-office-365-tenant-without-a-provisioning-system</link>
      <pubDate>Fri, 24 Jun 2016 15:42:00 GMT</pubDate>
      <dc:creator><![CDATA[Glenn Blinckmann]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/cloudtrek365/?p=185</guid>
      <description><![CDATA[Can you provision an enterprise Office 365 tenant without a provisioning system?

Normally,...]]></description>
      <content:encoded><![CDATA[Can you provision an enterprise Office 365 tenant without a provisioning system?

Normally, provisioning Office 365 users is a pretty easy task. You just add users via a web interface, via PowerShell, or however you like. Azure AD Connect is a popular way to get user accounts into the system. From there, all you need to do is assign licenses. You can do this via web or PowerShell, of course, so in small batches this is pretty easy. But I have a customer that is anything but “small”.

The problem I was given was how to provision additional licenses, for add-ons such as Visio or Power BI, without having a single enterprise provisioning system. So, multiple entities sharing an Office 365 tenant, with each entity having their own provisioning system, or nothing more that AD Users and Computers. Oh, and some of the entities may not even have the Exchange schema extensions, so you can’t use those attributes.

What I really wanted was something that could scale, a multi-valued property. Something that I could use and nobody would miss. So, going down the list of attributes that are available, I came across “other home phone number”. Do you know anyone with three home phones? Me, neither. Just having one home phone number is becoming unusual. This is a mult-valued text property that should be unused!

Here’s what it looks like when you add entries for Visio and Power BI:

<a href="https://msdnshared.blob.core.windows.net/media/2016/06/clip_image00226.jpg"><img style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px" title="clip_image002" src="https://msdnshared.blob.core.windows.net/media/2016/06/clip_image002_thumb24.jpg" alt="clip_image002" width="418" height="396" border="0" /></a>

So, once you have some entries, what happens next? Azure AD Connect will sync these entries up to Office 365. And we have a PowerShell script to do the magic once that sync happens.

I’m not going to give you the whole script here, but I will give you the key components to plug into your own script. I’ll use Visio as the example.

In the Exchange Online shell, you have access to Get-User. We use that to find all the people who need licenses for Visio.

<span style="font-family: Lucida Console;font-size: small">$VisioClientUsers = Get-User -Filter {(OtherHomePhone -like '*VISIOCLIENT*') -and (SKUAssigned -eq $true)} -ResultSize 'Unlimited' | Select UserPrincipalName
echo "VisioClientUsers"
$VisioClientUsers
echo "-------"</span>

So, now let’s see how we check for and add the licenses. I’m using the setting where the tenant name is “Contoso”.

<span style="font-family: Lucida Console;font-size: small">#Add Visio Licenses
echo "Processing VisioClientUsers"
Foreach ($VisioClientUser in $VisioClientUsers) {
$userlicenses = (Get-MsolUser -UserPrincipalName $VisioClientUser.UserPrincipalName).Licenses</span>

$AccountSkuIds = @()

<span style="font-family: Lucida Console;font-size: small">    Foreach ($userlicense in $userlicenses) {$AccountSkuIds += $userlicense.AccountSkuId}</span>

#$AccountSkuIds

<span style="font-family: Lucida Console;font-size: small">    If ($AccountSkuIds -notcontains 'contoso:VISIOCLIENT_GOV') {
Echo ($VisioClientUser.UserPrincipalName+" Needs Visio License")</span>

Set-MsolUserLicense -UserPrincipalName `
$VisioClientUser.UserPrincipalName `
-AddLicenses 'contoso:VISIOCLIENT_GOV' -Verbose
}
}
echo "-------"

That’s all there is to it. Just have this run periodically.

If you wanted a way to remove the licenses when no longer needed, you would run though all the users who have that license assigned, and remove that license if they don’t have “VisioClient” in the OtherHomePhone field. But that will be a future post if people are interested in doing this.]]></content:encoded>
    </item>
    <item>
      <title>Outlook.com &amp; Desktop Outlook</title>
      <link>https://docs.microsoft.com/archive/blogs/cloudtrek365/outlook-com-desktop-outlook</link>
      <pubDate>Fri, 24 Jun 2016 10:41:19 GMT</pubDate>
      <dc:creator><![CDATA[Glenn Blinckmann]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/cloudtrek365/?p=117</guid>
      <description><![CDATA[Here’s a quick tip for anyone with an Outlook.com account that’s been upgraded to the new...]]></description>
      <content:encoded><![CDATA[<span style="color: #000000;font-family: Calibri">Here’s a quick tip for anyone with an Outlook.com account that’s been upgraded to the new Outlook.com system. How do you know if you’ve been upgraded? Your URL will be </span><a href="https://outlook.live.com/owa/"><span style="color: #0563c1;font-family: Calibri">https://outlook.live.com/owa/</span></a><span style="color: #000000;font-family: Calibri"> in a browser and you won’t be redirected back to the old system on </span><a href="https://mail.live.com/"><span style="color: #0563c1;font-family: Calibri">https://mail.live.com</span></a><span style="color: #000000;font-family: Calibri">.</span>

<span style="color: #000000;font-family: Calibri">Still with me? Good. So, you’ve got an upgraded account and everything works just like it did before the upgrade. The process is fairly seamless. Many people don’t know that they’ve been migrated. But we want more than just what we had before, don’t we? So, let’s upgrade how we access Outlook.com</span>

<span style="color: #000000;font-family: Calibri">The way you used to connect desktop Outlook with Outlook.com was via ActiveSync. That’s a good protocol, but it’s not as full-featured as </span><a href="https://blogs.technet.microsoft.com/exchange/2014/05/09/outlook-connectivity-with-mapi-over-http/"><span style="color: #0563c1;font-family: Calibri">MAPI-HTTP</span></a><span style="color: #000000;font-family: Calibri"> is. With this upgrade, you can now use MAPI-HTTP just by removing your old ActiveSync connections to Outlook.com with desktop Outlook and re-creating them. They’ll use the best protocol possible, which would be MAPI-HTTP if you are running a current version of desktop Outlook.</span>

<span style="color: #000000;font-family: Calibri">What does this do for you? Well, with a MAPI-HTTP connection, you can add applications into Outlook.com via the </span><a href="https://store.office.com/en-001/appshome.aspx?productgroup=Outlook"><span style="color: #0563c1;font-family: Calibri">Outlook Store</span></a><span style="color: #000000;font-family: Calibri">, and they will install into desktop Outlook! Yes, you can have your Starbucks for Outlook installed, and it will work in desktop Outlook. This won’t happen over an ActiveSync connection.</span>

<span style="color: #000000;font-family: Calibri">How cool is that?</span>]]></content:encoded>
    </item>
    <item>
      <title>Lync ‘n Logs</title>
      <link>https://docs.microsoft.com/archive/blogs/cloudtrek365/lync-n-logs</link>
      <pubDate>Wed, 11 Mar 2015 18:08:52 GMT</pubDate>
      <dc:creator><![CDATA[Glenn Blinckmann]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/cloudtrek365/2015/03/11/lync-n-logs/</guid>
      <description><![CDATA[I ran into an interesting quandary when working on a Lync Online deployment. If you just have the...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="margin:0in 0in 10pt;"><span style="font-family:Calibri;font-size:medium;">I ran into an interesting quandary when working on a Lync Online deployment. If you just have the normal Active Directory install and DirSync with Office 365, using ADFS for authentication, Lync Online will use your UPN as your SIP address. Fair enough &ndash; we&rsquo;d all expect this. If you&rsquo;re trying to make life easy on yourself, you&rsquo;re setting your UPN=Primary SMTP=SIP address. Often this is in the format of </span><a href="mailto:firstname.lastname@domainname.com"><span style="color:#0563c1;font-family:Calibri;font-size:medium;">firstname.lastname@domainname.com</span></a><span style="font-family:Calibri;font-size:medium;">. All this becomes very easy for users to log in and get going.</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="margin:0in 0in 10pt;"><span style="font-family:Calibri;font-size:medium;">So what happens when you have something as simple as a name change? The Primary SMTP address and UPN change, but the SIP address stays the same. If you want your primary SMTP address to be different than your UPN, it gets worse. These never match. Oh, I know what you&rsquo;re thinking. Who cares if your SIP address = Primary SMTP? You&rsquo;re just looking the person up in Lync, anyway, so the address doesn&rsquo;t matter. Sure. Until you go federate systems. Then the presence information is completely broken and communications just doesn&rsquo;t happen. And don&rsquo;t think you&rsquo;ll be doing SIP address updates in PowerShell online, either. You&rsquo;re DirSync&rsquo;ing the account from your on-premises AD, so this won&rsquo;t work.</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="margin:0in 0in 10pt;"><span style="font-family:Calibri;font-size:medium;">So let&rsquo;s fix it in the on-premises AD!</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="margin:0in 0in 10pt;"><span style="font-family:Calibri;font-size:medium;">The first clue is that Lync Online will use your UPN to make a SIP address. But, if you <b>have</b> a SIP address on-premises, that will sync up just fine. Don&rsquo;t have the Lync schema extensions in your on-premises AD? Not a problem. We are just going to add a SIP address in your list of proxy addresses from email. DirSync (or AAD Sync) will bring that right up.</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="margin:0in 0in 10pt;"><span style="font-family:Calibri;font-size:medium;">Where&rsquo;s the code? It&rsquo;s below, and I&rsquo;ll describe what&rsquo;s going on here. I&rsquo;m finding all the remote mailbox objects, starting in an OU. You may not want everyone, but they do need to be in Office 365 for this to work. So we pick just the remote user mailboxes.</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="margin:0in 0in 10pt;"><span style="font-family:Calibri;font-size:medium;">I then look though all the proxy addresses of each user, looking for the SIP address. If I find it, I compare it to the primary SMTP address (mail attribute, really). If they are the same, I log it. If they are different, I update the SIP address and log it. If I don&rsquo;t find a SIP address, I add it and log it.</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="margin:0in 0in 10pt;"><span style="font-family:Calibri;font-size:medium;">This turns out to be a very &ldquo;chatty&rdquo; script, with all the logging going on. In the future, I may cut the logging if the primary SMTP matches the SIP address. And all this logging gave me the excuse for a good title.</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="color:darkgreen;font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">#ProxyAddressFixSIP.ps1 - grb - 2/19/2015</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="color:darkgreen;font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">#Adds SIP proxy address if not there, and corrects SIP address if not equal to primary SMTP.</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">&nbsp;</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="color:darkgreen;font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">#Variable Setup and Initialization</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="color:darkgreen;font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">#==============================</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="color:orangered;font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">$Date</span><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"> <span style="color:darkgray;">=</span> <span style="color:blue;">Get-Date</span> <span style="color:navy;">-Format</span> <span style="color:darkred;">&#39;yyyyMMdd-HHmm&#39;</span></span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">&nbsp;</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="color:darkgreen;font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">#Adjust the log path for a good logging directory</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="color:orangered;font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">$LogPath</span><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"> <span style="color:darkgray;">=</span> <span style="color:darkred;">&#39;D:\provisioning\Lync\logs\ProxyAddressFixSIP-&#39;</span><span style="color:darkgray;">+</span><span style="color:orangered;">$Date</span><span style="color:darkgray;">+</span><span style="color:darkred;">&#39;.log&#39;</span></span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="color:blue;font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">Start-Transcript</span><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"> <span style="color:navy;">-Path</span> <span style="color:orangered;">$LogPath</span></span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">&nbsp;</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="color:darkgreen;font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">#Change this searchbase to match your own environment</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="color:orangered;font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">$SearchBase</span><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"> <span style="color:darkgray;">=</span> <span style="color:darkred;">&#39;OU=test,DC=contoso,DC=com&#39;</span></span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">&nbsp;</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="color:darkgreen;font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">#Main Script</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="color:darkgreen;font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">#==============================</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="color:blue;font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">echo</span><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"> <span style="color:darkred;">&#39;----------&#39;</span></span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="color:blue;font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">echo</span><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"> <span style="color:darkred;">&quot;Getting Users&quot;</span></span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="color:orangered;font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">$users</span><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"> <span style="color:darkgray;">=</span> <span style="color:blue;">Get-ADObject</span> <span style="color:navy;">-Properties</span> <span style="color:blueviolet;">DisplayName</span><span style="color:darkgray;">,</span><span style="color:blueviolet;">proxyAddresses</span><span style="color:darkgray;">,</span><span style="color:blueviolet;">mail</span><span style="color:darkgray;">,</span><span style="color:blueviolet;">msExchRecipientTypeDetails</span><span style="color:darkgray;">,</span><span style="color:blueviolet;">DistinguishedName</span> <span style="color:navy;">-SearchBase</span> <span style="color:orangered;">$SearchBase</span> <span style="color:navy;">-Filter</span> {<span style="color:blue;">msExchRecipientTypeDetails</span> <span style="color:navy;">-eq</span> <span style="color:darkred;">&#39;2147483648&#39;</span>} <span style="color:navy;">-ResultSetSize</span> <span style="color:purple;">1000000</span> <span style="color:darkgray;">|</span> <span style="color:blue;">sort</span> <span style="color:navy;">-Property</span> <span style="color:blueviolet;">DisplayName</span></span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="color:blue;font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">echo</span><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"> <span style="color:darkred;">&quot;Got Users&quot;</span></span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">&nbsp;</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="color:darkblue;font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">Foreach</span><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"> (<span style="color:orangered;">$User</span> <span style="color:darkblue;">in</span> <span style="color:orangered;">$Users</span>) {</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">&nbsp;</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp; </span><span style="color:darkgreen;">#Initialize variables and arrays that we&#39;ll need.</span></span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp; </span><span style="color:orangered;">$mail</span> <span style="color:darkgray;">=</span> <span style="color:orangered;">$user</span><span style="color:darkgray;">.</span>mail</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp; </span><span style="color:orangered;">$ProxyAddresses</span> <span style="color:darkgray;">=</span> <span style="color:orangered;">$User</span><span style="color:darkgray;">.</span>proxyAddresses</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp; </span><span style="color:orangered;">$NewProxyAddresses</span> <span style="color:darkgray;">=</span>@()</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp; </span><span style="color:orangered;">$NewSIP</span> <span style="color:darkgray;">=</span> <span style="color:orangered;">$null</span></span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">&nbsp;</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp; </span><span style="color:darkblue;">If</span> (<span style="color:orangered;">$ProxyAddresses</span> <span style="color:darkgray;">-like</span> <span style="color:darkred;">&#39;SIP:*&#39;</span>) {</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">&nbsp;</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:darkblue;">Foreach</span> (<span style="color:orangered;">$ProxyAddress</span> <span style="color:darkblue;">in</span> <span style="color:orangered;">$ProxyAddresses</span>) {</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:darkblue;">If</span> (<span style="color:orangered;">$ProxyAddress</span> <span style="color:darkgray;">-like</span> <span style="color:darkred;">&quot;SIP:*&quot;</span>) {</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:darkblue;">If</span> ((<span style="color:darkred;">&quot;SIP:&quot;</span><span style="color:darkgray;">+</span><span style="color:orangered;">$mail</span>) <span style="color:darkgray;">-eq</span> <span style="color:orangered;">$ProxyAddress</span>) {</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:blue;">echo</span> <span style="color:darkred;">&#39;----------&#39;</span></span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:blue;">echo</span> (<span style="color:darkred;">&quot;SIP = MAIL &quot;</span><span style="color:darkgray;">+</span><span style="color:orangered;">$user</span><span style="color:darkgray;">.</span>DisplayName)</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>} <span style="color:darkblue;">else</span> {</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:blue;">echo</span> <span style="color:darkred;">&#39;----------&#39;</span></span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:orangered;">$NewSIP</span> <span style="color:darkgray;">=</span> <span style="color:darkred;">&quot;SIP:&quot;</span><span style="color:darkgray;">+</span><span style="color:orangered;">$mail</span></span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:blue;">echo</span> (<span style="color:darkred;">&quot;SIP Updated &quot;</span><span style="color:darkgray;">+</span><span style="color:orangered;">$user</span><span style="color:darkgray;">.</span>DisplayName<span style="color:darkgray;">+</span><span style="color:darkred;">&quot; </span><span style="color:orangered;">$NewSIP</span><span style="color:darkred;">&quot;</span>)</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:orangered;">$NewProxyAddresses</span> <span style="color:darkgray;">+=</span> <span style="color:orangered;">$NewSIP</span></span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span>&nbsp;&nbsp;&nbsp;&nbsp;</span>} <span style="color:darkblue;">else</span> {<span style="color:orangered;">$NewProxyAddresses</span> <span style="color:darkgray;">+=</span> <span style="color:orangered;">$ProxyAddress</span>}</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">&nbsp;</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:darkblue;">If</span> (<span style="color:orangered;">$NewSIP</span> <span style="color:darkgray;">-ne</span> <span style="color:orangered;">$null</span>) {</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp; </span></span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:blue;">Set-ADObject</span> <span style="color:orangered;">$user</span><span style="color:darkgray;">.</span>DistinguishedName <span style="color:navy;">-Replace</span> @{proxyAddresses<span style="color:darkgray;">=</span><span style="color:orangered;">$NewProxyAddresses</span>} <span style="color:navy;">-Verbose</span></span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp; </span>} <span style="color:darkblue;">else</span> {</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:blue;">echo</span> <span style="color:darkred;">&#39;----------&#39;</span></span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:orangered;">$NewSIP</span> <span style="color:darkgray;">=</span> <span style="color:darkred;">&quot;SIP:&quot;</span><span style="color:darkgray;">+</span><span style="color:orangered;">$mail</span></span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:orangered;">$NewProxyAddresses</span> <span style="color:darkgray;">+=</span> <span style="color:orangered;">$NewSIP</span></span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:orangered;">$NewProxyAddresses</span> <span style="color:darkgray;">+=</span> <span style="color:orangered;">$ProxyAddresses</span></span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:blue;">echo</span> (<span style="color:darkred;">&quot;SIP Added &quot;</span><span style="color:darkgray;">+</span><span style="color:orangered;">$user</span><span style="color:darkgray;">.</span>DisplayName<span style="color:darkgray;">+</span><span style="color:darkred;">&quot; </span><span style="color:orangered;">$NewSIP</span><span style="color:darkred;">&quot;</span>)</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:blue;">Set-ADObject</span> <span style="color:orangered;">$user</span><span style="color:darkgray;">.</span>DistinguishedName <span style="color:navy;">-Replace</span> @{proxyAddresses<span style="color:darkgray;">=</span><span style="color:orangered;">$NewProxyAddresses</span>} <span style="color:navy;">-Verbose</span></span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"><span>&nbsp;&nbsp;&nbsp; </span>}</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">&nbsp;</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="color:blue;font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">echo</span><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"> <span style="color:darkred;">&#39;----------&#39;</span></span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="color:blue;font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">echo</span><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"> <span style="color:darkred;">&#39;End of script&#39;</span></span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="color:blue;font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">echo</span><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;"> <span style="color:darkred;">&#39;----------&#39;</span></span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">&nbsp;</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="color:blue;font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">Stop-Transcript </span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="background:white;margin:0in 0in 0pt;"><span style="color:blue;font-family:&#39;Lucida Console&#39;;font-size:9.5pt;">&nbsp;</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>
<p style="margin:0in 0in 10pt;"><span style="font-family:Calibri;font-size:medium;">All this code comes with the normal disclaimers, of course. Try this in a lab, if at all possible. You&rsquo;re on your own here - there&rsquo;s no warranty on this. At very least, try this on a test OU as the searchbase. If you use it, please leave a comment.</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>]]></content:encoded>
    </item>
    <item>
      <title>Folder Permissions - Backup and Restore</title>
      <link>https://docs.microsoft.com/archive/blogs/cloudtrek365/folder-permissions-backup-and-restore</link>
      <pubDate>Mon, 19 Jan 2015 13:08:13 GMT</pubDate>
      <dc:creator><![CDATA[Glenn Blinckmann]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/cloudtrek365/2015/01/19/folder-permissions-backup-and-restore/</guid>
      <description><![CDATA[I ran into a problem where I needed to be able to backup and then restore permissions to some...]]></description>
      <content:encoded><![CDATA[<p>I ran into a problem where I needed to be able to backup and then restore permissions to some mailboxes. While this looks like it should be a straightforward thing to do, it turned out to be more complicated than I first though. I&#39;ll give you a word of warning on this right up front - this takes about&nbsp;one second <strong>per folder</strong> to gather permissions! If you think you&#39;re going to do a backup of 1000 mailboxes like this, with 50 folders per mailbox, well that&#39;s going to be something like 14 <strong>hours</strong> to run. Restores take even longer.</p>
<p>Here&#39;s the script I use for doing backups on mailbox folder permissions:</p>
<p><span style="color:#006400;font-family:courier new,courier;font-size:small;"><span style="color:#006400;"><span style="color:#006400;">#Save-FolderPermissions.ps1 - grb - 12/17/2014 - This script takes the user and gets folder permissions for the user, exporting it a CSV file.</span></span></span></p>
<p><span style="color:#008000;font-family:courier new,courier;font-size:small;">#variable setup</span></p>
<p><span style="color:#008000;font-family:courier new,courier;font-size:small;">#You can&nbsp;save only the permissions for the inbox and subfolders with &#39;/Inbox*&#39;, for example.</span></p>
<p><span style="font-family:courier new,courier;font-size:small;"><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$StartFolder</span></span></span><span><span> </span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">=</span></span></span><span><span> </span></span><span style="color:#8b0000;"><span style="color:#8b0000;"><span style="color:#8b0000;">&#39;/*&#39;</span></span></span></span></p>
<p><span style="font-family:courier new,courier;font-size:small;"><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$SaveDir</span></span></span><span><span> </span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">=</span></span></span><span><span> </span></span><span style="color:#8b0000;"><span style="color:#8b0000;"><span style="color:#8b0000;">&#39;c:\temp\&#39;</span></span></span></span></p>
<p><span style="font-family:courier new,courier;font-size:small;"><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$MailboxCount</span></span></span><span><span> </span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">=</span></span></span><span><span> </span></span><span style="color:#800080;"><span style="color:#800080;"><span style="color:#800080;">0</span></span></span></span></p>
<p><span style="color:#008000;font-family:courier new,courier;font-size:small;">#Import CSV of all the SMTP address of each of the mailboxes to get its permissions saved</span></p>
<p><span style="font-family:courier new,courier;font-size:small;"><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$Mailboxes</span></span></span><span><span> </span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">=</span></span></span><span><span> </span></span><span style="color:#0000ff;"><span style="color:#0000ff;"><span style="color:#0000ff;">Import-Csv</span></span></span><span><span> </span></span><span style="color:#000080;"><span style="color:#000080;"><span style="color:#000080;">-Path</span></span></span><span><span> (</span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$savedir</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">+</span></span></span><span style="color:#8b0000;"><span style="color:#8b0000;"><span style="color:#8b0000;">&quot;_FolderPermissionsMailboxes.csv&quot;</span></span></span><span><span>)</span></span></span></p>
<p><span style="font-family:courier new,courier;font-size:small;"><span style="color:#00008b;"><span style="color:#00008b;"><span style="color:#00008b;">Foreach</span></span></span><span><span> (</span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$Mailbox</span></span></span><span><span> </span></span><span style="color:#00008b;"><span style="color:#00008b;"><span style="color:#00008b;">in</span></span></span><span><span> </span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$Mailboxes</span></span></span><span><span>) {</span></span></span></p>
<p style="margin-left:30px;"><span style="font-family:courier new,courier;font-size:small;"><span><span> </span></span><span style="color:#006400;"><span style="color:#006400;"><span style="color:#006400;">#Define $Permissions as an array</span></span></span></span></p>
<p style="margin-left:30px;"><span style="font-family:courier new,courier;font-size:small;"><span><span> </span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$Permissions</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">=</span></span></span><span><span>@()</span></span></span></p>
<p></p>
<p style="margin-left:30px;"><span style="font-family:courier new,courier;font-size:small;"><span><span> </span></span><span style="color:#006400;"><span style="color:#006400;"><span style="color:#006400;">#We are going to get a running count of the mailboxes that we are doing. This can be a slow process, so we&#39;ll want a status.</span></span></span></span></p>
<p style="margin-left:30px;"><span style="font-family:courier new,courier;font-size:small;"><span><span> </span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$MailboxCount</span></span></span><span><span> </span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">+=</span></span></span><span><span> </span></span><span style="color:#800080;"><span style="color:#800080;"><span style="color:#800080;">1</span></span></span></span></p>
<p style="margin-left:30px;"><span style="font-family:courier new,courier;font-size:small;"><span><span> </span></span><span style="color:#0000ff;"><span style="color:#0000ff;"><span style="color:#0000ff;">echo</span></span></span><span><span> </span></span><span style="color:#8b0000;"><span style="color:#8b0000;"><span style="color:#8b0000;">&#39;=======================&#39;</span></span></span></span></p>
<p style="margin-left:30px;"><span style="font-family:courier new,courier;font-size:small;"><span><span> </span></span><span style="color:#0000ff;"><span style="color:#0000ff;"><span style="color:#0000ff;">echo</span></span></span><span><span> (</span></span><span style="color:#8b0000;"><span style="color:#8b0000;"><span style="color:#8b0000;">&#39;Gathering Statistics for: &#39;</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">+</span></span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$mailbox</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">.</span></span></span><span><span>SMTP)</span></span></span></p>
<p style="margin-left:30px;"><span style="font-family:courier new,courier;font-size:small;"><span><span> </span></span><span style="color:#0000ff;"><span style="color:#0000ff;"><span style="color:#0000ff;">echo</span></span></span><span><span> (</span></span><span style="color:#8b0000;"><span style="color:#8b0000;"><span style="color:#8b0000;">&#39;Mailbox &#39;</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">+</span></span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$MailboxCount</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">+</span></span></span><span><span> </span></span><span style="color:#8b0000;"><span style="color:#8b0000;"><span style="color:#8b0000;">&#39; of &#39;</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">+</span></span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$mailboxes</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">.</span></span></span><span><span>Count</span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">+</span></span></span><span style="color:#8b0000;"><span style="color:#8b0000;"><span style="color:#8b0000;">&#39; mailboxes&#39;</span></span></span><span><span>)</span></span></span></p>
<p></p>
<p style="margin-left:30px;"><span style="font-family:courier new,courier;font-size:small;"><span><span> </span></span><span style="color:#006400;"><span style="color:#006400;"><span style="color:#006400;">#Get the folders for the mailbox</span></span></span></span></p>
<p style="margin-left:30px;"><span style="font-family:courier new,courier;font-size:small;"><span><span> </span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$folders</span></span></span><span><span> </span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">=</span></span></span><span><span> </span></span><span style="color:#0000ff;"><span style="color:#0000ff;"><span style="color:#0000ff;">Get-MailboxFolderStatistics</span></span></span><span><span> </span></span><span style="color:#000080;"><span style="color:#000080;"><span style="color:#000080;">-Identity</span></span></span><span><span> </span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$mailbox</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">.</span></span></span><span><span>SMTP </span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">|</span></span></span><span><span> </span></span><span style="color:#0000ff;"><span style="color:#0000ff;"><span style="color:#0000ff;">?</span></span></span><span><span> {</span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$_</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">.</span></span></span><span><span>FolderPath </span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">-like</span></span></span><span><span> </span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$startfolder</span></span></span><span><span>} </span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">|</span></span></span><span><span> </span></span><span style="color:#0000ff;"><span style="color:#0000ff;"><span style="color:#0000ff;">Select</span></span></span><span><span> </span></span><span style="color:#8a2be2;"><span style="color:#8a2be2;"><span style="color:#8a2be2;">FolderPath</span></span></span></span></p>
<p style="margin-left:30px;"><span style="font-family:courier new,courier;font-size:small;"><span><span> </span></span><span style="color:#00008b;"><span style="color:#00008b;"><span style="color:#00008b;">Foreach</span></span></span><span><span> (</span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$folder</span></span></span><span><span> </span></span><span style="color:#00008b;"><span style="color:#00008b;"><span style="color:#00008b;">in</span></span></span><span><span> </span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$folders</span></span></span><span><span>) {</span></span></span></p>
<p style="margin-left:60px;"><span style="font-family:courier new,courier;font-size:small;"><span><span> </span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$FolderID</span></span></span><span><span> </span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">=</span></span></span><span><span> </span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$mailbox</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">.</span></span></span><span><span>SMTP</span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">+</span></span></span><span style="color:#8b0000;"><span style="color:#8b0000;"><span style="color:#8b0000;">&quot;:&quot;</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">+</span></span></span><span><span>(</span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$folder</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">.</span></span></span><span><span>FolderPath </span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">|</span></span></span><span><span> </span></span><span style="color:#0000ff;"><span style="color:#0000ff;"><span style="color:#0000ff;">Foreach-Object</span></span></span><span><span> {</span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$_</span></span></span><span><span> </span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">-replace</span></span></span><span><span> </span></span><span style="color:#8b0000;"><span style="color:#8b0000;"><span style="color:#8b0000;">&quot;/&quot;</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">,</span></span></span><span><span> </span></span><span style="color:#8b0000;"><span style="color:#8b0000;"><span style="color:#8b0000;">&quot;\&quot;</span></span></span><span><span>})</span></span></span></p>
<p style="margin-left:60px;"><span style="font-family:courier new,courier;font-size:small;"><span><span> </span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$Permission</span></span></span><span><span> </span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">=</span></span></span><span><span> </span></span><span style="color:#0000ff;"><span style="color:#0000ff;"><span style="color:#0000ff;">Get-MailboxFolderPermission</span></span></span><span><span> </span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$FolderID</span></span></span><span><span> </span></span><span style="color:#000080;"><span style="color:#000080;"><span style="color:#000080;">-ErrorAction</span></span></span><span><span> </span></span><span style="color:#8a2be2;"><span style="color:#8a2be2;"><span style="color:#8a2be2;">SilentlyContinue</span></span></span><span><span> </span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">|</span></span></span><span><span> </span></span><span style="color:#0000ff;"><span style="color:#0000ff;"><span style="color:#0000ff;">Select</span></span></span><span><span> </span></span><span style="color:#8a2be2;"><span style="color:#8a2be2;"><span style="color:#8a2be2;">Identity</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">,</span></span></span><span style="color:#8a2be2;"><span style="color:#8a2be2;"><span style="color:#8a2be2;">user</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">,</span></span></span><span style="color:#8a2be2;"><span style="color:#8a2be2;"><span style="color:#8a2be2;">AccessRights</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">,</span></span></span><span style="color:#8a2be2;"><span style="color:#8a2be2;"><span style="color:#8a2be2;">IsValid</span></span></span></span></p>
<p style="margin-left:60px;"><span style="font-family:courier new,courier;font-size:small;"><span><span> </span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$Permissions</span></span></span><span><span> </span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">+=</span></span></span><span><span> </span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$Permission</span></span></span></span></p>
<p style="margin-left:60px;"><span style="font-family:courier new,courier;font-size:small;">}</span></p>
<p style="margin-left:30px;"><span style="font-family:courier new,courier;font-size:small;"><span><span> </span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$Permissions</span></span></span><span><span> </span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">|</span></span></span><span><span> </span></span><span style="color:#0000ff;"><span style="color:#0000ff;"><span style="color:#0000ff;">Export-Csv</span></span></span><span><span> </span></span><span style="color:#000080;"><span style="color:#000080;"><span style="color:#000080;">-Path</span></span></span><span><span> (</span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$savedir</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">+</span></span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$mailbox</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">.</span></span></span><span><span>SMTP</span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">+</span></span></span><span style="color:#8b0000;"><span style="color:#8b0000;"><span style="color:#8b0000;">&quot;-FolderPermissions.csv&quot;</span></span></span><span><span>) </span></span><span style="color:#000080;"><span style="color:#000080;"><span style="color:#000080;">-NoTypeInformation</span></span></span></span></p>
<p style="margin-left:30px;"><span style="font-family:courier new,courier;font-size:small;">}</span></p>
<p></p>
<p><span style="font-family:courier new,courier;"><span style="color:#0000ff;"><span style="color:#0000ff;"><span style="color:#0000ff;">echo</span></span></span><span><span> </span></span><span style="color:#8b0000;"><span style="color:#8b0000;"><span style="color:#8b0000;">&quot;Completed&quot;</span></span></span></span></p>
<p></p>
<p><span style="color:#008000;font-family:courier new,courier;">#done</span></p>
<p></p>
<p></p>
<p>You might be wondering about this line:</p>
<p style="margin-left:30px;"><span style="font-size:small;"><span style="font-family:Courier New;"><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$FolderID</span></span></span><span><span> </span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">=</span></span></span><span><span> </span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$mailbox</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">.</span></span></span><span><span>SMTP</span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">+</span></span></span><span style="color:#8b0000;"><span style="color:#8b0000;"><span style="color:#8b0000;">&quot;:&quot;</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">+</span></span></span><span><span>(</span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$folder</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">.</span></span></span><span><span>FolderPath </span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">|</span></span></span><span><span> </span></span><span style="color:#0000ff;"><span style="color:#0000ff;"><span style="color:#0000ff;">Foreach-Object</span></span></span><span><span> {</span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$_</span></span></span><span><span> </span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">-replace</span></span></span><span><span> </span></span><span style="color:#8b0000;"><span style="color:#8b0000;"><span style="color:#8b0000;">&quot;/&quot;</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">,</span></span></span><span><span> </span></span><span style="color:#8b0000;"><span style="color:#8b0000;"><span style="color:#8b0000;">&quot;\&quot;</span></span></span><span><span>})</span></span></span></span></p>
<p>It would be nice if the Get-MailboxStatistics command output the folder in the same format that Get-MailboxFolderPermission used. Yeah, not so much. The above fine fixes the formatting between the two commands.</p>
<p></p>
<p>Remember, also, that we needed a CSV file, right? Heres&#39;s&nbsp;what&nbsp;that CSV file look like. It&#39;s just SMTP addresses of the mailboxes to be backed up, plus the header.</p>
<p></p>
<p style="margin-left:30px;"><span style="color:#000000;font-family:courier new,courier;font-size:small;"><span style="font-size:small;"><span style="font-size:small;">SMTP</span></span></span></p>
<p style="margin-left:30px;"></p>
<p style="margin-left:30px;"><span style="color:#000000;font-family:courier new,courier;">User1@contoso.com</span></p>
<p style="margin-left:30px;"></p>
<p style="margin-left:30px;"><span style="color:#000000;font-family:courier new,courier;">User2@contoso.com</span></p>
<p></p>
<p></p>
<p></p>
<p>Now we have to be able to do a restore. I have a script for that, too.</p>
<p></p>
<p><span style="color:#008000;font-family:courier new,courier;font-size:small;"><span><span>#Restore-FolderPermissions.ps1 - grb - 12/22/2014 - This script takes the user and imports folder permissions from a CSV file, restoring them.</span></span></span></p>
<p><span style="color:#008000;font-family:courier new,courier;font-size:small;">#variable setup</span></p>
<p><span style="font-family:courier new,courier;font-size:small;"><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$SaveDir</span></span></span><span><span> </span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">=</span></span></span><span><span> </span></span><span style="color:#8b0000;"><span style="color:#8b0000;"><span style="color:#8b0000;">&#39;c:\temp\&#39;</span></span></span></span></p>
<p><span style="font-family:courier new,courier;font-size:small;"><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$MailboxCount</span></span></span><span><span> </span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">=</span></span></span><span><span> </span></span><span style="color:#800080;"><span style="color:#800080;"><span style="color:#800080;">0</span></span></span></span></p>
<p><span style="color:#008000;font-family:courier new,courier;font-size:small;">#Import CSV of all the SMTP address of each of the mailboxes to get its permissions restored</span></p>
<p><span style="font-family:courier new,courier;font-size:small;"><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$Mailboxes</span></span></span><span><span> </span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">=</span></span></span><span><span> </span></span><span style="color:#0000ff;"><span style="color:#0000ff;"><span style="color:#0000ff;">Import-Csv</span></span></span><span><span> </span></span><span style="color:#000080;"><span style="color:#000080;"><span style="color:#000080;">-Path</span></span></span><span><span> (</span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$savedir</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">+</span></span></span><span style="color:#8b0000;"><span style="color:#8b0000;"><span style="color:#8b0000;">&quot;_FolderPermissionsMailboxes.csv&quot;</span></span></span><span><span>)</span></span></span></p>
<p><span style="font-family:courier new,courier;font-size:small;"><span style="color:#00008b;"><span style="color:#00008b;"><span style="color:#00008b;">Foreach</span></span></span><span><span> (</span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$Mailbox</span></span></span><span><span> </span></span><span style="color:#00008b;"><span style="color:#00008b;"><span style="color:#00008b;">in</span></span></span><span><span> </span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$Mailboxes</span></span></span><span><span>) {</span></span></span></p>
<p style="margin-left:30px;"><span style="font-family:courier new,courier;font-size:small;"><span><span> </span></span><span style="color:#006400;"><span style="color:#006400;"><span style="color:#006400;">#Define $Permissions as an array</span></span></span></span></p>
<p style="margin-left:30px;"><span style="font-family:courier new,courier;font-size:small;"><span><span> </span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$Permissions</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">=</span></span></span><span><span>@()</span></span></span></p>
<p></p>
<p style="margin-left:30px;"><span style="font-family:courier new,courier;font-size:small;"><span><span> </span></span><span style="color:#006400;"><span style="color:#006400;"><span style="color:#006400;">#We are going to get a running count of the mailboxes that we are doing. This can be a slow process, so we&#39;ll want a status.</span></span></span></span></p>
<p style="margin-left:30px;"><span style="font-family:courier new,courier;font-size:small;"><span><span> </span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$MailboxCount</span></span></span><span><span> </span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">+=</span></span></span><span><span> </span></span><span style="color:#800080;"><span style="color:#800080;"><span style="color:#800080;">1</span></span></span></span></p>
<p style="margin-left:30px;"><span style="font-family:courier new,courier;font-size:small;"><span><span> </span></span><span style="color:#0000ff;"><span style="color:#0000ff;"><span style="color:#0000ff;">echo</span></span></span><span><span> </span></span><span style="color:#8b0000;"><span style="color:#8b0000;"><span style="color:#8b0000;">&#39;=======================&#39;</span></span></span></span></p>
<p style="margin-left:30px;"><span style="font-family:courier new,courier;font-size:small;"><span><span> </span></span><span style="color:#0000ff;"><span style="color:#0000ff;"><span style="color:#0000ff;">echo</span></span></span><span><span> (</span></span><span style="color:#8b0000;"><span style="color:#8b0000;"><span style="color:#8b0000;">&#39;Restoring Permissions for: &#39;</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">+</span></span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$mailbox</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">.</span></span></span><span><span>SMTP)</span></span></span></p>
<p style="margin-left:30px;"><span style="font-family:courier new,courier;font-size:small;"><span><span> </span></span><span style="color:#0000ff;"><span style="color:#0000ff;"><span style="color:#0000ff;">echo</span></span></span><span><span> (</span></span><span style="color:#8b0000;"><span style="color:#8b0000;"><span style="color:#8b0000;">&#39;Mailbox &#39;</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">+</span></span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$MailboxCount</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">+</span></span></span><span><span> </span></span><span style="color:#8b0000;"><span style="color:#8b0000;"><span style="color:#8b0000;">&#39; of &#39;</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">+</span></span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$mailboxes</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">.</span></span></span><span><span>Count</span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">+</span></span></span><span style="color:#8b0000;"><span style="color:#8b0000;"><span style="color:#8b0000;">&#39; mailboxes&#39;</span></span></span><span><span>)</span></span></span></p>
<p></p>
<p style="margin-left:30px;"><span style="font-family:courier new,courier;font-size:small;"><span><span> </span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$Permissions</span></span></span><span><span> </span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">=</span></span></span><span><span> </span></span><span style="color:#0000ff;"><span style="color:#0000ff;"><span style="color:#0000ff;">Import-Csv</span></span></span><span><span> </span></span><span style="color:#000080;"><span style="color:#000080;"><span style="color:#000080;">-Path</span></span></span><span><span> (</span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$savedir</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">+</span></span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$mailbox</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">.</span></span></span><span><span>SMTP</span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">+</span></span></span><span style="color:#8b0000;"><span style="color:#8b0000;"><span style="color:#8b0000;">&quot;-FolderPermissions.csv&quot;</span></span></span><span><span>)</span></span></span></p>
<p style="margin-left:30px;"><span style="font-family:courier new,courier;font-size:small;"><span><span> </span></span><span style="color:#00008b;"><span style="color:#00008b;"><span style="color:#00008b;">Foreach</span></span></span><span><span> (</span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$Permission</span></span></span><span><span> </span></span><span style="color:#00008b;"><span style="color:#00008b;"><span style="color:#00008b;">in</span></span></span><span><span> </span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$Permissions</span></span></span><span><span>) {</span></span></span></p>
<p style="margin-left:60px;"><span style="font-family:courier new,courier;font-size:small;"><span><span> </span></span><span style="color:#0000ff;"><span style="color:#0000ff;"><span style="color:#0000ff;">Set-MailboxFolderPermission</span></span></span><span><span> </span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$Permission</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">.</span></span></span><span><span>Identity </span></span><span style="color:#000080;"><span style="color:#000080;"><span style="color:#000080;">-AccessRights</span></span></span><span><span> </span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$Permission</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">.</span></span></span><span><span>AccessRights </span></span><span style="color:#000080;"><span style="color:#000080;"><span style="color:#000080;">-User</span></span></span><span><span> </span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$Permission</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">.</span></span></span><span><span>User </span></span><span style="color:#000080;"><span style="color:#000080;"><span style="color:#000080;">-ErrorAction</span></span></span><span><span> </span></span><span style="color:#8a2be2;"><span style="color:#8a2be2;"><span style="color:#8a2be2;">SilentlyContinue</span></span></span><span><span> </span></span><span style="color:#000080;"><span style="color:#000080;"><span style="color:#000080;">-WarningAction</span></span></span><span><span> </span></span><span style="color:#8a2be2;"><span style="color:#8a2be2;"><span style="color:#8a2be2;">SilentlyContinue</span></span></span></span></p>
<p style="margin-left:60px;"><span style="font-family:courier new,courier;font-size:small;"><span><span> </span></span><span style="color:#0000ff;"><span style="color:#0000ff;"><span style="color:#0000ff;">Add-MailboxFolderPermission</span></span></span><span><span> </span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$Permission</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">.</span></span></span><span><span>Identity </span></span><span style="color:#000080;"><span style="color:#000080;"><span style="color:#000080;">-AccessRights</span></span></span><span><span> </span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$Permission</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">.</span></span></span><span><span>AccessRights </span></span><span style="color:#000080;"><span style="color:#000080;"><span style="color:#000080;">-User</span></span></span><span><span> </span></span><span style="color:#ff4500;"><span style="color:#ff4500;"><span style="color:#ff4500;">$Permission</span></span></span><span style="color:#a9a9a9;"><span style="color:#a9a9a9;"><span style="color:#a9a9a9;">.</span></span></span><span><span>User </span></span><span style="color:#000080;"><span style="color:#000080;"><span style="color:#000080;">-ErrorAction</span></span></span><span><span> </span></span><span style="color:#8a2be2;"><span style="color:#8a2be2;"><span style="color:#8a2be2;">SilentlyContinue</span></span></span><span><span> </span></span><span style="color:#000080;"><span style="color:#000080;"><span style="color:#000080;">-WarningAction</span></span></span><span><span> </span></span><span style="color:#8a2be2;"><span style="color:#8a2be2;"><span style="color:#8a2be2;">SilentlyContinue</span></span></span></span></p>
<p style="margin-left:60px;"><span style="font-family:courier new,courier;font-size:small;">}</span></p>
<p style="margin-left:30px;"><span style="font-family:courier new,courier;font-size:small;">}</span></p>
<p><span style="font-family:courier new,courier;"><span style="color:#0000ff;font-size:small;"><span style="color:#0000ff;font-size:small;"><span style="color:#0000ff;font-size:small;">echo</span></span></span><span style="font-size:small;"><span style="font-size:small;"> </span></span><span style="color:#8b0000;font-size:small;"><span style="color:#8b0000;font-size:small;"><span style="color:#8b0000;font-size:small;">&quot;Completed&quot;</span></span></span></span></p>
<p><span style="color:#008000;font-size:small;">#done</span></p>
<p></p>
<p>Why use both the &quot;set&quot; and &quot;add&quot; for the folder permissions? One of the commands will modify permissions and the other adds them if they are removed. Either might be needed, so we try both and just ignore the errors.</p>
<p><span style="font-family:verdana,geneva;"><span style="font-size:small;"><span style="font-size:small;"><span style="color:#0000ff;font-size:small;"><span style="color:#0000ff;font-size:small;"><span style="color:#0000ff;font-size:small;">&nbsp;</span></span></span></span></span></span></p>]]></content:encoded>
    </item>
    <item>
      <title>Uploading High Resolution Photos using PowerShell for Office 365</title>
      <link>https://docs.microsoft.com/archive/blogs/cloudtrek365/uploading-high-resolution-photos-using-powershell-for-office-365</link>
      <pubDate>Wed, 31 Dec 2014 09:29:18 GMT</pubDate>
      <dc:creator><![CDATA[Glenn Blinckmann]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/cloudtrek365/2014/12/31/uploading-high-resolution-photos-using-powershell-for-office-365/</guid>
      <description><![CDATA[When first trying to upload a high-res photo for user&rsquo;s mailboxes, you&rsquo;ll likely start...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family:Calibri;font-size:medium;">When first trying to upload a high-res photo for user&rsquo;s mailboxes, you&rsquo;ll likely start with the manual for Set-UserPhoto and try to write some Powershell script like the below command:</span></p>
<p style="margin-left:30px;"><span style="font-family:courier new,courier;font-size:small;">$user = &#39;john.doe@contoso.com&#39;</span></p>
<p style="margin-left:30px;"><span style="font-family:courier new,courier;font-size:small;">$userphoto = &quot;C:\Temp\&quot;+$user+&quot;.jpg&quot;</span></p>
<p style="margin-left:30px;"><span style="font-family:courier new,courier;font-size:small;">Set-UserPhoto -Identity $user -PictureData ([System.IO.File]::ReadAllBytes($userphoto)) -Confirm:$false</span></p>
<p><span style="font-family:Calibri;font-size:medium;">(Documentation for Set-UserPhoto is here: </span><a href="https://technet.microsoft.com/en-us/library/jj218694.aspx"><span style="color:#0563c1;font-family:Calibri;font-size:medium;">https://technet.microsoft.com/en-us/library/jj218694.aspx</span></a><span style="font-family:Calibri;font-size:medium;">)</span></p>
<p><span style="font-family:Calibri;font-size:medium;">When trying to run this, however, one might run into is an error when trying to upload a &gt;10 kb photo, saying &ldquo;The remote server returned an error: (413) Request Entity Too Large&rdquo;. There is a fix for this! In the script that you use to create an Exchange Online Powershell session, make sure that the yellow highlighted section below is added. The normal proxy method won&rsquo;t work for &gt;10kb files</span>.</p>
<p style="margin-left:30px;"><span style="font-family:courier new,courier;font-size:small;">$ExSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri <a href="https://outlook.office365.com/powershell-liveid/?proxymethod=rps"><span style="color:#0563c1;">https://outlook.office365.com/powershell-liveid/<span style="background-color:#ffff00;">?proxymethod=rps</span></span></a> -Credential $MSOLCred -Authentication Basic -AllowRedirection</span></p>
<p><span style="font-family:Calibri;font-size:medium;">Run the first script again, and it now&nbsp;works great with larger photos!</span></p>
<p><span style="font-family:Calibri;"><span style="font-size:medium;">Do keep in mind that the photos you upload should be 648 pixels by 648 pixels if you want the maximum photo size for Office 365. That size comes from the Lync documentation, which explains how Exchange creates the multiple sizes that get used throughout the system. </span></span><a href="https://technet.microsoft.com/en-us/library/jj688150.aspx"><span style="color:#0563c1;font-family:Calibri;font-size:medium;">https://technet.microsoft.com/en-us/library/jj688150.aspx</span></a></p>
<p></p>]]></content:encoded>
    </item>
  </channel>
</rss>