Office365 Equipment-Conference Room Mailbox Setting-PowerShell Studio

So there’s been few instances that i have come across on Office365 specifically to Equipment and Conference room Mailbox, if you just create the Conference room in office 365 and don’t change the settings that Outlook user will not be able to see who’s occupying the room and the conference room in Outlook Calendar will only say as “Busy”, not an ideal situation.

Now the Office portal doesn’t give you that ability to change the Mailbox properties, you have to do it through PowerShell, however the information isn’t just readily available with PowerShell too, you have to dig in a little bit and then make the changes.

so i have managed to get it done with PowerShell few times and i thought it would be cool so put that all as a tool and put it online so that anybody can use it, doesn’t really matter if you got PowerShell knowledge or not, so what better way that using PowerShell Studio to get it done.

so using PowerShell Studio i have combined the script in to a very specific small tool and putting it here so that you all can use it.

Download Instruction PDF from here:

https://dl.dropboxusercontent.com/u/69201487/Office365Mailbox/Office365Mailbox.pdf

Download Tool from here:

https://dl.dropboxusercontent.com/u/69201487/Office365Mailbox/OfficeMailboxUpdate.zip

 

Happy Learning

Hardeep

Azure Operating System Disk Resize

Recently one of my colleague ask me how to increase the size of Azure VM data disk, which is pretty straight forward however while working on it, i thought it would be nice to have a tool that can increase the size of Operating system disk, because that’s where’s users are usually little skeptical. Hence DiskMan came in to existence, i have made this tool using Powershell Studio, which is amazing and not only helps me in coding but such tools is a great way of learning too.

DiskMan was created to ease the process of increasing operating system disk drive on Azure Virtual Machines.

There are couple of ways you can increase the size of the operating disk, however most of them need some sort of familiarity with Azure portal or Powershell cmdlets, with DiskMan you don’t need to know either of them and you still will be able to increase the operating system disk size.

Here’s the exe link

https://dl.dropboxusercontent.com/u/69201487/DiskMan/DiskMan.zip

 

Here’s the instruction PDF.

https://dl.dropboxusercontent.com/u/69201487/DiskMan/DiskMan.pdf

 

Thanks

Hardeep

Sitecore Admin Pages Compatibility

We as a Developer / Architect have always been loving the Sitecore Admin pages. Sitecore 8.2 introduced new admin pages that allows more control and functionalities. There are already very nice posts sharing information about those admin pages. So this post is not repetition of the knowledge already shared, reference to these blog posts are shared at the end of this post in Nice Reads section.

The motive here is to show Sitecore admin page’s that are released in 8.2 compatibility with earlier versions of Sitecore.

Sitecore

Admin Pages

7.0

7.1

7.2

7.5

8.0

8.1

Database Cleanup

Dependency Injection Configuration

x

x

x

x

x

x

EventQueue Statistics

Install language

x

x

x

x

x

Jobs Viewer

x

x

x

x

x

x

Logs

Package Item

PublishQueue statistics

Raw Search

Rebuild Key Behavior Cache

x

x

x

x

x

x

Security Tools

Sql Shell

Support Package

User Info

 

Why Compatibility?

While working on a project with Sitecore 8.1 – update-3 which went live just few weeks back before Sitecore 8.2 was released, we do not have option to upgrade the project with Sitecore 8.2 immediately. We also wanted to take advantage of the newly released Sitecore Admin pages and thought why can’t we have it for Sitecore 8.1?

 

Dumping the new admin pages into Sitecore 8.1 and adding a dll to the bin folder worked. A thought triggered to me and I went a step further and came up with the compatibility table for admin pages.

How to add Admin pages to earlier Sitecore Versions?

1)      Copy the admin pages mentioned in the compatibility table above.

2)      Copy Sitecore.ExperienceContentManagement.Administration.dll to the bin folder of Sitecore Website.

Wow! now you have new Sitecore admin pages from 8.2 till Sitecore 7.0.

Nice Reads

–          Sitecore Admin Pages Cheat Sheet – New Tools by Kamruz Jaman

–          New admin pages in Sitecore 8.2 by Ashish Bansal

