SlideShare a Scribd company logo
Q. What is Windows Powershell ?
Ans. Windows PowerShell is a new Windows command-line shell designed especially for system
administrators. In the SharePoint administration context, Windows PowerShell is another
administration tool that supersedes the existing Stsadm.exe.
Q. How is Windows Powershell different from Stsadm ?
Ans. Unlike stsadm, which accept and return text, Windows PowerShell is built on the Microsoft
.NET Framework and accepts and returns .NET Framework objects. In addition to that it also gives
you access to the file system on the computer so that you can access registry,digital signature
certificate etc..
->in powershell we can execute multiple command at a time but stsadm command does not do it.
Q. What are cmdlet's?
Ans. Windows PowerShell introduces the concept of a cmdlet which are simple build in commands,
written in a .net language like C# or VB.
Q. Can you Create PowerShell scripts for deploying components in SharePoint ?
Ans. If you are creating a webpart with VS 2010 then you can deploy it using ctrl + f5. However, to
activate the webpart feature you can write a powershell script (.ps1) and execute it after dpeloyment.
Q. Where is Powershell located in sharePoint ?
Ans. On the Start menu, click All Programs -> Click Microsoft SharePoint 2010 Products -> Click
SharePoint 2010 Management Shell.
Q. If you need going to install a webpart or any custom solution in SharePoint 2010 using
PowerShell What permissions do you need?
Ans. In order to use Windows PowerShell for SharePoint 2010 Products, a user must be a member
of the SharePoint_Shell_Access role on the configuration and content database. In addition to this,
the user must also be a member of the WSS_ADMIN_WPG local group on the computer where
SharePoint 2010 Products is installed. See The Details below
Permissions for Windows PowerShell - SPShellAdmin
In order to use Windows PowerShell for SharePoint 2010 Products, a user must be a member of the
SharePoint_Shell_Access role on the configuration and content database. In addition to this, the
user must also be a member of the WSS_ADMIN_WPG local group on the computer where
SharePoint 2010 Products is installed.
To add a user as SharePoint_Shell_Access on the SharePoint database use the below powershell
cmdlet :
Add-SPShellAdmin
Please Note that to run the above cmdlet you must have* Membership in the securityadmin fixed
server role on the SQL Server instance
* Membership in the db_owner fixed database role on all affected databases
* and local administrative permission on the local computer.
In addition to above some important things to Note:
* The user gets added to the WSS_Admin_WPG group on all Web servers when the user is added
to the SharePoint_Shell_Access role.
* If the target database does not have a SharePoint_Shell_Access role, the role is automatically
created.
* If you use the database parameter, the user is added to the role on the farm configuration
database, the Central Administration content database, and the specified database. Using the
database parameter is the preferred method because most of the administrative operations require
access to the Central Administration content database. The cmdlet is something like below :
Add-SPShellAdmin -UserName DomainnameUser -database {Database GUID}
Q. How to list all the commands in PowerShell ?
Ans. Get-Command * commands gets you all the Powershell commands. For more commands see
To Open the Windows PowerShell Session :
1. On the Start menu, click All Programs.
2. Click Microsoft SharePoint 2010 Products.
3. Click SharePoint 2010 Management Shell
Note : You should have SharePoint_Shell_Access role on the configuration database and you
should be a member of the WSS_ADMIN_WPG local group on the computer where SharePoint
Server 2010 is installed.
Some of the Common Commands and Operations are:
Create Web Application Variable
$webapp = Get-SPWebApplication "http://pravahaminfol234/"
Create SharePoint Site Variable (Instance of SPSite)
$siteurl = "http://mysharepointsite/"
$Oursite=new-object Microsoft.SharePoint.SPSite($siteurl)
Here we have created a variable Oursite, which contains an instance of type SPSite. Now you can
use it to Display all webs in the site collection.
$Oursite.AllWebs more // List all Webs in the Site
Create Service Application Variable
$spapp = Get-SPServiceApplication -Name "ServiceApplicationDisplayName"
Create a Webapplication:
New -SPWebApplication -ApplicationPoolName <Name of the application pool> -Name <Name of
the new Web application> [ -Port <Port on which the Web application can be accessed>] [-
HostHeader <Valid URL assigned to the Web application that must correlate to the alternate access
mapping configuration>] [-URL <Load-balanced URL for the Web application>][ -
ApplicationPoolAccount <User account that this application pool will run as>]
Delete WebApplication
Remove-SPWebApplication –identity -URL <http://sitename/> -Confirm
CreateDelete a Site Collection:
Create a Site collection:
Get-SPWebTemplate
$template = Get-SPWebTemplate "STS#0"
New-SPSite –Url "<URL for the new site collection>" –OwnerAlias "<domainuser>" –Template
$template
Here $template is a Variable to store the type of template we want to use while creating a site
collection.
Delete a Site Collection:
Remove-SPSite –Identity <URL> –GradualDelete
Here <URL > is a site Collection Url .
BackRestore a content database
To Backup :
Backup -SPFarm -Directory <Backup folder> -BackupMethod -Item <Content database name> [-
Verbose]
Backup folder - is a folder to save your backup.
BackupMethod – Can Specify between Full or Differential.
To Restore:
Restore -SPFarm -Directory <Backup folder> -RestoreMethod Overwrite -Item <Content database
name> [-BackupId] [-Verbose]
If you don’t know the BackupID you can display all the backups using the below command and get
the GUID of the Backup.
Get-SPBackupHistory -Directory <Backup folder>
You can check all the Backup-Restore Operations Here
Deploy WebPart Soluiton Package
Install -SPWebPartPack -LiteralPath "PathToCABorwspFile" -Name "NameOFWebPart"
PathToCABorwspFile- is the full path to the CAB file that is being deployed.
NameOFWebPart- is the name of the Web Part that is being deployed.
Install Activate and Deactivate Feature using Windows Powershell
Install Feature :
$MyFeatureId = $(Get -SPFeature -limit all where {$_.displayname -eq "myfeatureName"}).Id
Install -SPFeature $MyFeatureId
ActivateEnable Feature :
$singleSiteCollection = Get -SPSite -Identity http://mysinglesitecollectionurl/
Enable -SPFeature $MyFeatureId -Url $singleSiteCollection.URL
DeactivateDisable Feature :
$singleSiteCollection = Get-SPSite -Identity http://mysinglesitecollectionurl/
Disable -SPFeature $MyFeatureId -Url $singleSiteCollection.URL
Command TO List all the PowerShell Commands
Get-Command –PSSnapin “Get-Command –PSSnapin “Microsoft.SharePoint.PowerShell” format-
table name > C:SP2010_PowerShell_Commands.txt
Adding a content database using PowerShell in SharePoint 2010
To attach an existing content database:
Mount-SPContentDatabase "<ContentDb>" –DatabaseServer "<DbServer>" –
WebApplication http://webapplicationname/
<ContentDb> is the content database to be attached.
<DbServer> is the name of the database server.
http://webapplicationname/ is the name of the Web application to which the content database is
being attached.
To detach a content database:
Dismount-SPContentDatabase "<ContentdBName>"
Where is the name of the content database.
SharePoint 2010 Windows PowerShell Commands - II
Some more PowerShell Commands
Site Collection Commands
Create Site Collection :
Get-SPWebTemplate
$template = Get-SPWebTemplate "STS#0"
New-SPSite -Url "" -OwnerAlias "" -Template $template
Delete Site Collection :
Remove-SPSite -Identity "URL of site Collection" -GradualDelete
Change Site collection Quotas :
Set-SPSite -Identity "SiteCollection Url" -MaxSize Quota
Add site Collection Administrators :
Set-SPSite -Identity "" -SecondaryOwnerAlias ""
Lock or unlock a site collection :
Set-SPSite -Identity "Site Collection Url" -LockState ""
is one of the following vales :
# Unlock: To unlock the site collection and make it available to users.
# NoAdditions: To prevent users from adding new content to the site collection. Updates and
deletions are still allowed.
# ReadOnly: To prevent users from adding, updating, or deleting content.
# NoAccess: To prevent access to content completely. Users who attempt to access the site receive
an access-denied message.
Create a site :
New-SPSite "http://sitecollection/sites/Subsite -OwnerAlias "DOMAINUserName" –Language 1033

