{"id":2823,"date":"2011-02-24T08:51:46","date_gmt":"2011-02-24T16:51:46","guid":{"rendered":"https:\/\/www.zubairalexander.com\/stage\/?p=2823"},"modified":"2020-05-13T21:36:43","modified_gmt":"2020-05-14T04:36:43","slug":"how-to-permanently-add-sharepoint-powershell-commands-to-powershell-ise","status":"publish","type":"post","link":"https:\/\/www.zubairalexander.com\/blog\/how-to-permanently-add-sharepoint-powershell-commands-to-powershell-ise\/","title":{"rendered":"How to Permanently Add SharePoint PowerShell Commands to PowerShell ISE"},"content":{"rendered":"<p><span style=\"color: #000000;\">You can permanently register the SharePoint PowerShell commands into PowerShell ISE so you don&#8217;t always have to manually add the command <em>Add-PSSnapIn Microsoft.SharePoint.PowerShell<\/em> every time you start PowerShell ISE. Here&#8217;s the step-by-step procedure.<\/span><\/p>\n<ol>\n<li><span style=\"color: #000000;\">Activate PowerShell Integrated Scripting Environment (ISE). By default, PowerShell ISE is installed on Windows Server 2008\/R2 but not activated. To activate it you can use the Add Features wizard in Server Manager. The reason I prefer PowerShell ISE over PowerShell is because it is much nicer and offers a multi-line editor and additional help for scripting.<\/span><\/li>\n<li><span style=\"color: #000000;\">Start PowerShell ISE from Start, All Programs, Accessories, Windows PowerShell, Windows PowerShell ISE.<\/span><br \/>\n<span style=\"color: #000000;\"> <strong>CAUTION<\/strong>: <em>Make sure that you start Windows PowerShell ISE, which is 64-bit, rather than Windows PowerShell ISE (x86) which is 32-bit.<\/em>\u00a0<\/span><\/li>\n<\/ol>\n<ol>\n<li><span style=\"color: #000000;\">Start PowerShell ISE and enter the command <strong>test-path $profile<\/strong>. This will either return a True or a False.<\/span><\/li>\n<li><span style=\"color: #000000;\">If it returns <strong>False<\/strong> then you can create a profile for yourself using the following command.<\/span><br \/>\n<span style=\"color: #000000;\"> <strong>if (!(test-path $profile)) {new-item -type file -path $profile -force}<br \/>\n<\/strong><a href=\"https:\/\/www.zubairalexander.com\/blog\/wp-content\/uploads\/2011\/02\/profile.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-2819\" src=\"https:\/\/www.zubairalexander.com\/blog\/wp-content\/uploads\/2011\/02\/profile.png\" alt=\"\" width=\"734\" height=\"479\" srcset=\"https:\/\/www.zubairalexander.com\/blog\/wp-content\/uploads\/2011\/02\/profile.png 734w, https:\/\/www.zubairalexander.com\/blog\/wp-content\/uploads\/2011\/02\/profile-300x196.png 300w\" sizes=\"(max-width: 734px) 100vw, 734px\" \/><\/a><\/span><\/li>\n<li><span style=\"color: #000000;\">The path to the profile is provided, e.g. <strong>C:\\Users\\SP_Admin\\Documents\\WindowsPowerShell<\/strong>. The name of the file is also provided, e.g. <strong>Microsoft.PowerShellISE_profile.ps1<\/strong>.<\/span><\/li>\n<li><span style=\"color: #000000;\">Open the .ps1 file in Notepad. The file will be blank. Enter the following command and then save the file (File, Save). Make sure that the file is saved with the original .PS1 extension and not .txt.<\/span><br \/>\n<strong><span style=\"color: #000000;\">Add-PSSnapIn Microsoft.SharePoint.PowerShell<\/span><br \/>\n<\/strong><span style=\"color: #ff0000;\"><span style=\"text-decoration: underline;\"><span style=\"color: #000000; text-decoration: underline;\">NOTE:<\/span><\/span> <em>If you get an error that the access is denied, simply save the file on the desktop and then copy it back to the original location.<\/em><em> You will overwrite the existing file, which is empty.<strong><br \/>\n<\/strong><\/em><\/span><\/li>\n<li><span style=\"color: #000000;\">Close and restart the PowerShell ISE. Your SharePoint PowerShell commands should now be available to you. Verify this by typing the following command. You should get a listing of all your sites.<\/span><br \/>\n<span style=\"color: #000000;\"> <strong>Get-SPSite<\/strong><\/span><\/li>\n<li><span style=\"color: #000000;\">If you want to see all the SharePoint PowerShell commands that are available to you, type the following command.<\/span><br \/>\n<span style=\"color: #000000;\"> <strong>Get-Command -PSSnapIn Microsoft.SharePoint.PowerShell<\/strong><\/span><\/li>\n<li><span style=\"color: #000000;\">For more details you can use the pipe symbol with the Format-List option (fl).<\/span><br \/>\n<span style=\"color: #000000;\"> <strong>Get-Command -PSSnapIn Microsoft.SharePoint.PowerShell | fl<\/strong><\/span><\/li>\n<li><span style=\"color: #000000;\">You have over 500 cmdlets available to you. You can verify the total count by using the following command.<\/span><br \/>\n<span style=\"color: #000000;\"> <strong>(Get-Command -PSSnapIn Microsoft.SharePoint.PowerShell).count<\/strong><\/span><\/li>\n<\/ol>\n<p><em><span style=\"color: #000000;\">Last Update: December 4, 2015:<br \/>\n<\/span><\/em><em><span style=\"color: #000000;\">Added note in step 4 about Access Denied error.<\/span><\/em><\/p>\n<hr \/>\n<p><span style=\"font-size: xx-small; font-family: Verdana;\">Copyright \u00a92011 Zubair Alexander. All rights reserved.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>You can permanently register the SharePoint PowerShell commands into PowerShell ISE so you don&#8217;t always have to manually add the command Add-PSSnapIn Microsoft.SharePoint.PowerShell every time you start PowerShell ISE. Here&#8217;s the step-by-step procedure. Activate PowerShell Integrated Scripting Environment (ISE). By default, PowerShell ISE is installed on Windows Server 2008\/R2 but not activated. To activate it [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":4912,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[43,54,11,30],"tags":[],"class_list":["post-2823","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-articles","category-sharepoint","category-tips-tricks","category-longhorn-server"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/www.zubairalexander.com\/blog\/wp-content\/uploads\/2014\/09\/PowerShellStartingScreen.png","_links":{"self":[{"href":"https:\/\/www.zubairalexander.com\/blog\/wp-json\/wp\/v2\/posts\/2823","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zubairalexander.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zubairalexander.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zubairalexander.com\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zubairalexander.com\/blog\/wp-json\/wp\/v2\/comments?post=2823"}],"version-history":[{"count":0,"href":"https:\/\/www.zubairalexander.com\/blog\/wp-json\/wp\/v2\/posts\/2823\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.zubairalexander.com\/blog\/wp-json\/wp\/v2\/media\/4912"}],"wp:attachment":[{"href":"https:\/\/www.zubairalexander.com\/blog\/wp-json\/wp\/v2\/media?parent=2823"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zubairalexander.com\/blog\/wp-json\/wp\/v2\/categories?post=2823"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zubairalexander.com\/blog\/wp-json\/wp\/v2\/tags?post=2823"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}