SlideShare uma empresa Scribd logo
1 de 30
Code Camp NZ 2011 #CCNZ www.mscommunities.co.nz
Introduction PowerShell and SharePoint extensively covered on TechNet2010 Products administration by using Windows PowerShellhttp://technet.microsoft.com/en-us/library/ee806878.aspx Session Goals Demystify PowerShell + SharePoint Examples of PowerShell in action
Session Agenda Quick review of the basics and some useful Cmdlets Walkthrough building a portal using PowerShell Farm Administration Site Administration Deployment of Customisations Diagnostics and Troubleshooting Tips and Resources
basics PowerShell Basics
How Do I?Work with PowerShell + SharePoint SharePoint 2010 Management Shell If you’re not using the SP2010 ManagementShell make sure $host.Runspace.ThreadOptions = "ReuseThread" The PowerShell SharePoint Snapin provides the SP Cmdlets It’s always helpful include a reference to the Snapin Add-PSSnapinMicrosoft.SharePoint.PowerShell-ErrorActionSilentlyContinue
What Do I Get?With PowerShell + SharePoint SharePoint Cmdlets 245 listed on TechNet for SharePoint Foundation 527 listed on TechNet for SharePoint Server  (there’s more according to Get-Command)
Cmdlets“…a lightweight command [for PowerShell]…” Cmdlets return or operate on objects or collections Use the pipeline | to pass and process objects$myObject | ForEach-Object { DoStuff $_ }	ForEach %$myObject | Where-Object { $_ -gt 1 }	Where ? I need some help? Some helpful Cmdlets: Get-HelpGet-Command				$myObject | Get-Member
Assemblies and ClassesPowerShell is not just limited to Cmdlets Create objects with New-Object $site = New-Object Microsoft.SharePoint.SPSite("http://tech.ed") Load other SharePoint or .NET assemblies [System.Reflection.Assembly]::LoadWithPartialName	("Microsoft.Office.Server.Search") [System.Reflection.Assembly]::Load	("Microsoft.Office.Server.Search, Version=14.0.0.0, 	Culture=neutral, PublicKeyToken=71e9bce111e9429c") Deprecated
Farm Administration
Farm AdministrationAdding content to the farm Adding Web ApplicationsNew-SPWebApplication Update the Web ApplicationGet-SPWebApplication Adding Site CollectionsNew-SPSite Content Databases Adding new databasesNew-SPContentDatabase Attaching existing databasesMount-SPContentDatabase Test them using Test-SPContentDatabase
Farm AdministrationProtect and share the content Backup and Restore See the backup historyGet-SPBackupHistory Farm and  more granularBackup-SPFarmandRestore-SPFarm Site CollectionBackup-SPSiteandRestore-SPSite Search  The SAGet-SPEnterpriseSearchServiceApplication Content SourcesGet-SPEnterpriseSearchCrawlContentSource
demo Farm Administration
Site Administration
Site Collections and SitesSites…Also known as SPWeb’s Adding sub sitesNew-SPWeb Change the site collection(s) and site(s) properties  Get-SPSiteandGet-SPWeb Site Permissions and Users Add users and permissionsNew-SPUserandSet-SPUser Site collection administratorsSet-SPSiteAdministration
Site HierarchySPWeb has a lot of friends The site’s hierarchy Sub sites.Webs Lists.Lists Content Types.ContentTypes Fields.Fields . . .
demo Site Administration
Customisation Deployment	and Diagnostics
Customisations and Deployment Solutions Retrieve solutions in farmGet-SPSolutionand download to file system.SolutionFile.SaveAs() Add/Deploy new solution to farmAdd-SPSolutionand Install-SPSolution Remove existing Solution to farmRemove-SPSolutionandUninstall-SPSolution Update existing farm solutionUpdate-SPSolution Features List all features in farmGet-SPFeature Install/Remove featureInstall-SPFeatureand Uninstall-SPFeature Activate/Deactivate featuresEnable-SPFeatureand Disable-SPFeature
Diagnostics and Troubleshooting Developer Dashboard[Microsoft.SharePoint.Administration.SPWebService]	::ContentService.DeveloperDashboardSettings Listening to SharePoint’s logging service (ULS) Get-SPLogEvent
demo Customisation Deployment	and Diagnostics
tips Resources and Tips
Script Tips Use and save scripts – they can be reused, maintained, reused, reused… PS C:ENZ11S> .yscript.ps1 Use variables – they make scripts easier to read and maintain $siteUrl = "http://intranet" Use functions – pieces of logic in the script function Update-SiteTitle($site, $title) { 	$site.Title = $title $site.Update() } Use comments # This explains what the script is doing which is helpful in the future Tab Ahead - PowerShell lets you tab to complete pathname and input  Providing some output is helpful Write-Host “About to do stuff" vs. “About to do stuff" Build and test your scripts incrementally. Not directly in production!
Disposal TipsObject disposal is important to release memory Easiest method is to useSPAssignment Start-SPAssignment -Global # Do stuff ... Stop-SPAssignment –Global You can use.Dispose()to clean up after yourself$site = Get-SPSite http://intranet; $site.Usage; $site.Dispose() Closing the PowerShell Console cleans up the session but it’s the lazy option
Scripts Won’t Run?Usually it will be permissions What’s your Execution Policy?Set-ExecutionPolicyRestricted | AllSigned | RemoteSigned| Unrestricted Is UAC on? You may have to “Run as Administrator” Does the account have rights on databases? Add-SPShellAdmin-UserNamedemoPUser-database SP2010_Content_TENZ
Session TipsSome More Useful Cmdlets Let the farm document itself usingExport-Clixmlhttp://bit.ly/psfarmdoc UseOut-GridViewto output to a Grid UINeeds PowerShell ISE feature enabled (not on by default) UseImport-CSVto read from CSV files. Great input to other “creation” Cmdlets likeNew-SPUserand New-SPWebhttp://bit.ly/psimportcsv
ResourcesUseful Blogs NiklasGoudehttp://www.powershell.nu/ Zach Rosenfieldhttp://sharepoint.microsoft.com/Blogs/zach Gary Lapointehttp://blog.falchionconsulting.com/
ResourcesOfficial Stuff Windows PowerShell for SharePoint Server 2010http://technet.microsoft.com/en-us/library/ee662539.aspx Windows PowerShell for SharePoint Foundation 2010http://technet.microsoft.com/en-us/library/ee662510.aspx STSADM to Windows PowerShell mappinghttp://technet.microsoft.com/en-us/library/ff621081.aspx Microsoft.SharePoint Namespace (MSDN)http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.aspx
Track ResourcesInstallation AutoSPInstallerhttp://autospinstaller.codeplex.com/ Install SharePoint Server 2010 by using Windows PowerShell (SPModule)http://technet.microsoft.com/en-us/library/cc262839.aspx The Wizard Likes His GUIDs (Configuring Service App’s without the Wizard)http://todd-carter.com/post/2010/04/26/The-Wizard-Likes-His-GUIDs.aspx
Content Slide 4th Annual Community SharePoint Conference Business and Technical Tracks, all levels Superb Internationally Renowned SharePoint Experts
Thanks to our sponsorsand partners! Sponsor Premier Partners Associated Partners Supporting Partners