–          Sitecore Admin Pages Cheat Sheet by Nikola Gotsev

Sitecore Bucket Structure – Item Field Value Based

Bucketing structure in Sitecore is a rule based where the default structure is derived from this setting

In this blog post I am going to share how we can create a bucket structure based on a field value of the item being created into a bucket as in consider News Articles or Products which has a field “Release Date” / “Posted Date”. It is good to create bucket structure based on these dates as compared to the created date of the item. Why? Content Authors can easily navigate through the bucket as they will have in hand information about when a new articles or product was released rather than remembering the created date of the Sitecore item.

So let’s buckle up seat belt and get hands on to see who we can achieve it,

Create a RuleAction class NewsReleaseDate that inherits from Sitecore.Buckets.Rules.Bucketing.RuleAction

public class NewsReleaseDateBasedPath : RuleAction

where T : BucketingRuleContext

{

#region ...Properties

public string Format { get; set; }

#endregion

#region ...Public Methods

public const string CST = "Central Standard Time";

public override void Apply(T ruleContext)

{

string format = this.Format;

if (string.IsNullOrEmpty(format))

{

//Take the format for creating bucket structure from a custom setting defined in a configuratoin file

format = Sitecore.Configuration.Settings.GetSetting("BucketConfiguration.NewsReleaseDatePathFormat", "yyyy/MM/dd");

}

DateTime releaseDate = ConvertToCst(DateTime.UtcNow);

//master database is referenced as command runs under Core DB context

var item = Sitecore.Data.Database.GetDatabase("master").GetItem(ruleContext.NewItemId);

//if item is null bucket structure will be creadetd in default format

//So pass the yyyy/MM/dd format

if (item == null)

{

ruleContext.ResolvedPath = releaseDate.ToString(format, Context.Culture);

return;

}

//AutoGenerated Model class for new article base

NewsArticleBaseItem newsItem = new NewsArticleBaseItem(item);

if (newsItem == null) return;

//Read the release date field value

if (newsItem.ReleaseDate!=null && !String.IsNullOrEmpty(newsItem.ReleaseDate.ToString()))

{

releaseDate = ConvertToCst(newsItem.ReleaseDate.DateTime.ToUniversalTime());

}

ruleContext.ResolvedPath = releaseDate.ToString(format, Context.Culture);

}

public DateTime ConvertToCst(DateTime utcDate)

{

return TimeZoneInfo.ConvertTimeFromUtc(utcDate, TimeZoneInfo.FindSystemTimeZoneById(CST));

}

#endregion

}

Now make few tweaks to Sitecore,
1) Create Element Folder at path /sitecore/system/Settings/Rules/Definitions/Elements/

NewsReleaseDateBucketing-1

2) Create a new action and update the type field to refer to the code class created earlier.

NewsReleaseDateBucketing-2

3) On Item Buckets Setting at path /sitecore/system/Settings/Buckets/Item Buckets Settings
Add the rule and action for your template

NewsReleaseDateBucketing-3

Click on the Edit Rule to add new rule and action for News Release Date

NewsReleaseDateBucketing-4

You will see Bucketing News Elements folder now available

NewsReleaseDateBucketing-5

Save the Item bucket settings item and we are all set to create a news article which will get stored initially with the created date as you have still not changed the valued of the release date of the new news article. Once the release date field is updated the news article will move to the bucket structure based on the value provided in the release date field.

That’s all for now I have to share keep Sitecoring and keep sharing because “Sharing is Caring”

Sitecore KeepAlive config patching

The heartbeat of Sitecore is it’s keepalive.aspx which keeps Sitecore alive and working continuously. There is a good KB article provided by sitecore “Automatic site recycling after the site has been idle for a period” to understand what a KeepAlive.aspx is all about. Another good read is “Keeping Sitecore alive”.

During an implementation in a scaled environment where we had separate CM, Publishing and Aggregation cum Processing server or multiple CD servers, we need to make sure all the environments are up and running all the time. Adding the url of keepalive.aspx on a server which hits itself does not works all the times as the website might be down due to apppool recycle or the machine itself got restarted and there has been no first request yet made to sitecore. The KeepAlive agent can run only if sitecore is up and a first request has already been made after the appPool recycle.