More Related Content

What's hot

Oracle fusionmiddlewarecontinuosintegration slideshare_v1
Oracle fusionmiddlewarecontinuosintegration slideshare_v1Oracle fusionmiddlewarecontinuosintegration slideshare_v1
Oracle fusionmiddlewarecontinuosintegration slideshare_v1
Rakesh Gujjarlapudi
 
Oracle BPM 11g Lesson 2
Oracle BPM 11g Lesson 2Oracle BPM 11g Lesson 2
Oracle BPM 11g Lesson 2
Rakesh Gujjarlapudi
 
Cake php
Cake phpCake php
Build Application With MongoDB
Build Application With MongoDBBuild Application With MongoDB
Build Application With MongoDB
Edureka!
 
Get database properties using power shell in sql server 2008 techrepublic
Get database properties using power shell in sql server 2008   techrepublicGet database properties using power shell in sql server 2008   techrepublic
Get database properties using power shell in sql server 2008 techrepublic
Kaing Menglieng
 
Virtual Hosts Configuration with Weblogic Server
Virtual Hosts Configuration with Weblogic ServerVirtual Hosts Configuration with Weblogic Server
Virtual Hosts Configuration with Weblogic Server
Pawan Kumar
 
How to connect sql server to oracle server
How to connect sql server to oracle serverHow to connect sql server to oracle server
How to connect sql server to oracle server
Gustavo Bernardo
 