Mais conteúdo relacionado

Mais procurados

Bugzilla Installation Process
Bugzilla Installation ProcessBugzilla Installation Process
Bugzilla Installation ProcessVino Harikrishnan
 
Cloud Automation with Opscode Chef
Cloud Automation with Opscode ChefCloud Automation with Opscode Chef
Cloud Automation with Opscode ChefSri Ram
 
High Performance Django
High Performance DjangoHigh Performance Django
High Performance DjangoDjangoCon2008
 
PyCon US 2012 - State of WSGI 2
PyCon US 2012 - State of WSGI 2PyCon US 2012 - State of WSGI 2
PyCon US 2012 - State of WSGI 2Graham Dumpleton
 
Oracle olap-installation
Oracle olap-installationOracle olap-installation
Oracle olap-installationAmit Sharma
 
Como construir uma Aplicação que consuma e produza updates no Twitter usando ...
Como construir uma Aplicação que consuma e produza updates no Twitter usando ...Como construir uma Aplicação que consuma e produza updates no Twitter usando ...
Como construir uma Aplicação que consuma e produza updates no Twitter usando ...Cirdes Filho
 
Performance Load Cache
Performance Load CachePerformance Load Cache
Performance Load CacheAltan Khendup
 
Caching and tuning fun for high scalability @ FOSDEM 2012
Caching and tuning fun for high scalability @ FOSDEM 2012Caching and tuning fun for high scalability @ FOSDEM 2012
Caching and tuning fun for high scalability @ FOSDEM 2012Wim Godden
 
