When I started the PowerShell it has given a error saying that "The Local Farm is not accessible. Cmdlets with FeatureDependencyId are not registered." as shown
On further investigation I found that some how my access on the SharePoint Config DB was removed. After giving the access this started working fine.