Mid term &amp; final- preparation- student-review(Oracle)
Mid term &amp; final- preparation- student-review(Oracle)Mid term &amp; final- preparation- student-review(Oracle)
Mid term &amp; final- preparation- student-review(Oracle)
than sare
 
Oracle OSB Tutorial 1
Oracle OSB Tutorial 1Oracle OSB Tutorial 1
Oracle OSB Tutorial 1
Rakesh Gujjarlapudi
 
configuring+oracle+rds+with+glasfish+server
configuring+oracle+rds+with+glasfish+serverconfiguring+oracle+rds+with+glasfish+server
configuring+oracle+rds+with+glasfish+server
hunghtc83
 
Spring review_for Semester II of Year 4
Spring review_for Semester II of Year 4Spring review_for Semester II of Year 4
Spring review_for Semester II of Year 4
than sare
 
Pluggable database tutorial
Pluggable database tutorialPluggable database tutorial
Pluggable database tutorial
Osama Mustafa
 
Pluggable database tutorial 2
Pluggable database tutorial 2Pluggable database tutorial 2
Pluggable database tutorial 2
Osama Mustafa
 
oracle-rest-data-service-instal-config
oracle-rest-data-service-instal-configoracle-rest-data-service-instal-config
oracle-rest-data-service-instal-config
hunghtc83
 
DAC
DACDAC
Obia with odi
Obia with odiObia with odi
Upgrade Oracle Database to 12c
Upgrade Oracle Database to 12c Upgrade Oracle Database to 12c
Upgrade Oracle Database to 12c
Osama Mustafa
 
Weblogic 12c Graphical Mode installation steps in Windows
Weblogic 12c Graphical Mode installation steps in Windows Weblogic 12c Graphical Mode installation steps in Windows
Weblogic 12c Graphical Mode installation steps in Windows
webservicesm
 