CertiFUNcation 2017 Best Practices Extension Development for TYPO3 8 LTS
CertiFUNcation 2017 Best Practices Extension Development for TYPO3 8 LTSCertiFUNcation 2017 Best Practices Extension Development for TYPO3 8 LTS
CertiFUNcation 2017 Best Practices Extension Development for TYPO3 8 LTScpsitgmbh
 
php-and-zend-framework-getting-started
php-and-zend-framework-getting-startedphp-and-zend-framework-getting-started
php-and-zend-framework-getting-startedtutorialsruby
 
10 things every developer should know about their database to run word press ...
10 things every developer should know about their database to run word press ...10 things every developer should know about their database to run word press ...
10 things every developer should know about their database to run word press ...Otto Kekäläinen
 
Cloud Automation with Opscode Chef
Cloud Automation with Opscode ChefCloud Automation with Opscode Chef
Cloud Automation with Opscode ChefSri Ram
 
Cloud patterns applied
Cloud patterns appliedCloud patterns applied
Cloud patterns appliedLars Fronius
 
Installation of Drupal on Windows XP with XAMPP
Installation of Drupal on Windows XP with XAMPPInstallation of Drupal on Windows XP with XAMPP
Installation of Drupal on Windows XP with XAMPPRupesh Kumar
 

Mais procurados (17)

Bugzilla Installation Process
Bugzilla Installation ProcessBugzilla Installation Process
Bugzilla Installation Process
 
Cloud Automation with Opscode Chef
Cloud Automation with Opscode ChefCloud Automation with Opscode Chef
Cloud Automation with Opscode Chef
 
Odoo V8 Installation
Odoo V8 InstallationOdoo V8 Installation
Odoo V8 Installation
 
High Performance Django
High Performance DjangoHigh Performance Django
High Performance Django
 
Rest api with Python
Rest api with PythonRest api with Python
Rest api with Python
 
PyCon US 2012 - State of WSGI 2
PyCon US 2012 - State of WSGI 2PyCon US 2012 - State of WSGI 2
PyCon US 2012 - State of WSGI 2
 
Oracle olap-installation
Oracle olap-installationOracle olap-installation
Oracle olap-installation
 
Como construir uma Aplicação que consuma e produza updates no Twitter usando ...
Como construir uma Aplicação que consuma e produza updates no Twitter usando ...Como construir uma Aplicação que consuma e produza updates no Twitter usando ...
Como construir uma Aplicação que consuma e produza updates no Twitter usando ...
 
Performance Load Cache
Performance Load CachePerformance Load Cache
Performance Load Cache
 
Caching and tuning fun for high scalability @ FOSDEM 2012
Caching and tuning fun for high scalability @ FOSDEM 2012Caching and tuning fun for high scalability @ FOSDEM 2012
Caching and tuning fun for high scalability @ FOSDEM 2012
 
CertiFUNcation 2017 Best Practices Extension Development for TYPO3 8 LTS
CertiFUNcation 2017 Best Practices Extension Development for TYPO3 8 LTSCertiFUNcation 2017 Best Practices Extension Development for TYPO3 8 LTS
CertiFUNcation 2017 Best Practices Extension Development for TYPO3 8 LTS
 
php-and-zend-framework-getting-started
php-and-zend-framework-getting-startedphp-and-zend-framework-getting-started
php-and-zend-framework-getting-started
 
Cake php
Cake phpCake php
Cake php
 
10 things every developer should know about their database to run word press ...
10 things every developer should know about their database to run word press ...10 things every developer should know about their database to run word press ...
10 things every developer should know about their database to run word press ...
 
Cloud Automation with Opscode Chef
Cloud Automation with Opscode ChefCloud Automation with Opscode Chef
Cloud Automation with Opscode Chef
 
Cloud patterns applied
Cloud patterns appliedCloud patterns applied
Cloud patterns applied
 
Installation of Drupal on Windows XP with XAMPP
Installation of Drupal on Windows XP with XAMPPInstallation of Drupal on Windows XP with XAMPP
Installation of Drupal on Windows XP with XAMPP
 

Semelhante a NZ Code Camp 2011 PowerShell + SharePoint

Intro to PowerShell
Intro to PowerShellIntro to PowerShell
Intro to PowerShellAdam Preston
 
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 PowershellSharePoint 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 PowershellSharePoint Saturday NY
 
