5

I'm new to powershell. I dont know anything about powershell script.(I'm not asking about "SharePoint management shell". I know how to use it.)

I have some questions about powershell as below.

  1. What is the difference between powershell & management shell.
  2. What is the difference between Windows Powershell & Windows Powershell ISE. Which one we should need to use for sharepoint related operations?
  3. Can i use management shell to run powershell script?
  4. Any basic step by step example ( like get title of all web applications) from scratch.

can anyone explain me above things in clean, simple and understandable words. thank you.

3 Answers 3

5
  1. There is no difference more than the UI and that management shell adds the module to use PowerShell cmdlts by default, while in PowerShell you would add the Powershell snap-in Microsoft.SharePoint.Powershell dll manually.

  2. The difference between ISE and standard PowerShell is that ISE has a script editor with highlighting to write code in, while in PowerShell you only get a command prompt. I'm sure that there are other features that are different but I'l leave that for google.

  3. Yes, but the default setting is to run PowerShell scripts in Standard PowerShell. The only thing you need to do is to make sure that the SharePoint Powershell dll is loaded (Add-pssnapin Microsoft.sharepoint.powershell).

  4. Microsoft has done an amazing job documenting all the cmdlts for SharePoint so google is your friend here. When you have loaded the dll, you can actually get help from the prompt by start writing an cmd and using tab, and even add the parameter Get-Help and -Example for any cmdlts available.

Most of the operations begins with new-, set-, get-, update- and remove-/delete-.

To get all the webapplication titles, you could run

get-spwebapplication -limit all -includecentraladministration | select-object title

Use Windows PowerShell to administer SharePoint 2013

2

I can only answer the first questions (no example at hand at the moment).

  1. There is no real difference as both use the same basic set of available commands. Normally all additional SharePoint related Powershell libraries are loaded when starting the SharePoint management shell.
  2. The core functionality is the same. ISE is giving you a proper script editor with IntelliSense, highlighting and some more UI features like multitab scripts. ISE is (of course) only available on UI enabled servers. You can also load scripts within powershell itself and also insert multiline scripts as well, but it is quite more comfortable with the ISE. You can use both for SharePoint related operations, but you need to load all relevant libraries either at start of the ISE/PowerShell or at the start of the script.
  3. Yes, you can use also the management shell for standard PowerShell scripts/commands.

The last question should be answered by someone else who can give you quickly a script. :-)

0

Get Web Application Name

Get-SPWebApplication | foreach{$_.name}

Get Site URLs

Get-SPWebApplication | Get-SPSite -limit all| Select URL

Get Site Titles

Get-SPWebApplication | Get-SPSite -limit all | foreach{$_.rootweb.title}

It will take some time to learn but PowerShell is your friend if you are going to be a SharePoint Administrator

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.