OBIEE 11g installation steps
OBIEE 11g installation stepsOBIEE 11g installation steps
OBIEE 11g installation steps
Dharmaraj Borse
 
Obiee10 g to 11g upgrade
Obiee10 g to 11g upgradeObiee10 g to 11g upgrade
Obiee10 g to 11g upgrade
Amit Sharma
 

What's hot (20)

Oracle fusionmiddlewarecontinuosintegration slideshare_v1
Oracle fusionmiddlewarecontinuosintegration slideshare_v1Oracle fusionmiddlewarecontinuosintegration slideshare_v1
Oracle fusionmiddlewarecontinuosintegration slideshare_v1
 
Oracle BPM 11g Lesson 2
Oracle BPM 11g Lesson 2Oracle BPM 11g Lesson 2
Oracle BPM 11g Lesson 2
 
Cake php
Cake phpCake php
Cake php
 
Build Application With MongoDB
Build Application With MongoDBBuild Application With MongoDB
Build Application With MongoDB
 
Get database properties using power shell in sql server 2008 techrepublic
Get database properties using power shell in sql server 2008   techrepublicGet database properties using power shell in sql server 2008   techrepublic
Get database properties using power shell in sql server 2008 techrepublic
 
Virtual Hosts Configuration with Weblogic Server
Virtual Hosts Configuration with Weblogic ServerVirtual Hosts Configuration with Weblogic Server
Virtual Hosts Configuration with Weblogic Server
 
How to connect sql server to oracle server
How to connect sql server to oracle serverHow to connect sql server to oracle server
How to connect sql server to oracle server
 
Mid term &amp; final- preparation- student-review(Oracle)
Mid term &amp; final- preparation- student-review(Oracle)Mid term &amp; final- preparation- student-review(Oracle)
Mid term &amp; final- preparation- student-review(Oracle)
 
Oracle OSB Tutorial 1
Oracle OSB Tutorial 1Oracle OSB Tutorial 1
Oracle OSB Tutorial 1
 
configuring+oracle+rds+with+glasfish+server
configuring+oracle+rds+with+glasfish+serverconfiguring+oracle+rds+with+glasfish+server
configuring+oracle+rds+with+glasfish+server
 
Spring review_for Semester II of Year 4
Spring review_for Semester II of Year 4Spring review_for Semester II of Year 4
Spring review_for Semester II of Year 4
 
Pluggable database tutorial
Pluggable database tutorialPluggable database tutorial
Pluggable database tutorial
 
Pluggable database tutorial 2
Pluggable database tutorial 2Pluggable database tutorial 2
Pluggable database tutorial 2
 
oracle-rest-data-service-instal-config
oracle-rest-data-service-instal-configoracle-rest-data-service-instal-config
oracle-rest-data-service-instal-config
 
DAC
DACDAC
DAC
 
Obia with odi
Obia with odiObia with odi
Obia with odi
 
Upgrade Oracle Database to 12c
Upgrade Oracle Database to 12c Upgrade Oracle Database to 12c
Upgrade Oracle Database to 12c
 
Weblogic 12c Graphical Mode installation steps in Windows
Weblogic 12c Graphical Mode installation steps in Windows Weblogic 12c Graphical Mode installation steps in Windows
Weblogic 12c Graphical Mode installation steps in Windows
 
OBIEE 11g installation steps
OBIEE 11g installation stepsOBIEE 11g installation steps
OBIEE 11g installation steps
 
Obiee10 g to 11g upgrade
Obiee10 g to 11g upgradeObiee10 g to 11g upgrade
Obiee10 g to 11g upgrade
 

Similar to Power shell

Monitoring and Maintaining SharePoint 2013 Server
Monitoring and Maintaining SharePoint 2013 ServerMonitoring and Maintaining SharePoint 2013 Server
Monitoring and Maintaining SharePoint 2013 Server
Learning SharePoint
 