So one of the option is to make sitecore keealive agent hit url of other servers in the vicinity.

Here’s an example for CD servers hitting each other,


<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">

<sitecore>

<scheduling>

<agent patch:before="*[@type='Sitecore.Tasks.TaskDatabaseAgent']" name="CD01" type="Sitecore.Tasks.UrlAgent" method="Run" interval="00:15:00">

<param desc="url">http://CD1hostname/sitecore/service/keepalive.aspx</param>

<LogActivity>true</LogActivity>

</agent>

<agent patch:after="*[@name='CD01']" type="Sitecore.Tasks.UrlAgent" name="CD02" method="Run" interval="00:15:00">

<param desc="url">http://CD2hostname/sitecore/service/keepalive.aspx</param>

<LogActivity>true</LogActivity>

</agent>

</scheduling>

</sitecore>

</configuration>

Example of CM, Publishing Instance and Aggregation / Processing Server hitting each other,


<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">

<sitecore>

<scheduling>

<agent patch:before="*[@type='Sitecore.Tasks.TaskDatabaseAgent']" name="CM01" type="Sitecore.Tasks.UrlAgent" method="Run" interval="00:15:00">

<param desc="url">http://CM01hostname/sitecore/service/keepalive.aspx</param>

<LogActivity>true</LogActivity>

</agent>

<agent patch:after="*[@name='CM01']" type="Sitecore.Tasks.UrlAgent" name="CD02" method="Run" interval="00:15:00">

<param desc="url">http://CM02hostname/sitecore/service/keepalive.aspx</param>

<LogActivity>true</LogActivity>

</agent>

<agent patch:after="*[@name='CM02']" type="Sitecore.Tasks.UrlAgent" name="PI01" method="Run" interval="00:15:00">

<param desc="url">http://PI01hostname/sitecore/service/keepalive.aspx</param>

<LogActivity>true</LogActivity>

</agent>

<agent patch:after="*[@name='PI01']" type="Sitecore.Tasks.UrlAgent" name="AG01" method="Run" interval="00:15:00">

<param desc="url">http://AG01hostname/sitecore/service/keepalive.aspx</param>

<LogActivity>true</LogActivity>

</agent>

</scheduling>

</sitecore>

</configuration>

 

Let’s validate what we see at /sitecore/admin/showconfig.aspx

KeepAlive-1

You might be wondering why do I need to add “name” attribute to all the agent nodes and use patch:after / patch:before. Her’s the reason why, if we use the below patching sitecore only picks the last node and ignores patching of all the other agent.


<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">

<sitecore>

<scheduling>

<!-- The time format is "HH:MM:SS" -->

<agent type="Sitecore.Tasks.UrlAgent" method="Run" interval="00:05:00">

<!-- Replace [WEBSITE] with the appropriate domain -->

<param desc="url">http://CD01hostname/sitecore/service/keepalive.aspx</param>

<LogActivity>true</LogActivity>

</agent>

<agent type="Sitecore.Tasks.UrlAgent" method="Run" interval="00:05:00">

<!-- Replace [WEBSITE] with the appropriate domain -->

<param desc="url">http://CD02hostname/sitecore/service/keepalive.aspx</param>

<LogActivity>true</LogActivity>

</agent>

</scheduling>

</sitecore>

</configuration>

The resultant config patching if seen using /sitecore/admin/showconfig.aspx would reveal that it only picked the last node of the agent.
KeepAlive-2

Schedule Tasks not executing – Processing Server

Are you trying to figure out why a Sitecore Scheduled tasks in not getting executed? There are good amount of reasons for that and you should be looking at these links to get it working for you.

–          Scheduled task is not getting executed

–          Sitecore Schedule task not running

Oh! You already went through these links still the tasks are not running? Keep reading as I too was haunted with the issue.

Thank you Alok Kadudeshmukh (one of the brighter brains around me who blogs about Sitecore at Learn Sitecore Basics) to point me to the correct direction.

Reason why scheduled tasks were not executing

