Showing posts with label powershell. Show all posts
Showing posts with label powershell. Show all posts

Tuesday, October 9, 2018

Enabling modern authentication (ADAL) on Skype for Business

By default, Skype for Business requires users to use App Passwords for logging into Skype for Business.

I'm stealing the info from this post from this excellent tutorial:
https://www.ronnipedersen.com/2017/07/11/enable-modern-authentication-for-skype-for-business-online

I'm simplifying for my future use.  Important note - the DNS records as defined by Microsoft should be in place before going through this process.  Particularly, there should be a CNAME record pointing lyncsicover.domainname.com to webdir.online.lync.com.

First, download the Visual Basic C++ 2017 redistributable from here:
https://aka.ms/vs/15/release/VC_redist.x64.exe

This is needed for the Skype for Business Powershell installer.

Then download the Skype for Business Powershell installer itself:
https://download.microsoft.com/download/2/0/5/2050B39B-4DA5-48E0-B768-583533B42C3B/SkypeOnlinePowerShell.Exe


Then run PowerShell and run these commands:
$sfboSession = New-CsOnlineSession -UserName user@domain.com
Import-PSSession $sfboSession

Then run:
Get-CsOAuthConfiguration

You'll find a line for "ClientAdalAuthOverride" which will likely show "disabled" which is the behavior we want to change.

Run this command:
Set-CsOAuthConfiguration -ClientAdalAuthOverride Allowed

This process allows ADAL (aka modern authentication).  The tutorial I am replicating says this change can take up to 24 hours to take effect, but it often takes effect within one hour.



Tuesday, May 30, 2017

Replicating Windows 10 Start Menu layout

I found this great post on how to replicate the Windows 10 Start Menu to other profiles on the same computer.

In brief, run this command from powershell to export the start menu as you've configured it:
Export-Startlayout -path C:\Windows\Temp\SMenu.xml

Then run this command from powershell to apply that layout to all other profiles:
Import-StartLayout -LayoutPath C:\Windows\Temp\SMenu.xml -MountPath $env:SystemDrive\

Sunday, September 18, 2016

Removing email proxy addresses from AD (helpful if you sync your AD to Office365)

Right now, this is a partial post while I get the PowerShell scripting components together. I needed to remove all the proxy addresses for a certain domain in advance of removing that certain domain from our Office365 account. Because we sync our local AD with Office365, I need to remove the proxy addresses from the local AD.  I could do this manually, of course - which is long and inefficient.  The crucial command I used is this one:

Set-ADUser username -Remove @{ProxyAddresses="smtp:username@domain.com"}

I ran this from "Active Directory Powershell for Windows PowerShell"



Because I'm not good enough with PowerShell yet, here's what I did.  I tried to remove the domain from the account in Office365.  Office365 returned all the mailboxes that had the domain as aliases.  I copied and pasted the list of mailboxes to Excel.  I extracted the mailbox user names from the list and made a single column in Excel of those mailbox names (in my case - our domain uses a username of joe.smith as the username for Joe Smith) so the single column included Joe.Smith.  Then I did a mail merge with that list to create a get that PowerShell command listed above to be individualized with each username.  And then I copied and pasted those commands into PowerShell.  Not ideal.  Ideally, you'd have a foreach command that would run though all AD users, but this is a story about what I did at this moment.  I'll update this post.


Wednesday, July 8, 2015

uninstall SBS 2008 from domain

