Aptillon, Inc. – Director and Founding Partner – SharePoint MVP since January 2008 Blog:...
-
date post
20-Dec-2015 -
Category
Documents
-
view
217 -
download
1
Transcript of Aptillon, Inc. – Director and Founding Partner – SharePoint MVP since January 2008 Blog:...
![Page 1: Aptillon, Inc. – Director and Founding Partner – SharePoint MVP since January 2008 Blog: ://blog.falchionconsulting.com.](https://reader034.fdocuments.net/reader034/viewer/2022051516/56649d4c5503460f94a2a4e8/html5/thumbnails/1.jpg)
SharePoint 2010 & PowerShell:Tips, Tricks, and Random Goodness
Gary LapointeDirector, Aptillon, Inc.
SharePoint MVP
![Page 2: Aptillon, Inc. – Director and Founding Partner – SharePoint MVP since January 2008 Blog: ://blog.falchionconsulting.com.](https://reader034.fdocuments.net/reader034/viewer/2022051516/56649d4c5503460f94a2a4e8/html5/thumbnails/2.jpg)
About Me
• Aptillon, Inc.– Director and Founding Partner– http://www.aptillon.com
• SharePoint MVP since January 2008• Blog: http://blog.falchionconsulting.com• Twitter: @glapointe
![Page 3: Aptillon, Inc. – Director and Founding Partner – SharePoint MVP since January 2008 Blog: ://blog.falchionconsulting.com.](https://reader034.fdocuments.net/reader034/viewer/2022051516/56649d4c5503460f94a2a4e8/html5/thumbnails/3.jpg)
Load Snap-in For any Editor
![Page 4: Aptillon, Inc. – Director and Founding Partner – SharePoint MVP since January 2008 Blog: ://blog.falchionconsulting.com.](https://reader034.fdocuments.net/reader034/viewer/2022051516/56649d4c5503460f94a2a4e8/html5/thumbnails/4.jpg)
Run Elevated
![Page 5: Aptillon, Inc. – Director and Founding Partner – SharePoint MVP since January 2008 Blog: ://blog.falchionconsulting.com.](https://reader034.fdocuments.net/reader034/viewer/2022051516/56649d4c5503460f94a2a4e8/html5/thumbnails/5.jpg)
Finding Help
• Documentation: help <cmdlet name>• Discovery:– Get-Command– Get-Member– Get-Verb
![Page 6: Aptillon, Inc. – Director and Founding Partner – SharePoint MVP since January 2008 Blog: ://blog.falchionconsulting.com.](https://reader034.fdocuments.net/reader034/viewer/2022051516/56649d4c5503460f94a2a4e8/html5/thumbnails/6.jpg)
PowerShell Command Builderhttp://technet.microsoft.com/en-us/sharepoint/ff603532
![Page 7: Aptillon, Inc. – Director and Founding Partner – SharePoint MVP since January 2008 Blog: ://blog.falchionconsulting.com.](https://reader034.fdocuments.net/reader034/viewer/2022051516/56649d4c5503460f94a2a4e8/html5/thumbnails/7.jpg)
Know Your Output Options
Not like throwing an exception!
help about_Preference_Variables
Exact same thing
![Page 8: Aptillon, Inc. – Director and Founding Partner – SharePoint MVP since January 2008 Blog: ://blog.falchionconsulting.com.](https://reader034.fdocuments.net/reader034/viewer/2022051516/56649d4c5503460f94a2a4e8/html5/thumbnails/8.jpg)
Fancy Output
Baloon Tips
Text to Speech
![Page 9: Aptillon, Inc. – Director and Founding Partner – SharePoint MVP since January 2008 Blog: ://blog.falchionconsulting.com.](https://reader034.fdocuments.net/reader034/viewer/2022051516/56649d4c5503460f94a2a4e8/html5/thumbnails/9.jpg)
WhatIf???
![Page 10: Aptillon, Inc. – Director and Founding Partner – SharePoint MVP since January 2008 Blog: ://blog.falchionconsulting.com.](https://reader034.fdocuments.net/reader034/viewer/2022051516/56649d4c5503460f94a2a4e8/html5/thumbnails/10.jpg)
Negating Switch Statements
Bug: Enables KerberosOmitting will disable Kerberos
![Page 11: Aptillon, Inc. – Director and Founding Partner – SharePoint MVP since January 2008 Blog: ://blog.falchionconsulting.com.](https://reader034.fdocuments.net/reader034/viewer/2022051516/56649d4c5503460f94a2a4e8/html5/thumbnails/11.jpg)
Don’t Use ForEach-Object in Scripts
![Page 12: Aptillon, Inc. – Director and Founding Partner – SharePoint MVP since January 2008 Blog: ://blog.falchionconsulting.com.](https://reader034.fdocuments.net/reader034/viewer/2022051516/56649d4c5503460f94a2a4e8/html5/thumbnails/12.jpg)
Test Loops & Conditions Before Making Changes
But Wait! What’s wrong with this
example?!?!
![Page 13: Aptillon, Inc. – Director and Founding Partner – SharePoint MVP since January 2008 Blog: ://blog.falchionconsulting.com.](https://reader034.fdocuments.net/reader034/viewer/2022051516/56649d4c5503460f94a2a4e8/html5/thumbnails/13.jpg)
Objects Need to be Disposed!
Don’t rely on the SPAssignmentCollection!
![Page 14: Aptillon, Inc. – Director and Founding Partner – SharePoint MVP since January 2008 Blog: ://blog.falchionconsulting.com.](https://reader034.fdocuments.net/reader034/viewer/2022051516/56649d4c5503460f94a2a4e8/html5/thumbnails/14.jpg)
Functions Can Support the Pipeline!
Be Careful! Extra Work is Needed for
normal function calls!
![Page 15: Aptillon, Inc. – Director and Founding Partner – SharePoint MVP since January 2008 Blog: ://blog.falchionconsulting.com.](https://reader034.fdocuments.net/reader034/viewer/2022051516/56649d4c5503460f94a2a4e8/html5/thumbnails/15.jpg)
Use Advanced Parameters
Type help about_functions_advanced_parameters for more examples
![Page 16: Aptillon, Inc. – Director and Founding Partner – SharePoint MVP since January 2008 Blog: ://blog.falchionconsulting.com.](https://reader034.fdocuments.net/reader034/viewer/2022051516/56649d4c5503460f94a2a4e8/html5/thumbnails/16.jpg)
Create Dynamic Objects for Complex Output (as opposed to Select-Object)
![Page 17: Aptillon, Inc. – Director and Founding Partner – SharePoint MVP since January 2008 Blog: ://blog.falchionconsulting.com.](https://reader034.fdocuments.net/reader034/viewer/2022051516/56649d4c5503460f94a2a4e8/html5/thumbnails/17.jpg)
Adaptive Type System: XML
![Page 18: Aptillon, Inc. – Director and Founding Partner – SharePoint MVP since January 2008 Blog: ://blog.falchionconsulting.com.](https://reader034.fdocuments.net/reader034/viewer/2022051516/56649d4c5503460f94a2a4e8/html5/thumbnails/18.jpg)
Splatting• Provides cmdlet properties via a hash table• Create a hash table: – $varname = @{"key"=value;…}
• Pass to cmdlet as @varname– New-SPSite @varname
![Page 19: Aptillon, Inc. – Director and Founding Partner – SharePoint MVP since January 2008 Blog: ://blog.falchionconsulting.com.](https://reader034.fdocuments.net/reader034/viewer/2022051516/56649d4c5503460f94a2a4e8/html5/thumbnails/19.jpg)
Executing Script Block Variables
![Page 20: Aptillon, Inc. – Director and Founding Partner – SharePoint MVP since January 2008 Blog: ://blog.falchionconsulting.com.](https://reader034.fdocuments.net/reader034/viewer/2022051516/56649d4c5503460f94a2a4e8/html5/thumbnails/20.jpg)
Null HTTP Context
![Page 21: Aptillon, Inc. – Director and Founding Partner – SharePoint MVP since January 2008 Blog: ://blog.falchionconsulting.com.](https://reader034.fdocuments.net/reader034/viewer/2022051516/56649d4c5503460f94a2a4e8/html5/thumbnails/21.jpg)
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)
![Page 22: Aptillon, Inc. – Director and Founding Partner – SharePoint MVP since January 2008 Blog: ://blog.falchionconsulting.com.](https://reader034.fdocuments.net/reader034/viewer/2022051516/56649d4c5503460f94a2a4e8/html5/thumbnails/22.jpg)
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 is
150MB)– Set-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB 1024
• Decrease MaxShellsPerUser and MaxConcurrentUsers (default is 5)– Set-Item WSMan:\localhost\shell\MaxShellsPerUser 2– Set-Item WSMan:\localhost\shell\MaxConcurrentUsers 2
![Page 23: Aptillon, Inc. – Director and Founding Partner – SharePoint MVP since January 2008 Blog: ://blog.falchionconsulting.com.](https://reader034.fdocuments.net/reader034/viewer/2022051516/56649d4c5503460f94a2a4e8/html5/thumbnails/23.jpg)
Remoting Session Configurations
• Use Register-PSSessionConfiguration to preload SharePoint PowerShell Snap-In– Must also set threading options
• Use Set-PSSessionConfiguration with -ShowSecurityDescriptorUI parameter to set security
• Provide configuration name when calling New-PSSession
![Page 24: Aptillon, Inc. – Director and Founding Partner – SharePoint MVP since January 2008 Blog: ://blog.falchionconsulting.com.](https://reader034.fdocuments.net/reader034/viewer/2022051516/56649d4c5503460f94a2a4e8/html5/thumbnails/24.jpg)
Additional Resources
• http://blog.falchionconsulting.com– Buy my book
• PowerShell.com– lots of good tips
• PowerShell Cheat Sheet:– http://tinyurl.com/3hgtfke
![Page 25: Aptillon, Inc. – Director and Founding Partner – SharePoint MVP since January 2008 Blog: ://blog.falchionconsulting.com.](https://reader034.fdocuments.net/reader034/viewer/2022051516/56649d4c5503460f94a2a4e8/html5/thumbnails/25.jpg)
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
![Page 26: Aptillon, Inc. – Director and Founding Partner – SharePoint MVP since January 2008 Blog: ://blog.falchionconsulting.com.](https://reader034.fdocuments.net/reader034/viewer/2022051516/56649d4c5503460f94a2a4e8/html5/thumbnails/26.jpg)
Questions?