Intro to PowerShell
Intro to PowerShellIntro to PowerShell
Intro to PowerShell
Adam Preston
 
Power Shell and Sharepoint 2013
Power Shell and Sharepoint 2013Power Shell and Sharepoint 2013
Power Shell and Sharepoint 2013
Mohan Arumugam
 
Admin share point with powershell
Admin share point with powershellAdmin share point with powershell
Admin share point with powershell
Concentrated Technology
 
NZ Code Camp 2011 PowerShell + SharePoint
NZ Code Camp 2011 PowerShell + SharePointNZ Code Camp 2011 PowerShell + SharePoint
NZ Code Camp 2011 PowerShell + SharePoint
Nick Hadlee
 
Admin SharePoint 2010 with PowerShell
Admin SharePoint 2010 with PowerShellAdmin SharePoint 2010 with PowerShell
Admin SharePoint 2010 with PowerShell
Concentrated Technology
 
SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...
SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...
SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...
Comunidade Portuguesa de SharePoiint
 
Windows power shell for sharepoint online &amp; office 365
Windows power shell for sharepoint online &amp; office 365Windows power shell for sharepoint online &amp; office 365
Windows power shell for sharepoint online &amp; office 365
Prashant Kumar Singh
 
What's new in SharePoint 2010 for Backup and Recovery - SP Saturday Copenhagen
What's new in SharePoint 2010 for Backup and Recovery - SP Saturday CopenhagenWhat's new in SharePoint 2010 for Backup and Recovery - SP Saturday Copenhagen
What's new in SharePoint 2010 for Backup and Recovery - SP Saturday Copenhagen
Ilia Sotnikov
 
SharePoint Development For Asp Net Developers
SharePoint Development For Asp Net DevelopersSharePoint Development For Asp Net Developers
SharePoint Development For Asp Net Developers
Corey Roth
 
PowerShell-2
PowerShell-2PowerShell-2
PowerShell-2
Saravanan G
 
SharePoint 2010 Tools in Visual Studio 2010
SharePoint 2010 Tools in Visual Studio 2010SharePoint 2010 Tools in Visual Studio 2010
SharePoint 2010 Tools in Visual Studio 2010
Becky Bertram
 
Automated server farm installation using psconfig and stsadm dm300 - curry ...
Automated server farm installation using psconfig and stsadm   dm300 - curry ...Automated server farm installation using psconfig and stsadm   dm300 - curry ...
Automated server farm installation using psconfig and stsadm dm300 - curry ...
Vickey Bird
 
Migrating to SharePoint 2013 - Business and Technical Perspective
Migrating to SharePoint 2013 - Business and Technical PerspectiveMigrating to SharePoint 2013 - Business and Technical Perspective
Migrating to SharePoint 2013 - Business and Technical Perspective
John Calvert
 
WordPress basic fundamental of plugin development and creating shortcode
WordPress basic fundamental of plugin development and creating shortcodeWordPress basic fundamental of plugin development and creating shortcode
WordPress basic fundamental of plugin development and creating shortcode
Rakesh Kushwaha
 
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with PowershellBrian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
SharePoint Saturday NY
 
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with PowershellBrian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
SharePoint Saturday NY
 
Automating PowerShell with SharePoint
Automating PowerShell with SharePointAutomating PowerShell with SharePoint
Automating PowerShell with SharePoint
Talbott Crowell
 
Mai Omar Desouki - SharePoint 2010 ITPRO
Mai Omar Desouki - SharePoint 2010 ITPROMai Omar Desouki - SharePoint 2010 ITPRO
Mai Omar Desouki - SharePoint 2010 ITPRO
Mai Omar Desouki
 
PowerShell for SharePoint Developers
PowerShell for SharePoint DevelopersPowerShell for SharePoint Developers
PowerShell for SharePoint Developers
Boulos Dib
 

Similar to Power shell (20)

Monitoring and Maintaining SharePoint 2013 Server
Monitoring and Maintaining SharePoint 2013 ServerMonitoring and Maintaining SharePoint 2013 Server
Monitoring and Maintaining SharePoint 2013 Server
 
Intro to PowerShell
Intro to PowerShellIntro to PowerShell
Intro to PowerShell
 
Power Shell and Sharepoint 2013
Power Shell and Sharepoint 2013Power Shell and Sharepoint 2013
Power Shell and Sharepoint 2013
 
Admin share point with powershell
Admin share point with powershellAdmin share point with powershell
Admin share point with powershell
 
NZ Code Camp 2011 PowerShell + SharePoint
NZ Code Camp 2011 PowerShell + SharePointNZ Code Camp 2011 PowerShell + SharePoint
NZ Code Camp 2011 PowerShell + SharePoint
 
Admin SharePoint 2010 with PowerShell
Admin SharePoint 2010 with PowerShellAdmin SharePoint 2010 with PowerShell
Admin SharePoint 2010 with PowerShell
 
SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...
SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...
SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...
 
Windows power shell for sharepoint online &amp; office 365
Windows power shell for sharepoint online &amp; office 365Windows power shell for sharepoint online &amp; office 365
Windows power shell for sharepoint online &amp; office 365
 
What's new in SharePoint 2010 for Backup and Recovery - SP Saturday Copenhagen
What's new in SharePoint 2010 for Backup and Recovery - SP Saturday CopenhagenWhat's new in SharePoint 2010 for Backup and Recovery - SP Saturday Copenhagen
What's new in SharePoint 2010 for Backup and Recovery - SP Saturday Copenhagen
 
SharePoint Development For Asp Net Developers
SharePoint Development For Asp Net DevelopersSharePoint Development For Asp Net Developers
SharePoint Development For Asp Net Developers
 
PowerShell-2
PowerShell-2PowerShell-2
PowerShell-2
 
SharePoint 2010 Tools in Visual Studio 2010
SharePoint 2010 Tools in Visual Studio 2010SharePoint 2010 Tools in Visual Studio 2010
SharePoint 2010 Tools in Visual Studio 2010
 
Automated server farm installation using psconfig and stsadm dm300 - curry ...
Automated server farm installation using psconfig and stsadm   dm300 - curry ...Automated server farm installation using psconfig and stsadm   dm300 - curry ...
Automated server farm installation using psconfig and stsadm dm300 - curry ...
 
Migrating to SharePoint 2013 - Business and Technical Perspective
Migrating to SharePoint 2013 - Business and Technical PerspectiveMigrating to SharePoint 2013 - Business and Technical Perspective
Migrating to SharePoint 2013 - Business and Technical Perspective
 
WordPress basic fundamental of plugin development and creating shortcode
WordPress basic fundamental of plugin development and creating shortcodeWordPress basic fundamental of plugin development and creating shortcode
WordPress basic fundamental of plugin development and creating shortcode
 
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with PowershellBrian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
 
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with PowershellBrian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
 
Automating PowerShell with SharePoint
Automating PowerShell with SharePointAutomating PowerShell with SharePoint
Automating PowerShell with SharePoint
 
Mai Omar Desouki - SharePoint 2010 ITPRO
Mai Omar Desouki - SharePoint 2010 ITPROMai Omar Desouki - SharePoint 2010 ITPRO
Mai Omar Desouki - SharePoint 2010 ITPRO
 
PowerShell for SharePoint Developers
PowerShell for SharePoint DevelopersPowerShell for SharePoint Developers
PowerShell for SharePoint Developers
 

Recently uploaded

How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 

Recently uploaded (20)

How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 

