Showing posts with label PoweShell. Show all posts
Showing posts with label PoweShell. Show all posts

Saturday, July 11, 2020


Azure PowerShell says “execution of scripts is disabled on this system ”

  

I recently resumed work with Azure Powershell and the first problem I encountered when I started to using PowerShell. The first cmdlet resulted in error…..

Remediation - As an Administrator, you can set the execution policy by typing this into your PowerShell window. There are three options, but “remotesigned” for current user will suffice. Avoid “unrestricted”, read more about the options, follow the reference section.

set-executionpolicy remotesigned -Scope CurrentUser
Check what you changed – should return remotesiged.
Get-ExecutionPolicy
PS C:\Users\partha> Get-ExecutionPolicy
RemoteSigned

Okay one done.. to get into next, now my machine does not have TLS 1.2. Hence have to use to allow SSL3, TLS1, TLS2. Just put these all 3 as values

[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Ssl3,Tls11,Tls12'

[System.Net.ServicePointManager]::SecurityProtocol
PS C:\Users\partha> [System.Net.ServicePointManager]::SecurityProtocol
Ssl3, Tls

A sigh of relief, all set to run the Azure Powershell but…. have to install the Azure modules… thus have to install AZ modules
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module -Name PoweShellGet -Force
Install-Module -Name Az -AllowClobber -Scope CurrentUser
Import-Module -Name Az
PS C:\Users\partha> Install-Module -Name Az -AllowClobber -Scope CurrentUser
PS C:\Users\partha> Import-Module -Name Az 

All AZ modules resides here… check in spare time.
C:\Users\Documents\WindowsPowerShell\Modules

And then finally can connect to Azure from PowerShell
Connect-AzAccount
Bingo!!!

Check Powershell Version
$PSVersionTable.PSVersion
Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      17134  858 



If you have queries, do drop in your queries below.
...HaPpY CoDiNg
Partha 

References:

Sunday, January 29, 2012

SharePoint PowerShell Error: The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered.

Sometimes when you try to run a SharePoint 2010 Management Shell (PowerShell), you might encounter the error below.

The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered.

clip_image002[8]

Although, the answer is not obvious given the error message, the answer is quite simple.  You tried to run PowerShell with a user account that is not an administrator in SharePoint.  In this case, I had ran it with my personal account which is not an admin and does not have access to the underlying SharePoint databases.  Hopefully, you used a “setup” account when you created SharePoint.  Execute PowerShell with that account instead. You can do this either by logging in as that user. You can also hold down the Shift key and right click on the SharePoint 2010 Management Shell icon and choose the Run as different user menu item.

clip_image004[4]

If you don’t have a setup account, things might be a bit trickier.  You can also resolve this by running it as the farm account, but you really want to try and avoid this. You can refer for the service accounts for SP2010 in MSDN for details of different service accounts.

Thanks for reading. If you have some other explanation – please post a comment… I’ll be happy to hear.

...HaPpY CoDiNg

Partha (Aurum)

References: