Monday, 26 October 2015

Set/Share user calendar access

First connect to the Office 365 using instruction in the below url

http://yoursolutionshut.blogspot.in/2015/05/managing-office-365-using-powershell.html

Then run this command

Add-MailboxFolderPermission -Identity arun@abc.com:\Calendar  -AccessRight ReadItems  -User kumar@abc.com

Above command will set the read accss to Arun's calendar to Kumar.
Now Kumar can add and read Arun's calender

How to revoke the access

Remove-MailboxFolderPermission -Identity arun@abc.com:\Calendar  -User kumar@evolving.com

Above command will revoke the changes.
 

Thursday, 2 July 2015

Enable or Disable Clutter for Office 365 User Mailboxes

First, connect to Office 365 using PowerShell

Run below command to check the status of the Clutter

Get-Clutter -Identity username@domain.com

IsEnabled   : False
Identity    :
IsValid     : True
ObjectState : New

Above output shows that clutter is disabled on this mailbox.


To enable clutter on one user

Set-Clutter -Identity username@domain.com -Enable $True

To disable clutter on one user

Set-Clutter -Identity username@domain.com -Enable $False

To enable clutter on all users

Get-Mailbox | Set-Clutter -Enable $True

To disable clutter on all users

Get-Mailbox | Set-Clutter -Enable $False

Generate a report on all Office 365 users with Clutter enabled or disabled

Connect to the mail Office 365 using PowerShell as mentioned above
In addition to that add below command

Set-ExecutionPolicy Unrestricted

Above command will let you run the powershell scripts without any restrictions.
Now download the powershell script and place it on your desktop.
Now run go to that location and run the script

PS C:\Users\user\Desktop> .\Get-ClutterDetails.ps1

Security warning
Run only scripts that you trust. While scripts from the internet can be useful,
 this script can potentially harm your computer. If you trust this script, use
the Unblock-File cmdlet to allow the script to run without this warning
message. Do you want to run C:\Users\knkumar\Desktop\Get-ClutterDetails.ps1?


It will prompt to run the script, type R and hit enter

[D] Do not run  [R] Run once  [S] Suspend  [?] Help (default is "D"): R

Now it will prompt for credentials, provide global administrator credentials.

It will process on all the mailboxes and generate a report on your desktop

Completed - data saved to ClutterDetails.csv

Saturday, 27 June 2015

Changing the Primary AD FS 2.0 Server in an AD FS 2.0 Farm with PowerShell


PowerShell can be used to quickly identify the primary server in an AD FS 2.0 farm. When you deploy AD FS 2.0 and setup with a default install, it will use Windows Internal Database (WID). In this setup the WID database on the Primary AD FS server is a read/write copy. All the Secondary AD FS server(s), in the farm, have a read only copy that is synchronizes from the Primary.

  • Run this command to view the role of the server and see who it’s synchronizing the database changes from.
Add-PsSnapin Microsoft.Adfs.PowerShell 
 Get-ADFSSyncProperties

Command run on an AD FS Primary Server
 

Command run on an AD FS Secondary Server
 


In the event that you lose the Primary AD FS server in the farm, you can move the role to any Secondary Server in the same farm. This again is done through PowerShell with a simple command.

  • Run this PowerShell command on the Secondary AD FS server that you want to make Primary AD FS server.
Set-AdfsSyncProperties -Role PrimaryComputer
And then
  • Run this command to view the current role. It should change to PrimaryComputer
Get-ADFSSyncProperties
 


Now that the Primary role is moved you must update all the other Secondary servers, if you have more than two Secondary servers in the farm.

Run this PowerShell command on the other Secondary AD FS servers so that they now sync with the new AD FS Primary server

Set-AdfsSyncProperties -Role SecondaryComputer -PrimaryComputerName FQDN of ADFS Primary Server.

Now that the Primary role is moved you must update all the other Secondary servers, if you have more than two Secondary servers in the farm.

 How the ADFS configuration database is synchronized

Because of the important role that the AD FS configuration database plays, it is made available on all the federation servers in the network to provide fault tolerance and load-balancing capabilities when processing requests (when network load-balancers are used). However, for secondary federation servers to serve in this capacity, the AD FS configuration database that is stored on the primary federation server must be synchronized.
When you add a federation server to the farm, the new computer that will become a secondary federation server connects to the primary federation server to replicate the copy of the AD FS configuration database. From this point forward, the new federation server continues to pull updates from the primary federation server on a regular basis, as shown in the following illustration.

 

Each secondary federation server polls the primary federation server every five minutes for changes. You can adjust this default five-minute value or force an immediate synchronization anytime by using a Windows PowerShell cmdlet. 
The WID synchronization process also supports incremental transfers for more efficient transfers of intermediate changes. The incremental transfer process requires substantially less traffic on a network, and transfers are completed much faster.

How To change the adfs database Sync frequency between Primary and  Secondary 



By default the sync frequency is set to 5 minutes(300 sec). Using above command we can set it to 1 minute(60 sec).