Share Point Power Shell Tips Tricks and Random Goodness
-
Upload
alejandro-fuentes -
Category
Documents
-
view
218 -
download
0
Transcript of Share Point Power Shell Tips Tricks and Random Goodness
8/2/2019 Share Point Power Shell Tips Tricks and Random Goodness
http://slidepdf.com/reader/full/share-point-power-shell-tips-tricks-and-random-goodness 1/26
SharePoint 2010 & PowerShell:
Tips, Tricks, and Random Goodness
Gary Lapointe
Director
, Aptillon, Inc.
SharePoint MVP
8/2/2019 Share Point Power Shell Tips Tricks and Random Goodness
http://slidepdf.com/reader/full/share-point-power-shell-tips-tricks-and-random-goodness 2/26
About Me
• Aptill
on, Inc.
– Director and Founding Partner
–
http://www.aptillon.com• SharePoint MVP since January 2008
• Blog: http://blog.falchionconsulting.com
• Twitter: @glapointe
8/2/2019 Share Point Power Shell Tips Tricks and Random Goodness
http://slidepdf.com/reader/full/share-point-power-shell-tips-tricks-and-random-goodness 3/26
Load Snap
-
in For any Editor
8/2/2019 Share Point Power Shell Tips Tricks and Random Goodness
http://slidepdf.com/reader/full/share-point-power-shell-tips-tricks-and-random-goodness 4/26
Run Elevated
8/2/2019 Share Point Power Shell Tips Tricks and Random Goodness
http://slidepdf.com/reader/full/share-point-power-shell-tips-tricks-and-random-goodness 5/26
Finding Help
• Documentation: help <cmdlet name>
• Discovery:
–Get-Command
– Get-Member
– Get-Verb
8/2/2019 Share Point Power Shell Tips Tricks and Random Goodness
http://slidepdf.com/reader/full/share-point-power-shell-tips-tricks-and-random-goodness 6/26
PowerShell Command Builder
http://technet.microsoft.com/en-us/sharepoint/ff603532
8/2/2019 Share Point Power Shell Tips Tricks and Random Goodness
http://slidepdf.com/reader/full/share-point-power-shell-tips-tricks-and-random-goodness 7/26
Know Your Output Options
Not like throwing an exception!
help about_Preference_Variables
Exact same thing
8/2/2019 Share Point Power Shell Tips Tricks and Random Goodness
http://slidepdf.com/reader/full/share-point-power-shell-tips-tricks-and-random-goodness 8/26
Fancy Output
Baloon Tips
Text to Speech
8/2/2019 Share Point Power Shell Tips Tricks and Random Goodness
http://slidepdf.com/reader/full/share-point-power-shell-tips-tricks-and-random-goodness 9/26
WhatIf ???
8/2/2019 Share Point Power Shell Tips Tricks and Random Goodness
http://slidepdf.com/reader/full/share-point-power-shell-tips-tricks-and-random-goodness 10/26
Negating Switch Statements
Bug: Enables Kerberos
Omitting will disable Kerberos
8/2/2019 Share Point Power Shell Tips Tricks and Random Goodness
http://slidepdf.com/reader/full/share-point-power-shell-tips-tricks-and-random-goodness 11/26
Don’t Use ForEach-Object in Scripts
8/2/2019 Share Point Power Shell Tips Tricks and Random Goodness
http://slidepdf.com/reader/full/share-point-power-shell-tips-tricks-and-random-goodness 12/26
Test Loops & Conditions Before
Making Changes
But Wait! What’swrong with this
example?!?!
8/2/2019 Share Point Power Shell Tips Tricks and Random Goodness
http://slidepdf.com/reader/full/share-point-power-shell-tips-tricks-and-random-goodness 13/26
Objects Need to be Disposed!
Don’t rely on the
SPAssignmentCollection!
8/2/2019 Share Point Power Shell Tips Tricks and Random Goodness
http://slidepdf.com/reader/full/share-point-power-shell-tips-tricks-and-random-goodness 14/26
Functions Can Support the Pipeline!
Be Careful! Extra
Work is Needed for
normal functioncalls!
8/2/2019 Share Point Power Shell Tips Tricks and Random Goodness
http://slidepdf.com/reader/full/share-point-power-shell-tips-tricks-and-random-goodness 15/26
Use Advanced Parameters
Type help about_functions_advanced_parameters for more examples
8/2/2019 Share Point Power Shell Tips Tricks and Random Goodness
http://slidepdf.com/reader/full/share-point-power-shell-tips-tricks-and-random-goodness 16/26
Create Dynamic Objects for Complex Output (as
opposed to Select-Object)
8/2/2019 Share Point Power Shell Tips Tricks and Random Goodness
http://slidepdf.com/reader/full/share-point-power-shell-tips-tricks-and-random-goodness 17/26
Adaptive Type System: XML
8/2/2019 Share Point Power Shell Tips Tricks and Random Goodness
http://slidepdf.com/reader/full/share-point-power-shell-tips-tricks-and-random-goodness 18/26
Splatting
• Provides cmdlet properties via a hash table
• Create a hash table:
– $varname = @{"key"=value;…}
• Pass to cmdlet as @varname
– New-SPSite @varname
8/2/2019 Share Point Power Shell Tips Tricks and Random Goodness
http://slidepdf.com/reader/full/share-point-power-shell-tips-tricks-and-random-goodness 19/26
Executing Script Block Variables
8/2/2019 Share Point Power Shell Tips Tricks and Random Goodness
http://slidepdf.com/reader/full/share-point-power-shell-tips-tricks-and-random-goodness 20/26
Null HTTP Context
8/2/2019 Share Point Power Shell Tips Tricks and Random Goodness
http://slidepdf.com/reader/full/share-point-power-shell-tips-tricks-and-random-goodness 21/26
Watch for Cached Assemblies
• When activating Features via PowerShell,
close your PowerShell session after each
updated Solution deployment
– Applies to any references to code that have been
updated, not just Features (but Features are the
more common scenario)
8/2/2019 Share Point Power Shell Tips Tricks and Random Goodness
http://slidepdf.com/reader/full/share-point-power-shell-tips-tricks-and-random-goodness 22/26
Enabling Remoting• Run Enable-PsRemoting on the client and server machines
• Must Enable CredSSP on client and server machines – Client: Enable-WSmanCredSSP -Role Client -DelegateComputer <remote server name>
– Server:Enable-WSmanCredSSP -Role Server
• Increase the MaxMemoryPerShellMB setting on server (default is150MB) – Set-ItemWSMan:\localhost\Shell\MaxMemoryPerShellMB 1024
• Decrease MaxShellsPerUser and MaxConcurrentUsers (default is 5) – Set-ItemWSMan:\localhost\shell\MaxShellsPerUser 2
– Set-ItemWSMan:\localhost\shell\MaxConcurrentUsers 2
8/2/2019 Share Point Power Shell Tips Tricks and Random Goodness
http://slidepdf.com/reader/full/share-point-power-shell-tips-tricks-and-random-goodness 23/26
Remoting Session Configurations
• Use Register-PSSessionConfiguration to preloadSharePoint PowerShell Snap-In
– Must also set threading options
• Use Set-PSSessionConfiguration with -ShowSecurityDescriptorUI
parameter to set security• Provide configuration name when callingNew-PSSession
8/2/2019 Share Point Power Shell Tips Tricks and Random Goodness
http://slidepdf.com/reader/full/share-point-power-shell-tips-tricks-and-random-goodness 24/26
Additional Resources
• http://blog.falchionconsulting.com
– Buy my book
•
PowerShell.com – lots of good tips
• PowerShell Cheat Sheet:
–
http://tinyurl.com/3hgtfke
8/2/2019 Share Point Power Shell Tips Tricks and Random Goodness
http://slidepdf.com/reader/full/share-point-power-shell-tips-tricks-and-random-goodness 25/26
About Aptillon• SharePoint MVPs
• Microsoft Certified Master
•
Consultants, Trainers, Authors, Speakers,Bloggers
• Great People, Great Experience, Great Passion
Matthew McDermottDavid Mann Gary Lapointe Darrin Bishop Maurice Prather Dan HolmeTodd Baginski
8/2/2019 Share Point Power Shell Tips Tricks and Random Goodness
http://slidepdf.com/reader/full/share-point-power-shell-tips-tricks-and-random-goodness 26/26
Questions?