Intro to SharePoint + PowerShell
Intro to SharePoint + PowerShellIntro to SharePoint + PowerShell
Intro to SharePoint + PowerShellRyan Dennis
 
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshop
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshopIntroduction to PowerShell - Be a PowerShell Hero - SPFest workshop
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshopMichael Blumenthal (Microsoft MVP)
 
Introduction to PowerShell
Introduction to PowerShellIntroduction to PowerShell
Introduction to PowerShellBoulos Dib
 
Make the hosting company life easier with SharePoint PowerShell
Make the hosting company life easier with SharePoint PowerShellMake the hosting company life easier with SharePoint PowerShell
Make the hosting company life easier with SharePoint PowerShellVirtual Affairs
 
Operacion Guinda 2
Operacion Guinda 2Operacion Guinda 2
Operacion Guinda 2Red RADAR
 
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
 
Spstc2011 managed metadata real world
Spstc2011 managed metadata real worldSpstc2011 managed metadata real world
Spstc2011 managed metadata real worldAtul Chhoda
 
Spstc2011 managed metadata real world
Spstc2011 managed metadata real worldSpstc2011 managed metadata real world
Spstc2011 managed metadata real worldAtul Chhoda
 
Mai Omar Desouki - SharePoint 2010 ITPRO
Mai Omar Desouki - SharePoint 2010 ITPROMai Omar Desouki - SharePoint 2010 ITPRO
Mai Omar Desouki - SharePoint 2010 ITPROMai Omar Desouki
 
Apache Traffic Server
Apache Traffic ServerApache Traffic Server
Apache Traffic Serversupertom
 
PowerShell for SharePoint Developers
PowerShell for SharePoint DevelopersPowerShell for SharePoint Developers
PowerShell for SharePoint DevelopersBoulos Dib
 
Windows power shell for sharepoint online & office 365
Windows power shell for sharepoint online & office 365Windows power shell for sharepoint online & office 365
Windows power shell for sharepoint online & office 365Prashant Kumar Singh
 
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 PerspectiveJohn Calvert
 
NIIT ISAS Q5 Report - Windows PowerShell
NIIT ISAS Q5 Report - Windows PowerShellNIIT ISAS Q5 Report - Windows PowerShell
NIIT ISAS Q5 Report - Windows PowerShellPhan Hien
 

Semelhante a NZ Code Camp 2011 PowerShell + SharePoint (20)

Admin share point with powershell
Admin share point with powershellAdmin share point with powershell
Admin share point with powershell
 
Admin SharePoint 2010 with PowerShell
Admin SharePoint 2010 with PowerShellAdmin SharePoint 2010 with PowerShell
Admin SharePoint 2010 with PowerShell
 
Intro to PowerShell
Intro to PowerShellIntro to PowerShell
Intro to 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
 
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
 
Intro to SharePoint + PowerShell
Intro to SharePoint + PowerShellIntro to SharePoint + PowerShell
Intro to SharePoint + PowerShell
 
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshop
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshopIntroduction to PowerShell - Be a PowerShell Hero - SPFest workshop
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshop
 
Introduction to PowerShell
Introduction to PowerShellIntroduction to PowerShell
Introduction to PowerShell
 
Power shell
Power shellPower shell
Power shell
 
Make the hosting company life easier with SharePoint PowerShell
Make the hosting company life easier with SharePoint PowerShellMake the hosting company life easier with SharePoint PowerShell
Make the hosting company life easier with SharePoint PowerShell
 
Operacion Guinda 2
Operacion Guinda 2Operacion Guinda 2
Operacion Guinda 2
 
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...
 
Spstc2011 managed metadata real world
Spstc2011 managed metadata real worldSpstc2011 managed metadata real world
Spstc2011 managed metadata real world
 
Spstc2011 managed metadata real world
Spstc2011 managed metadata real worldSpstc2011 managed metadata real world
Spstc2011 managed metadata real world
 
Mai Omar Desouki - SharePoint 2010 ITPRO
Mai Omar Desouki - SharePoint 2010 ITPROMai Omar Desouki - SharePoint 2010 ITPRO
Mai Omar Desouki - SharePoint 2010 ITPRO
 
Apache Traffic Server
Apache Traffic ServerApache Traffic Server
Apache Traffic Server
 
PowerShell for SharePoint Developers
PowerShell for SharePoint DevelopersPowerShell for SharePoint Developers
PowerShell for SharePoint Developers
 