We configured a separate server for Aggregation and Processing and that server was down due to licensing issues. Drilling further into the details I figured out that the agents which are responsible for executing the scheduled tasks are now a part of Sitecore.Processing.config file.


        core
        /sitecore/system/tasks/schedules
        true
      
      
      
        master
        /sitecore/system/tasks/schedules
        true
       

Hence the scheduled tasks get executed on Processing server and not the Content Management server.

When did Sitecore change this?

Sitecore.Processing.config was introduced in Sitecore Experience Platform 8.0 rev. 150121 (8.0 Update-1)

SOLR DOWN DOMINO EFFECT ON SITECORE CD AND CM SERVER

Is your Sitecore Content Management and Content Delivery Server down? Well the reason being you have configured your Sitecore installation to use SOLR as a search platform and the SOLR server itself is down. What? Seriously…. SOLR server triggers a DOMINO effect on the CM and CD servers if it is down. Something we would not want to happen in a production environment. We faced this issue few days back on one of our QA environment. The best way out was to contact Sitecore Support who then reported it as a bug and provided a solution which I am sharing it here.

solr down

Follow below steps and that would be it all,

  1. Copy ‘Sitecore.Support.391039.dll’ assembly to the ‘\bin’ folder.
  2. Copy ‘Sitecore.Support.391039.config’ file to the ‘\App_Config\Include’ folder.
  3. Update all the Solr index configuration files (for each Solr index):
<configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">

<indexes hint="list:AddIndex">

. . .

<index id="<index_name>" type="Sitecore.Support.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.Support.391039">

You will still need to work upon bringing up the SOLR server. This is how this fix works, it checks if Solr is up on Sitecore start. If no, it skips indexes initializing. However, it may lead to exceptions in log files and inconsistencies while working with Sitecore when Solr is down.

Also, there is an agent defined in the ‘Sitecore.Support.391039.config’ that checks and logs the status of Solr connection every minute (interval value should be changed if needed).

If the Solr connection is restored — indexes will be initialized, the corresponding message will be logged and the search and indexing related functionality will work fine.

Remote LogCollector (Powershell GUI Tool made using Powershell Studio 2015)

Here’s another tool that i have made using Powershell Studio, the purpose of the tool is to collect Event log data from local computer and from remote computer as well.

Once you run the tool you will see there are two tabs Local and Remote. Local tab will only fetch data from local system on which it is running, once the tool is connected to local server using “Connect” button it will auto populate the query section with all the types of available logs.

Select the type of log that you would like to view and say load, it will then populate the data in the white space below step 2.

If you would like to export the results in CSV or HTM format you can select the radio button at the same time you can select “Open Results Automatically” and it will open result for you.

Similarly you can produce same result with steps mentioned above for Remote system, just click on Remote tab, connect to remote system (Powershell required) and it should fetch all the logs details.

Download link:

https://dl.dropboxusercontent.com/u/69201487/EventLogCollector/EventLogCollector.zip

Thanks

Hardeep

PowerAdmin (A Powershell GUI Tool Made Using Powershell STudio 2015)

For quite some time i have been working on Powershell and i always wanted to have a GUI available for the powershell scripts that i have prepared, there are different ways you can do it, however i find Powershell Studio 2015 as the best way to have a GUI for Powershell.

So here’s the first version of PowerAdmin (beta), the documentation will take some time, but a small description is as below:

1. Local Computer Tab, all the button available on Local Computer tab will execute on local machine, for eg: If you click the Service button you will get only local services.

2. Remote Computer Tab, as the name says, you can fetch information from remote computer, however to do so, you will have to first establish a remote session with the computer.

3. Azure cloud, with limited feature available on PowerAdmin about Azure, you can login to Azure and create VM, get VM info, Delete VM, Get Images, you can even have session with individual computer and find out their process. ( I intend to add more to this as time permits).

4. Security, you can fetch all local LAN info from security tab, for eg: if you click Sweep LAN button, it will go and sweep Lan for IP addresses and find out which service is active on which port.

5. RDP, as the name says, you can create RDP session here.

DOWNLOAD PowerAdmin. https://dl.dropboxusercontent.com/u/69201487/PowerAdmin(beta)/PowerAdmin.zip

Try out, its not completely ready yet, it’s in beta version, but worth trying.

Happy Powershelling.

Hardeep