Power shell

  • 1. Q. What is Windows Powershell ? Ans. Windows PowerShell is a new Windows command-line shell designed especially for system administrators. In the SharePoint administration context, Windows PowerShell is another administration tool that supersedes the existing Stsadm.exe. Q. How is Windows Powershell different from Stsadm ? Ans. Unlike stsadm, which accept and return text, Windows PowerShell is built on the Microsoft .NET Framework and accepts and returns .NET Framework objects. In addition to that it also gives you access to the file system on the computer so that you can access registry,digital signature certificate etc.. ->in powershell we can execute multiple command at a time but stsadm command does not do it. Q. What are cmdlet's? Ans. Windows PowerShell introduces the concept of a cmdlet which are simple build in commands, written in a .net language like C# or VB. Q. Can you Create PowerShell scripts for deploying components in SharePoint ? Ans. If you are creating a webpart with VS 2010 then you can deploy it using ctrl + f5. However, to activate the webpart feature you can write a powershell script (.ps1) and execute it after dpeloyment. Q. Where is Powershell located in sharePoint ? Ans. On the Start menu, click All Programs -> Click Microsoft SharePoint 2010 Products -> Click SharePoint 2010 Management Shell. Q. If you need going to install a webpart or any custom solution in SharePoint 2010 using PowerShell What permissions do you need? Ans. In order to use Windows PowerShell for SharePoint 2010 Products, a user must be a member of the SharePoint_Shell_Access role on the configuration and content database. In addition to this, the user must also be a member of the WSS_ADMIN_WPG local group on the computer where SharePoint 2010 Products is installed. See The Details below Permissions for Windows PowerShell - SPShellAdmin In order to use Windows PowerShell for SharePoint 2010 Products, a user must be a member of the SharePoint_Shell_Access role on the configuration and content database. In addition to this, the user must also be a member of the WSS_ADMIN_WPG local group on the computer where SharePoint 2010 Products is installed. To add a user as SharePoint_Shell_Access on the SharePoint database use the below powershell cmdlet : Add-SPShellAdmin Please Note that to run the above cmdlet you must have* Membership in the securityadmin fixed server role on the SQL Server instance * Membership in the db_owner fixed database role on all affected databases * and local administrative permission on the local computer.
  • 2. In addition to above some important things to Note: * The user gets added to the WSS_Admin_WPG group on all Web servers when the user is added to the SharePoint_Shell_Access role. * If the target database does not have a SharePoint_Shell_Access role, the role is automatically created. * If you use the database parameter, the user is added to the role on the farm configuration database, the Central Administration content database, and the specified database. Using the database parameter is the preferred method because most of the administrative operations require access to the Central Administration content database. The cmdlet is something like below : Add-SPShellAdmin -UserName DomainnameUser -database {Database GUID} Q. How to list all the commands in PowerShell ? Ans. Get-Command * commands gets you all the Powershell commands. For more commands see To Open the Windows PowerShell Session : 1. On the Start menu, click All Programs. 2. Click Microsoft SharePoint 2010 Products. 3. Click SharePoint 2010 Management Shell Note : You should have SharePoint_Shell_Access role on the configuration database and you should be a member of the WSS_ADMIN_WPG local group on the computer where SharePoint Server 2010 is installed. Some of the Common Commands and Operations are: Create Web Application Variable $webapp = Get-SPWebApplication "http://pravahaminfol234/" Create SharePoint Site Variable (Instance of SPSite) $siteurl = "http://mysharepointsite/" $Oursite=new-object Microsoft.SharePoint.SPSite($siteurl) Here we have created a variable Oursite, which contains an instance of type SPSite. Now you can use it to Display all webs in the site collection. $Oursite.AllWebs more // List all Webs in the Site Create Service Application Variable $spapp = Get-SPServiceApplication -Name "ServiceApplicationDisplayName" Create a Webapplication: New -SPWebApplication -ApplicationPoolName <Name of the application pool> -Name <Name of the new Web application> [ -Port <Port on which the Web application can be accessed>] [- HostHeader <Valid URL assigned to the Web application that must correlate to the alternate access mapping configuration>] [-URL <Load-balanced URL for the Web application>][ - ApplicationPoolAccount <User account that this application pool will run as>]
  • 3. Delete WebApplication Remove-SPWebApplication –identity -URL <http://sitename/> -Confirm CreateDelete a Site Collection: Create a Site collection: Get-SPWebTemplate $template = Get-SPWebTemplate "STS#0" New-SPSite –Url "<URL for the new site collection>" –OwnerAlias "<domainuser>" –Template $template Here $template is a Variable to store the type of template we want to use while creating a site collection. Delete a Site Collection: Remove-SPSite –Identity <URL> –GradualDelete Here <URL > is a site Collection Url . BackRestore a content database To Backup : Backup -SPFarm -Directory <Backup folder> -BackupMethod -Item <Content database name> [- Verbose] Backup folder - is a folder to save your backup. BackupMethod – Can Specify between Full or Differential. To Restore: Restore -SPFarm -Directory <Backup folder> -RestoreMethod Overwrite -Item <Content database name> [-BackupId] [-Verbose] If you don’t know the BackupID you can display all the backups using the below command and get the GUID of the Backup. Get-SPBackupHistory -Directory <Backup folder> You can check all the Backup-Restore Operations Here Deploy WebPart Soluiton Package Install -SPWebPartPack -LiteralPath "PathToCABorwspFile" -Name "NameOFWebPart" PathToCABorwspFile- is the full path to the CAB file that is being deployed. NameOFWebPart- is the name of the Web Part that is being deployed. Install Activate and Deactivate Feature using Windows Powershell Install Feature : $MyFeatureId = $(Get -SPFeature -limit all where {$_.displayname -eq "myfeatureName"}).Id Install -SPFeature $MyFeatureId ActivateEnable Feature : $singleSiteCollection = Get -SPSite -Identity http://mysinglesitecollectionurl/ Enable -SPFeature $MyFeatureId -Url $singleSiteCollection.URL
  • 4. DeactivateDisable Feature : $singleSiteCollection = Get-SPSite -Identity http://mysinglesitecollectionurl/ Disable -SPFeature $MyFeatureId -Url $singleSiteCollection.URL Command TO List all the PowerShell Commands Get-Command –PSSnapin “Get-Command –PSSnapin “Microsoft.SharePoint.PowerShell” format- table name > C:SP2010_PowerShell_Commands.txt Adding a content database using PowerShell in SharePoint 2010 To attach an existing content database: Mount-SPContentDatabase "<ContentDb>" –DatabaseServer "<DbServer>" – WebApplication http://webapplicationname/ <ContentDb> is the content database to be attached. <DbServer> is the name of the database server. http://webapplicationname/ is the name of the Web application to which the content database is being attached. To detach a content database: Dismount-SPContentDatabase "<ContentdBName>" Where is the name of the content database. SharePoint 2010 Windows PowerShell Commands - II Some more PowerShell Commands Site Collection Commands Create Site Collection : Get-SPWebTemplate $template = Get-SPWebTemplate "STS#0" New-SPSite -Url "" -OwnerAlias "" -Template $template Delete Site Collection : Remove-SPSite -Identity "URL of site Collection" -GradualDelete Change Site collection Quotas : Set-SPSite -Identity "SiteCollection Url" -MaxSize Quota Add site Collection Administrators : Set-SPSite -Identity "" -SecondaryOwnerAlias "" Lock or unlock a site collection : Set-SPSite -Identity "Site Collection Url" -LockState "" is one of the following vales : # Unlock: To unlock the site collection and make it available to users. # NoAdditions: To prevent users from adding new content to the site collection. Updates and deletions are still allowed. # ReadOnly: To prevent users from adding, updating, or deleting content. # NoAccess: To prevent access to content completely. Users who attempt to access the site receive
  • 5. an access-denied message. Create a site : New-SPSite "http://sitecollection/sites/Subsite -OwnerAlias "DOMAINUserName" –Language 1033