IT tutorials
 
Applications Server
 

Microsoft Sharepoint 2013 : Administering Sharepoint with Windows Powershell - Basic PowerShell Usage (part 2) - PowerShell Help , PowerShell Variables

12/17/2014 8:07:22 PM
- How To Install Windows Server 2012 On VirtualBox
- How To Bypass Torrent Connection Blocking By Your ISP
- How To Install Actual Facebook App On Kindle Fire

PowerShell Help

We mentioned earlier that one of the difficulties in mastering a command-line environment is figuring out what to type. It can be very frustrating. The designers of PowerShell were ingenious, though, providing the extremely useful Get-Help command. Whereas the Get-Command cmdlet is useful for determining which commands are available to PowerShell, you can use Get-Help to understand the usage of a command. The Get-Help command is a standard PowerShell cmdlet. To get help for a particular command, simply call Get-Help, passing in the name of the command for which you want help. For example, to view help about New-SPWebApplication, you would use the following:

Get-Help New-SPWebApplication

Figure 3 shows the help returned for New-SPWebApplication. It provides numerous details about the command, including parameters, examples, and usage. Get-Help accepts the optional parameters of –detailed, -examples, and -full. When learning how to use an unfamiliar PowerShell cmdlet, running Get-Help with the –examples parameter is a great way to quickly get up to speed on how to use it. Examples of the available options are shown under the Remarks heading (refer to Figure 3). To learn more about Get-Help, simply use Get-Help Get-Help — a little repetitive, but it works.

FIGURE 3

image

Note that the Windows Server product team that covers PowerShell (a subteam of Server & Tools) at Microsoft has decreed that every PowerShell cmdlet included with a Microsoft product must have help information and at least one example. That’s admirable, but unfortunately not all of the examples are accurate; some of the SharePoint cmdlets have flakey examples. The good news is that you can update the help information for cmdlets by running Update-Help. If your SharePoint server has access to the Internet, PowerShell will check for updated help for the modules installed. This may fix some of the erroneous help entries, but be aware that some just don’t work.

PowerShell Variables

It is virtually impossible to ignore variables, except in the most basic cmdlet usage. The first time you pipe the output (covered in the section “PowerShell Pipeline”) of one command into another command you are already using variables. Despite what some developer “friends” might tell you, variables are not the second coming of algebra, although the similarities are uncanny. In a basic sense, variables hold information. All PowerShell variables start with the $ character, and they can hold any type of valid object.


NOTE Certain objects in SharePoint, such as SPWeb, SPSite, and SPSiteAdministration, must be properly disposed of. One-liner SharePoint commands will dispose of all objects correctly. Storing these SharePoint objects in variables can lead to performance issues and memory leaks if the variable is not handled correctly. 

In Figure 4, the variable $webApps is set to the output of Get-SPWebApplications. $webApps now contains all the web application (SPWebApplication) objects. You use the Count property to determine how many web applications are contained in the variable, and you can display the web applications by simply typing the variable name.

FIGURE 4

image

NOTE Wondering which commands were used to get the output displayed in the screenshots of the Management Shell? Just take a look at the top of the figures to see the commands following the administrator prompt.

Note that the Get-SPWebApplication cmdlet does not include your Central Admin web application by default. This is helpful because it means you won’t always have to check to ensure that whatever settings you are applying to your standard web applications aren’t being inadvertently applied to the Central Admin site. You have to include the -IncludeCentralAdministration parameter in order for Central Admin to be included.

 
Others
 
- Microsoft Sharepoint 2013 : Administering Sharepoint with Windows Powershell - Basic PowerShell Usage (part 1) - Listing the SharePoint Commands
- Microsoft Sharepoint 2013 : Administering Sharepoint with Windows Powershell - Commands
- Microsoft Sharepoint 2013 : Microsoft SharePoint 2013 Management Shell and Other Hosts
- Microsoft Lync Server 2013 : Dependent Services and SQL - Server Certificates - Installing Lync Certificates
- Microsoft Lync Server 2013 : Dependent Services and SQL - Domain Name System - DNS Load Balancing , Automatic Client Sign-in
- Microsoft Lync Server 2013 : Dependent Services and SQL - Active Directory (part 2) - Forest Prep, Domain Prep, Lync Server 2013 Security Groups
- Microsoft Lync Server 2013 : Dependent Services and SQL - Active Directory (part 1) - Schema Extensions
- Administering Active Directory 2008 : Creating and Managing Active Directory Objects (part 4) - Moving, Renaming, and Deleting Active Directory Objects , Resetting an Existing Computer Account
- Administering Active Directory 2008 : Creating and Managing Active Directory Objects (part 3) - Understanding Groups, Filtering and Advanced Active Directory Features
- Administering Active Directory 2008 : Creating and Managing Active Directory Objects (part 2) - Managing Object Properties
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
programming4us programming4us
 
Popular tags
 
Video Tutorail Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8 BlackBerry Android Ipad Iphone iOS