Powershell Error "The term 'Get-SPWeb' is not recognized as the name of a cmdlet, function..." - sharepoint

I just typed the follow to try and get my SharePoint site:
$spWeb = Get-SPWeb -Identity "http://nycs00058260/sites/usitp"
It gave me the following error
The term 'Get-SPWeb' is not recognized as the name of a cmdlet,
function, script...
The url is correct so why am I getting this error?

I think this need to be run from the Management Shell rather than the console, it sounds like the module isn't being imported into the Powershell console. You can add the module by running:
Add-PSSnapin Microsoft.Sharepoint.Powershell
in the Powershell console.

Run this script from SharePoint 2010 Management Shell as Administrator.

Instead of Windows PowerShell, find the item in the Start Menu called SharePoint 2013 Management Shell:

Related

Enterprise Application Display Name

I am running a command to get the equivalent display name of an Azure Enterprise Application Object ID however it is not working. Below is the powershell script that I am using.
$caller.caller = (Get-AzADApplication -ObjectId $caller.caller).DisplayName
Thank you in advance for the help.
This is where I am getting the data to be converted to its display name
I tried to reproduce the same in my environment and it's working fine
Please use the below command to get enterprise application display name.
(Get-AzADServicePrincipal -ObjectId 279d67ab-fa63-461a-*********).DisplayName
Output:

Add-SPOTheme is not recognized – SharePoint Management Shell

I’m a SharePoint Online Administrator, I want to register a customized Company Theme for our Office 365 tenant. Using SharePoint Online Management Shell, I came across the error message “Add-SPOTheme is not recognized as the name of a cmdlet, function, script file, or operable program”.
I have tried the solution from this site: https://www.technologytobusiness.com/microsoft-sharepoint/add-spotheme-not-recognized with no luck.
I also tried running the command on both 32 and 64 bit versions of PowerShell with no luck.
So, I’m not sure what am I missing?
You have to install Microsoft.Online.SharePoint.PowerShell PowerShell module before using the Add-SPOTheme cmdlet:
Install-Module -Name Microsoft.Online.SharePoint.PowerShell
If already installed, update to latest version.
Follow this documentation: Get started with SharePoint Online Management Shell

Get specific(Azure) command details in powershell

I need to get details of specific azure command(like create VM,remove VM and others) in power-shell.
for example to create VM we have "New-AzVM" command in power-shell.
I would like to know how we can get more help related to that command like
What are different types of arguments we can pass(like Authentication Arguments,Network Arguments and others)?
Which arguments are Required(Mandatory)?
I know we can accomplish same thing in azure-CLI using "az vm create --help" command.
Is there any command in power-shell which gives details of specific commands?(because I don't want to remember command(s) instead of that I would like to use "help" of powershell to get that command)
Note:- There is " Get-Command New-AzVM" command in powershell. but it list all command start with "New-AzVM".
You are looking for the Get-Help cmdlet.
If you add the -ShowWindow switch, you will get a nice output in a new window:
Get-Help New-AzVM -ShowWindow
Output:
The MS docs for the AZ module are pretty great as well. Plenty of examples and more detailed explanations of how things work. See the reference section in the left nav.

Get-SPSite in Powershell Script

I am writing a script to deploy my solution which has some "Site" scoped features. In my script I am trying to get hold of Site Collection first like
$SiteCollection=Get-SPSite http://<server>/mysite
When I check SiteCollection -ne $null it always returns null but the same cmdlet works fine at command prompt.
Do not know whats wrong with my script.
This could be a permissions issue. When run from the command prompt, you have permission to get the Sharepoint site. Investigate how you're running your script when it doesn't work. Make sure the user has permission.

Restart Sharepoint Management Shell

I would like to know if it is possible to restart Sharepoint Management Shell, so that i can reload a new App Domain ?
it is ok, i found it, just using : Powershell.exe -File script.ps1

Resources