My broadstroke steps to uninstall SBS 2008 from my domain.


  1. delete all offline address books in EMC
  2. delete all public folders with these two PowerShell commands: https://technet.microsoft.com/en-us/library/bb201664(v=exchg.140).aspx
  3. Disable and then purge all user mailboxes (you do not delete mailboxes as this also deletes the active directory accounts as well)
    a. You do not delete mailboxes, but rather you go to recipient configuration -> mailbox in EMC and highlight all mailboxes and choose "disable"
    b. You'll see all the mailboxes go to the disconnected mailboxes section
    c. Now, you run these two commands to purge the mailboxes in an elevated Exchange Shell:
    d. $users = Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid
    e. $users | ForEach { Remove-Mailbox -Database "Mailbox Database" -StoreMailboxIdentity $_.MailboxGuid -confirm:$false }
    f. Credit for those two commands goes here: http://www.geekyprojects.com/microsoft-server-tutorials/how-to-purge-or-delete-a-disconnected-mailbox-in-exchange-2007/
  4. Uninstall Exchange (required following several KBs with steps on deleting things like OAB, user mailboxes, public folders, send connectors, etc)
  5. Transfer the 5 FSMO roles to a new domain controller with the global catalog role via these steps
  6. Remove Active Directory Certificate Services
  7. Demote the SBS server
  8. Remove the SBS server from the domain (put in a workgroup)
  9. Disable and/or remove WSUS from group policy via these steps
IMPORTANT NOTE - When I did a dcpromo to demote my SBS 2008, it somehow broke my DFS namespace even though the SBS 2008 server was *not* the host of this namespace.  I ended up having to create a new namespace after I had demoted the SBS server.  This is definitely something to check on future SBS uninstallations.

Wednesday, April 29, 2015

Get list of active users and last logon time in Office365 PowerShell

This PowerShell command will give you the list of users in the system and their last logon time:

Get-mailbox -resultsize unlimited| Get-MailboxStatistics | select displayname, lastlogontime | sort-object lastlogontime


Thursday, April 16, 2015

Office365 Whitelist and Blacklisting

This is a consolidation of information I've found on blacklisting and whitelisting in Office365:

Whitelisting or blacklisting by IP address:
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQ_oRstwdgLIv5vRX6VQlGA0QGL4ZcT6-2iEWPnTmyyWeV3iI-LV_4J-64rlxpEQ4VlBbag6HA_STunISwGfyvWvJxDHAh9Rm8g3iiK1wPO29nIZBNK7NpOlkxbmtw3M9COO_lSjb_hNU/s1600/20131125.king.net.office365.howto.whitelist.JPG

Exchange Admin Center -> Protection -> Connection Filter -> connection filtering by IP address



Whitelist by domain name:
http://www.mattwharton.co.uk/2014/08/how-to-whitelist-a-domain-in-office-365-exchange-online.html
or
http://www.office365tipoftheday.com/2013/12/02/whitelist-a-domain-to-bypass-exchange-online-protection-spamfilter/

Exchange Admin Center -> Mail Flow -> Create New Rule -> Bypass spam filtering -> Apply this rule ... if the sender domain is


Powershell configuration:
https://support.microsoft.com/en-us/kb/2545137?wa=wsignin1.0



Monday, March 24, 2014

altering retention policy for deleted items in Office365

By default, Office365 mailboxes retain deleted items for 30 days.  This is a bit short, I think.  I typically like to make this limit 90 days to one year.  Here are the powershell commands needed to run to make that happen (365 days in this example):

PS C:\scripts> enable-organizationcustomization
PS C:\scripts> Set-RetentionPolicyTag "Deleted Items" -AgeLimitForRetention 365


This is based on getting into PowerShell, based on my directions here:
http://t-solve.blogspot.com/2013/11/how-i-configure-script-to-get-into.html



Wednesday, November 20, 2013

how I configure a script to get into a Powershell CLI for editing Office365 properties

I was setting up a laptop to use a script to get into a Powershell CLI and wanted to document what I used to get in.

You'll need to download two items to enable PowerShell:

1) Microsoft Online Services Sign-in Assistant
2) Azure AD Module for Windows PowerShell

from here:

https://technet.microsoft.com/library/dn975125.aspx


You may need to install .net 3.5 from turn windows features on/off.

Then I created a folder on the root C called scripts.  In there, I created a file called office365.ps1 with these contents:
---
Import-Module MSOnline
$O365Cred = Get-Credential
$O365Session = New-PSSession –ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $O365Cred -Authentication Basic -AllowRedirection
Import-PSSession $O365Session
Connect-MsolService –Credential $O365Cred
---

