{"id":1366,"date":"2013-04-02T02:23:18","date_gmt":"2013-04-02T02:23:18","guid":{"rendered":"https:\/\/pipe2text.com\/?page_id=1366"},"modified":"2013-04-02T02:26:44","modified_gmt":"2013-04-02T02:26:44","slug":"using-the-server-manager-module-in-powershell-to-install-roles-and-features-on-a-windows-server","status":"publish","type":"page","link":"https:\/\/pipe2text.com\/?page_id=1366","title":{"rendered":"Using the Server Manager Module in PowerShell to Install Roles and Features On a Windows Server"},"content":{"rendered":"<p><a id=\"_GoBack\"><\/a>Hi All,<\/p>\n<p>Using the Server Manager Module in PowerShell is a quick and easy way to view or install roles and features on your server. It\u2019s much quicker than using the GUI and is also useful to know when doing such things as scripted installs.<\/p>\n<p>To get started, open PowerShell as Administrator and type the following to import the server manager module (if you are using PowerShell 3.0 there is no need to import the module as it will be imported automatically upon using the first cmdlet from the module). Type the following command:<\/p>\n<p>Import-Module servermanager<\/p>\n<p><img decoding=\"async\" style=\"display: inline;\" alt=\"\" src=\"https:\/\/pipe2text.com\/wp-content\/plugins..\/..\/uploads\/media\/servermanagermodule\/image1.png\" \/><\/p>\n<p>A good place to start would be by looking all the available Roles and Features on the server. You can do this by using the \u201cGet-WindowsFeature\u201d cmdlet. Type the following command:<\/p>\n<p>Get-WindowsFeature<\/p>\n<p>As you can see from the Windows Below, this particular server has some \u201cFile and Storage Services\u201d installed and you can also what is available.<\/p>\n<p><img decoding=\"async\" style=\"display: inline;\" alt=\"\" src=\"https:\/\/pipe2text.com\/wp-content\/plugins..\/..\/uploads\/media\/servermanagermodule\/image2.png\" \/><\/p>\n<p>Now if you didn\u2019t want to see every role and feature available but were only interested in let\u2019s say \u201cPrint and Document Services\u201d. To avoid having to scroll thru the entire list you could type the following:<\/p>\n<p>Get-WindowsFeature *print*<\/p>\n<p>The above command would return all the Roles and Features containing the word \u201cPrint\u201d as shown below.<\/p>\n<p><img decoding=\"async\" style=\"display: inline;\" alt=\"\" src=\"https:\/\/pipe2text.com\/wp-content\/plugins..\/..\/uploads\/media\/servermanagermodule\/image3.png\" \/><\/p>\n<p>Ok, now if you wanted to install the role of \u201cPrint Server\u201d. You can simply do this by using the \u201cInstall-WindowsFeature\u201d cmdlet (In PowerShell 2.0 use the \u201cAdd-WindowsFeature\u201d cmdlet) using the \u201cName\u201d field retrieved from the Get-WindowsFeature \u201c cmdlet . Type the following command:<\/p>\n<p>Install-WindowsFeature Print-Services<\/p>\n<p>Installation will start with a status as shown below.<\/p>\n<p><img decoding=\"async\" style=\"display: inline;\" alt=\"\" src=\"https:\/\/pipe2text.com\/wp-content\/plugins..\/..\/uploads\/media\/servermanagermodule\/image4.png\" \/><\/p>\n<p>Upon completion, you will see if the install was successful, whether a restart of the servers needed and the Feature Result as shown below.<\/p>\n<p><img decoding=\"async\" style=\"display: inline;\" alt=\"\" src=\"https:\/\/pipe2text.com\/wp-content\/plugins..\/..\/uploads\/media\/servermanagermodule\/image5.png\" \/><\/p>\n<p>Also, If you type Get-WindowsFeature *print* you can see it is now in an \u201cInstalled State\u201d as shown below.<\/p>\n<p><img decoding=\"async\" style=\"display: inline;\" alt=\"\" src=\"https:\/\/pipe2text.com\/wp-content\/plugins..\/..\/uploads\/media\/servermanagermodule\/image6.png\" \/><\/p>\n<p>Now if you would like to remove this role from the server you can use the \u201cUninstallWindowsFeature\u201d cmdlet (In PowerShell 2.0 use the \u201cRemove-WindowsFeature\u201d cmdlet). Type the following to remove the \u201cPrint Server\u201d role:<\/p>\n<p>Uninstall-WindowsFeature Print-Services<\/p>\n<p>\u201cPrinter Server\u201d Role is removed as shown below.<\/p>\n<p><img decoding=\"async\" style=\"display: inline;\" alt=\"\" src=\"https:\/\/pipe2text.com\/wp-content\/plugins..\/..\/uploads\/media\/servermanagermodule\/image7.png\" \/><\/p>\n<p>When in adding and removing Roles and Features, if a reboot is required you could add the \u201c-reboot\u201d parameter and if a reboot is required it will happen automatically (in the case of the print server role a reboot is not required so the \u2013reboot will be ignored).<\/p>\n<p>Install-WindowsFeature Print-Services \u2013restart<\/p>\n<p>I hope this helps. If you would like to see more of what these commands can do you can always check the help by using the Get-Help cmdlet. As always, if you have any questions or feedback, please leave a comment.<\/p>\n<p>Related Links:<\/p>\n<p><strong><a title=\"Getting Started with PowerShell 2.0\" href=\"https:\/\/pipe2text.com\/?page_id=71\">Getting Started With PowerShell 2.0<\/a><\/strong><\/p>\n<p><strong><a title=\"Recording the Commands and Output of a PowerShell Session to a text file in PowerShell 2.0\" href=\"https:\/\/pipe2text.com\/?page_id=622\">Recording the Commands and Output of a PowerShell Session to a text file in PowerShell 2.0<\/a><\/strong><\/p>\n<p><strong><a title=\"Using the Show-Command cmdlet in PowerShell 3.0\" href=\"https:\/\/pipe2text.com\/?page_id=1297\">Using the Show-Command cmdlet in PowerShell 3.0<\/a><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi All, Using the Server Manager Module in PowerShell is a quick and easy way to view or install roles and features on your server. It\u2019s much quicker than using the GUI and is also useful to know when doing &hellip; <a href=\"https:\/\/pipe2text.com\/?page_id=1366\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","footnotes":""},"class_list":["post-1366","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/pipe2text.com\/index.php?rest_route=\/wp\/v2\/pages\/1366","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pipe2text.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/pipe2text.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/pipe2text.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/pipe2text.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1366"}],"version-history":[{"count":9,"href":"https:\/\/pipe2text.com\/index.php?rest_route=\/wp\/v2\/pages\/1366\/revisions"}],"predecessor-version":[{"id":1375,"href":"https:\/\/pipe2text.com\/index.php?rest_route=\/wp\/v2\/pages\/1366\/revisions\/1375"}],"wp:attachment":[{"href":"https:\/\/pipe2text.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1366"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}