Windows power shell for sharepoint online & office 365
Windows power shell for sharepoint online & office 365Windows power shell for sharepoint online & office 365
Windows power shell for sharepoint online & office 365
 
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
 
NIIT ISAS Q5 Report - Windows PowerShell
NIIT ISAS Q5 Report - Windows PowerShellNIIT ISAS Q5 Report - Windows PowerShell
NIIT ISAS Q5 Report - Windows PowerShell
 

Último

Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 

Último (20)

Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 

NZ Code Camp 2011 PowerShell + SharePoint

  • 1. Code Camp NZ 2011 #CCNZ www.mscommunities.co.nz
  • 2. Introduction PowerShell and SharePoint extensively covered on TechNet2010 Products administration by using Windows PowerShellhttp://technet.microsoft.com/en-us/library/ee806878.aspx Session Goals Demystify PowerShell + SharePoint Examples of PowerShell in action
  • 3. Session Agenda Quick review of the basics and some useful Cmdlets Walkthrough building a portal using PowerShell Farm Administration Site Administration Deployment of Customisations Diagnostics and Troubleshooting Tips and Resources
  • 5. How Do I?Work with PowerShell + SharePoint SharePoint 2010 Management Shell If you’re not using the SP2010 ManagementShell make sure $host.Runspace.ThreadOptions = "ReuseThread" The PowerShell SharePoint Snapin provides the SP Cmdlets It’s always helpful include a reference to the Snapin Add-PSSnapinMicrosoft.SharePoint.PowerShell-ErrorActionSilentlyContinue
  • 6. What Do I Get?With PowerShell + SharePoint SharePoint Cmdlets 245 listed on TechNet for SharePoint Foundation 527 listed on TechNet for SharePoint Server (there’s more according to Get-Command)
  • 7. Cmdlets“…a lightweight command [for PowerShell]…” Cmdlets return or operate on objects or collections Use the pipeline | to pass and process objects$myObject | ForEach-Object { DoStuff $_ } ForEach %$myObject | Where-Object { $_ -gt 1 } Where ? I need some help? Some helpful Cmdlets: Get-HelpGet-Command $myObject | Get-Member
  • 8. Assemblies and ClassesPowerShell is not just limited to Cmdlets Create objects with New-Object $site = New-Object Microsoft.SharePoint.SPSite("http://tech.ed") Load other SharePoint or .NET assemblies [System.Reflection.Assembly]::LoadWithPartialName ("Microsoft.Office.Server.Search") [System.Reflection.Assembly]::Load ("Microsoft.Office.Server.Search, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") Deprecated
  • 10. Farm AdministrationAdding content to the farm Adding Web ApplicationsNew-SPWebApplication Update the Web ApplicationGet-SPWebApplication Adding Site CollectionsNew-SPSite Content Databases Adding new databasesNew-SPContentDatabase Attaching existing databasesMount-SPContentDatabase Test them using Test-SPContentDatabase
  • 11. Farm AdministrationProtect and share the content Backup and Restore See the backup historyGet-SPBackupHistory Farm and more granularBackup-SPFarmandRestore-SPFarm Site CollectionBackup-SPSiteandRestore-SPSite Search The SAGet-SPEnterpriseSearchServiceApplication Content SourcesGet-SPEnterpriseSearchCrawlContentSource
  • 14. Site Collections and SitesSites…Also known as SPWeb’s Adding sub sitesNew-SPWeb Change the site collection(s) and site(s) properties Get-SPSiteandGet-SPWeb Site Permissions and Users Add users and permissionsNew-SPUserandSet-SPUser Site collection administratorsSet-SPSiteAdministration
  • 15. Site HierarchySPWeb has a lot of friends The site’s hierarchy Sub sites.Webs Lists.Lists Content Types.ContentTypes Fields.Fields . . .
  • 18. Customisations and Deployment Solutions Retrieve solutions in farmGet-SPSolutionand download to file system.SolutionFile.SaveAs() Add/Deploy new solution to farmAdd-SPSolutionand Install-SPSolution Remove existing Solution to farmRemove-SPSolutionandUninstall-SPSolution Update existing farm solutionUpdate-SPSolution Features List all features in farmGet-SPFeature Install/Remove featureInstall-SPFeatureand Uninstall-SPFeature Activate/Deactivate featuresEnable-SPFeatureand Disable-SPFeature
  • 19. Diagnostics and Troubleshooting Developer Dashboard[Microsoft.SharePoint.Administration.SPWebService] ::ContentService.DeveloperDashboardSettings Listening to SharePoint’s logging service (ULS) Get-SPLogEvent
  • 22. Script Tips Use and save scripts – they can be reused, maintained, reused, reused… PS C:ENZ11S> .yscript.ps1 Use variables – they make scripts easier to read and maintain $siteUrl = "http://intranet" Use functions – pieces of logic in the script function Update-SiteTitle($site, $title) { $site.Title = $title $site.Update() } Use comments # This explains what the script is doing which is helpful in the future Tab Ahead - PowerShell lets you tab to complete pathname and input Providing some output is helpful Write-Host “About to do stuff" vs. “About to do stuff" Build and test your scripts incrementally. Not directly in production!
  • 23. Disposal TipsObject disposal is important to release memory Easiest method is to useSPAssignment Start-SPAssignment -Global # Do stuff ... Stop-SPAssignment –Global You can use.Dispose()to clean up after yourself$site = Get-SPSite http://intranet; $site.Usage; $site.Dispose() Closing the PowerShell Console cleans up the session but it’s the lazy option
  • 24. Scripts Won’t Run?Usually it will be permissions What’s your Execution Policy?Set-ExecutionPolicyRestricted | AllSigned | RemoteSigned| Unrestricted Is UAC on? You may have to “Run as Administrator” Does the account have rights on databases? Add-SPShellAdmin-UserNamedemoPUser-database SP2010_Content_TENZ
  • 25. Session TipsSome More Useful Cmdlets Let the farm document itself usingExport-Clixmlhttp://bit.ly/psfarmdoc UseOut-GridViewto output to a Grid UINeeds PowerShell ISE feature enabled (not on by default) UseImport-CSVto read from CSV files. Great input to other “creation” Cmdlets likeNew-SPUserand New-SPWebhttp://bit.ly/psimportcsv
  • 26. ResourcesUseful Blogs NiklasGoudehttp://www.powershell.nu/ Zach Rosenfieldhttp://sharepoint.microsoft.com/Blogs/zach Gary Lapointehttp://blog.falchionconsulting.com/
  • 27. ResourcesOfficial Stuff Windows PowerShell for SharePoint Server 2010http://technet.microsoft.com/en-us/library/ee662539.aspx Windows PowerShell for SharePoint Foundation 2010http://technet.microsoft.com/en-us/library/ee662510.aspx STSADM to Windows PowerShell mappinghttp://technet.microsoft.com/en-us/library/ff621081.aspx Microsoft.SharePoint Namespace (MSDN)http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.aspx
  • 28. Track ResourcesInstallation AutoSPInstallerhttp://autospinstaller.codeplex.com/ Install SharePoint Server 2010 by using Windows PowerShell (SPModule)http://technet.microsoft.com/en-us/library/cc262839.aspx The Wizard Likes His GUIDs (Configuring Service App’s without the Wizard)http://todd-carter.com/post/2010/04/26/The-Wizard-Likes-His-GUIDs.aspx
  • 29. Content Slide 4th Annual Community SharePoint Conference Business and Technical Tracks, all levels Superb Internationally Renowned SharePoint Experts
  • 30. Thanks to our sponsorsand partners! Sponsor Premier Partners Associated Partners Supporting Partners

Notas do Editor

  1. ForEach-Object and Where-Object both use $_ to represent the default objectWhere-ObjectFiltering the data streamUse operators to perform filter:-lt -- Less than-le -- Less than or equal to-gt -- Greater than-ge -- Greater than or equal to-eq -- Equal to-ne -- Not equal to-like - Like; uses wildcards for pattern matching
  2. New Site CollectionFind out what templates are available Get-SPWebTemplate
  3. Set-ExecutionPolicyhttp://technet.microsoft.com/en-us/library/ee176961.aspxAdd-SPShellAdminhttp://blogs.technet.com/b/heyscriptingguy/archive/2010/07/06/hey-scripting-guy-tell-me-about-permissions-for-using-windows-powershell-2-0-cmdlets-with-sharepoint-2010.aspx
  4. Document Farm with export-Clixmlhttp://technet.microsoft.com/en-us/library/ff645391.aspxImport-CSV http://technet.microsoft.com/en-us/library/dd347665.aspx