Category: PS

Come out of PowerShell command more parameter edit mode

Some time in PowerShell we enter some command and keep asking for more input. The easy way to come out of more input prompt is Ctrl+C

Come out of Powershell Edit prompt (Ctrl+C)

Advertisements

SPWeb Template details using Get-SPWebTemplate PowerShell command (STS#)

The command I ran in ISE is:

Get-SPWebTemplate

Output:

Name
Title
LocaleId
Custom
—-
—–
——–
——
GLOBAL#0
Global template
1033
FALSE
STS#0
Team Site
1033
FALSE
STS#1
Blank Site
1033
FALSE
STS#2
Document Workspace
1033
FALSE
MPS#0
Basic Meeting Workspace
1033
FALSE
MPS#1
Blank Meeting Workspace
1033
FALSE
MPS#2
Decision Meeting Workspace
1033
FALSE
MPS#3
Social Meeting Workspace
1033
FALSE
MPS#4
Multipage Meeting Workspace
1033
FALSE
CENTRALADMIN#0
Central Admin Site
1033
FALSE
WIKI#0
Wiki Site
1033
FALSE
BLOG#0
Blog
1033
FALSE
SGS#0
Group Work Site
1033
FALSE
TENANTADMIN#0
Tenant Admin Site
1033
FALSE
ACCSRV#0
Access Services Site
1033
FALSE
ACCSRV#1
Assets Web Database
1033
FALSE
ACCSRV#3
Charitable Contributions Web Database
1033
FALSE
ACCSRV#4
Contacts Web Database
1033
FALSE
ACCSRV#6
Issues Web Database
1033
FALSE
ACCSRV#5
Projects Web Database
1033
FALSE
BDR#0
Document Center
1033
FALSE
OFFILE#0
(obsolete) Records Center
1033
FALSE
OFFILE#1
Records Center
1033
FALSE
OSRV#0
Shared Services Administration Site
1033
FALSE
PPSMASite#0
PerformancePoint
1033
FALSE
BICenterSite#0
Business Intelligence Center
1033
FALSE
SPS#0
SharePoint Portal Server Site
1033
FALSE
SPSPERS#0
SharePoint Portal Server Personal Space
1033
FALSE
SPSMSITE#0
Personalization Site
1033
FALSE
SPSTOC#0
Contents area Template
1033
FALSE
SPSTOPIC#0
Topic area template
1033
FALSE
SPSNEWS#0
News Site
1033
FALSE
CMSPUBLISHING#0
Publishing Site
1033
FALSE
BLANKINTERNET#0
Publishing Site
1033
FALSE
BLANKINTERNET#1
Press Releases Site
1033
FALSE
BLANKINTERNET#2
Publishing Site with Workflow
1033
FALSE
SPSNHOME#0
News Site
1033
FALSE
SPSSITES#0
Site Directory
1033
FALSE
SPSCOMMU#0
Community area template
1033
FALSE
SPSREPORTCENTER#0
Report Center
1033
FALSE
SPSPORTAL#0
Collaboration Portal
1033
FALSE
SRCHCEN#0
Enterprise Search Center
1033
FALSE
PROFILES#0
Profiles
1033
FALSE
BLANKINTERNETCONT…
Publishing Portal
1033
FALSE
SPSMSITEHOST#0
My Site Host
1033
FALSE
ENTERWIKI#0
Enterprise Wiki
1033
FALSE
SRCHCENTERLITE#0
Basic Search Center
1033
FALSE
SRCHCENTERLITE#1
Basic Search Center
1033
FALSE
SRCHCENTERFAST#0
FAST Search Center
1033
FALSE
visprus#0
Visio Process Repository
1033
FALSE

Warm Up Script for SharePoint

You can use this warm up script after deployment in SharePoint it will bring back your site faster thna browser.

Write below line in text file and save as BAT file

####################################################################
powershell -command “& ‘D:\Satish\WarmUp\Satish\WarmUp.ps1′”
####################################################################

Write Below lines in text file and save as ps1 file

####################################################################
    $ver = $host | select version
    if ($ver.Version.Major -gt 1) {$host.Runspace.ThreadOptions = “ReuseThread”} 
    if ((Get-PSSnapin “Microsoft.SharePoint.PowerShell” -ErrorAction SilentlyContinue) -eq $null) {
        Add-PSSnapin “Microsoft.SharePoint.PowerShell”
    }
    
   function Get-WebPage([string]$url)
   {
       $wc = new-object net.webclient;
       $wc.credentials = [System.Net.CredentialCache]::DefaultCredentials;
      $pageContents = $wc.DownloadString($url);
      $wc.Dispose();
     return $pageContents;
   }
   

write-host “http://igtehydzbnv02:2210/sites/AppCentralSatish/“;
$html = Get-WebPage -url “http://igtehydzbnv02:2210/sites/AppCentralSatish/“;
write-host “Done”;
read-host;
#######################################################################

Changing application pool identity in SharePoint 2010

Changing application pool id in IIS is not at all recommended way of changing App pool identity in SharePoint 2010.

If you directly change App Pool Identity in IIS, SharePoint will not understand it and will be still referring to older ID.

To change the identity for an application pool, log into Central Administration and follow these steps:

1.      Go to Security and under General Security, click Configure Service Accounts.
2.      Select the application pool from the components drop-down
3.      Select the managed account that you want to use as the identity for this application pool, or register a new managed account in SharePoint 2010, using the Register a new managed account link.
4.      Click the OK button.
5.      You’ll be warned that this action requires an IIS reset on all servers, click OK.
6.      Perform iisreset /noforce on all WFE servers in the farm.

The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered.(SharePoint 2010 Powershell error)

Error:- “The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered when trying to run SharePoint 2010 PowerShell”

This message would also show up if you try to run the SharePoint 2010 Managment Shell without the proper permissions, or if the account does not have the proper permissions in SQL

OR





the SharePoint 2010 Management Shell was pointing to the incorrect version or path that is invalid and not compatible.

 To Verify which version is being used
1.  Bring up SharePoint 2010 Managment Shell (ignore) the error Message
2.  Type:
$ver=$host | select version
$ver.Version
3.  If you receive something like below.  If the Major version is not on 2, then you will get this runtime error.
Major  Minor  Build  Revision
—–  —–  —–  ——–
3      0      -1     -1
4.  Close out of SharePoint 2010 Managment Shell.
5.  Go back to the SharePoint 2010 Managment Shell Shortcut, right click and select “Properties”
6.  Under the Shortcut tab, Target: section, insert ”-version 2″ into the path, like so.  Make sure its before the -NoExit.
C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe –version 2 -NoExit ” & ‘ C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration\\sharepoint.ps1 ‘ “
7.  Click apply, and then Ok
8.  Reopen up the SharePoint 2010 Managment Shell with admin rights, and you should now no longer receive that error, you should then be able to run your scripts.