Then I make edits by opening powershell.  Navigate to c:\scripts and run office365.ps1.  Of note, you might also need to enable remote execution (Set-ExecutionPolicy RemoteSigned) like this:









From there, I use the commands I described in this post:
http://t-solve.blogspot.com/2013/01/office365-shell-commands-for-reference.html



When I need to run a Powershell script, I open powershell, navigate to c:\scripts, and I run office365.ps1 like this:


Thursday, January 24, 2013

Office365 Shell Commands (for reference)

As of 3/5/13, here are the commands I have used for adjusting Office365.  Generally, I run a PowerShell script the enters all the commands for me once I log in.  I describe the process for setting up and using the PowerShell script here:
http://t-solve.blogspot.com/2013/11/how-i-configure-script-to-get-into.html


From there, I can run any of these commands

remove password expiration:
Get-MsolUser | Set-MsolUser –PasswordNeverExpires $True

remove password complexity requirements:
Get-MsolUser | Set-MsolUser -StrongPasswordRequired $false
(of note - you can only set non-complex passwords via shell, not in the web interface, the web interface will still require complex passwords.  And all passwords, even in the shell, must be 8 characters long)

set user password in the shell:
Set-MsolUserPassword -UserPrincipalName user@contoso.com  -NewPassword "orange42" -ForceChangePassword $false

give Bob full access to Joe's mailbox:
Add-MailboxPermission -identity joe@contoso.com -user bob@contoso.com -AccessRights FullAccess

remove Bob's full access to Joe's mailbox:
Remove-MailboxPermission -Identity joe@contoso.com -User bob@contoso.com -AccessRights FullAccess

give Bob send as access to Joe's mailbox:
Add-RecipientPermission joe@contoso.com -AccessRights SendAs -Trustee bob@contoso.com -Confirm:$false

forward Joe's email to Bob (oddly, for the mailbox to be forwarded, you enter the mailbox name and enter the address for where you're forwarding):
Set-Mailbox -Identity joe.smith -DeliverToMailboxAndForward $true -ForwardingSMTPAddress bob@contoso.com

check forwarding status of a Joe's mailbox:
Get-Mailbox jos.smith| Ft ForwardingSMTPAddress

cancel forwarding of Joe's email
Set-Mailbox -Identity joe.smith -DeliverToMailboxAndForward $false -ForwardingSMTPAddress $null

give Bob.Jones publishing editor permission to Joe.Smith's calendar (in this command, you use usernames and not full email addresses):
Add-MailboxFolderPermission -Identity “Joe.Smith:\Calendar” -AccessRights PublishingEditor -User Bob.Jones

give Bob.Jones publishing editor permission to Joe.Smith's contacts (in this command, you use usernames and not full email addresses):
Add-MailboxFolderPermission -Identity “Joe.Smith:\Contacts” -AccessRights PublishingEditor -User Bob.Jones

In the two commands above, possible permissions are: Owner, PublishingEditor, Editor, PublishingAuthor, Author, NonEditingAuthor, Reviewer, Contributor, AvailabilityOnly, LimitedDetails

Monday, July 26, 2010

sending spam to junk email folder on Exchange 2007/2010

When configuring actions on detected spam on Exchange 2007 and 2010, there is no option to send it to the junk email folder when configuring it on the EMC. This is absurd. It looks like this (shown here are the actions on the content filter):



As stupid as it is, the way you can configure an SCL to be sent to the junk e-mail folder is through the PowerShell.

This command will send all junk with an SCL of 4 or higher to junk e-mail:

Set-OrganizationConfig -SCLJunkThreshold 4

I put this command on all my Exchange servers. I also disable all outright rejection of spam. Users hate it when legitimate email gets rejected. All spam goes into the junk email folder.


More info on this issue is located here:
http://technet.microsoft.com/en-us/library/bb738127(v=exchg.80).aspx

Tuesday, May 18, 2010

viewing mailbox size in Exchange 2007

There isn't a GUI method (as far as I can tell) for viewing mailboxes sizes. This page talks about a powershell command to show mailbox sizes:

http://www.exchangeninjas.com/MailboxSizeReport