"The value of a man should be seen in what he gives and not in what he is able to receive"

― Albert Einstein ―

How to unlock the Sitecore admin user account?

Unlock Sitecore Admin Account
Unlock Sitecore Admin Account


You can easily unlock the Sitecore Admin password if you have access to the Sitecore Core database using the below SQL statement.


UPDATE  aspnet_Membership 
SET     IsLockedOut = 0, 
        FailedPasswordAttemptCount = 0
WHERE   UserId IN (SELECT UserId FROM aspnet_Users WHERE UserName = 'sitecore\Admin')

"Unable to authenticate, need: Bearer authorization_uri" when trying to run npm install command

"Unable to authenticate, need: Bearer authorization_uri" when trying to run npm install command
"Unable to authenticate, need: Bearer authorization_uri" when trying to run npm install command
It's early in the morning and you woke up thinking it's a great day I will complete all of my tasks but then you remember you had to pull some changes from DevOps. You open your computer and run npm install but wait Why am I getting this message now "Unable to authenticate, need: Bearer authorization_uri". Welcome to the frustration morning but Do Not worry we have a very simple fix. First of all, make sure you have .npmrc file is placed in the root directory of your project. if you do not have the file then create one.
1) Open notepad
2) Paste the below two lines in the file (make sure to replace the registry URL with your URL)

registry=https://pkgs.dev.azure.com/mydevOpsAccount/_packaging/myproject/npm/registry/
always-auth=true

3) type the following to name the file: .npmrc. (make sure you have the dot in the beginning and at the end of the file name. The dot at the end of the name will tell windows to create an extensionless file.
4) Save As Type: All Files
5) Click Save

Once .npmrc file is in your root directory then run the command below.

vsts-npm-auth -config .npmrc

The morning frustration is over.
NPM Frustration Over - Let's go for a hike
NPM Frustration Over - Let's go for a hike

How do you check Powershell Variable for either null or Whitespace?


Check for Null or WhiteSpace


So it's always a good idea to check for null or any whitespaces to make sure that you are not running into an issue and your Boss do not call you in the middle of the night when there is an issue in Production because you are a horrible programmer :). I hope that's not the case with you and you are an awesome programmer who always test all your code in your machine, DEV and QA environment to make sure that you are catching all exceptions. We all learn from our mistakes and that's a fact. You do not become a good programmer overnight. It takes time and practice. So How do you check Powershell Variable for either null or Whitespace? You can accomplish this task using the command line below.

$myVariable = ""
[string]::IsNullOrEmpty($myVariable)

It will return True as my variable has no value.


502 Bad Gateway when trying to access Solr server



If your environment is setup with Load Balancer and all traffic is being routed to HTTPS. You are trying to access the Solr server and getting 502 Badway Gateway error then the problem is with the SSL configuration on your Solr instance. The SSL is not configured or the configuration are incorrect. You can follow the instructions below to make sure that your SSL is configured and it's working properly with Solr instance.

First of all check these two locations to see if you already have SSL installed and configured in Solr Server.

1) Open where your solr server files are: C:\Program Files\solr-6.6.3\Server\etc

Make sure you have .jks and ssl files in this folder. If not then it's time to generate your SSL and install this SSL in your server.

If the SSL files are there then open solr.in.cmd and make sure ssl is enabled. 



Ok. So if these settings are not there and your SSL are not in the folder then it's about time that you follow the instructions below to complete your Solr installation. 


Generating and Enabling SSL in Solr

1) Open command prompt as Administrator and change the directory to: C:\Program Files\Java\jre-10.0.2\bin



2) Run the below commands


keytool.exe -genkeypair -alias solr-ssl -keyalg RSA -keysize 2048 -keypass secret -storepass secret -validity 9999 -keystore solr-ssl.keystore.jks -ext SAN=DNS:localhost,IP:127.0.0.1 -dname "CN=localhost, OU=Organization, O=Organization, L=City, ST=State, C=USA"


keytool.exe -importkeystore -srckeystore solr-ssl.keystore.jks -destkeystore solr-ssl.keystore.p12 -srcstoretype jks -deststoretype pkcs12

3) Open C:\Program Files\Java\jre-10.0.2\bin and copy both files "solr-ssl.keystore" and "solr-ssl.keystore.jks"




4) Paste these files in C:\Program Files\solr-6.6.3\Server\etc


5) Open solr.in.cmd and enabled SSL in Solr.





Installing SSL on your Server

1) Double-click on the SSL cert "solr-ssl.keystore" that you generated in the section above.





2) Select Local Machine


2) Click Next



3) Enter the password and click Next

4) Place your certificate in "Trusted Root Certification Authorities" and Click Next


Ok. This is it. You just did an awesome job by generating, installing and configuring SSL in the Solr server. You derve a salary increase. Good Luck with that :)


What's the powershell command to find file path length greater then 260 characters.


Use the below command to find the file path that is greater than 260 characters.

cmd /c dir /s /b |? {$_.length -gt 260}