programming4us
programming4us
DESKTOP

Windows Server 2008 R2 Powershell Cmdlets (part 5) - Server Manager cmdlets

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

5. Server Manager cmdlets

The Server Manager cmdlets are there to help the administrator with any action the Server Manager would normally allow them to perform (see Table 16).

Table 16. Server Manager cmdlets
cmdlet NameDescription
Add-WindowsFeatureThis cmdlet is used to install features
Get-WindowsFeatureThis cmdlet is used to get the list of features available. The installed features will show an [X] by them and the ones that are not installed will show []
Remove-WindowsFeatureThis cmdlet is used to remove an installed feature

With the PowerShell Server Manager cmdlets, you can add, check, and remove roles, roles services, and features from servers in your environment. Before you can have access to these cmdlets, you have to import the Server Manager module via the import-module cmdlet. Follow these steps to import the Server Manager Module:

1.
Startup PowerShell

2.
Type import-module ServerManager

3.
Once the cmdlet completes, you can check that you have access to the Server Manager cmdlets by typing get-help *windowsfeature*. Remember that the * are the wildcards and this will return all cmdlets with windowsfeature anywhere in them. A list of three cmdlets should then be listed for you as shown (see Figure 18), which will include Add-WindowsFeature, Get-WindowsFeature, and Remove-WindowsFeature.

Figure 18. The Server Manager cmdlets.

These cmdlets are very straightforward in their use and purpose as can be determined by their names. Add-WindowsFeature is the one the administrator will be using to add the roles, role services, and features; Get-Wind-owsFeature is the one that will be used to get the information about them, and Remove-WindowsFeature to remove them directly. The syntax is just as straightforward. Assume that you wanted to install the telnet client on your server. Instead of starting up Server Manager and using the wizard, you can do it directly with PowerShell. The first thing you need is the name of the feature you want to install. Sometimes, you will not know the exact name that Server Manager uses and will need to look it up. This is done with the Get-WindowsFeature cmdlet. Typing Get-WindowsFeature at the prompt will return a list with all the potential features with a column showing their display name in Server Manager and a column showing their name. The Display name column will also have an [X] next to any feature already installed. This way if you need to, you can check to see if the feature you want is already installed. The name column is what will be needed for the cmdlet to run properly. In this case, the name of the telnet client is telnet-client. Looking at the Display name column, you will see that it is not installed by default (see Figure 19). With this name, you can now call the Add-WindowsFeature cmdlet by typing Add WindowsFeature telnet-client and then hitting enter. You will then get the prompt back. Now, you try the Get-WindowsFeature cmdlet again. You can type it without an argument like you did the first time, or you can specify that you want to see the telnet client feature specifically by giving it the name and typing Get-WindowsFeature telnet-client. You will now be able to see that the telnet client has an [X] before it, showing that it has been installed (see Figure 20).

Figure 19. Telnet-Client is not installed.

Figure 20. Telnet-Client is installed.

The Remove-WindowsFeature cmdlet is the cmdlet you will be using to remove modules, as the name implies. Following the previous example, let us say you now want to remove the telnet client. Since you already know the name of the feature you want to remove, you do not need to look it up, but if you do not know the name, you could just look it up with Get WindowsFeature as described earlier. The next step is to issue the cmdlet by typing Remove-WindowsFeature telnet-client and hit enter. PowerShell will process the cmdlet and then return a summary describing if the removal was successful, if a restart is needed, and a reminder of what feature was removed (see Figure 21).

Figure 21. Removing Telnet-Client cmdlet results.

So, the question is, when would you use these features? Imagine you are the lucky administrator tasked with building up a Web server farm consisting of 15 new servers which all require IIS to be installed. Instead of trudging your way through each server one at a time and utilizing the Server Manager GUI to perform the installs, you would instead be able to create and utilize a repeatable PowerShell cmdlet or a sequence of cmdlets. Even if you decided to log on to each server and execute the cmdlets instead of utilizing the GUI, you would save a hefty amount of time in performing the installations. Now, add to this the equation the fact that you can use PowerShell’s new remoting features or even just write it once and have it available on the network, and you can see the reason why you would use it.

Other  
  •  Windows Server 2008 R2 : PowerShell V2 feature focus - Installing Powershell, Introduction to Powershell Scripting
  •  Windows Server 2008 R2 : PowerShell V2 feature focus - Introduction to Powershell
  •  Installing Windows 8 on startup VHD files (part 3) - Starting the system from the VHD, Removing VHD installations
  •  Installing Windows 8 on startup VHD files (part 2) - Creating the VHD during the installation by using DiskPart
  •  Installing Windows 8 on startup VHD files (part 1) - Creating a VHD from an existing installation
  •  Windows 8 : Upgrading or migrating from a previous version of Windows (part 4) - Migrating user data
  •  Windows 8 : Upgrading or migrating from a previous version of Windows (part 3) - Using an external hard disk or USB flash drive, Using the User State Migration Tool
  •  Windows 8 : Upgrading or migrating from a previous version of Windows (part 2) - Using removable media, Using a network connection
  •  Windows 8 : Upgrading or migrating from a previous version of Windows (part 1) - Running the Setup Wizard , Configuring your account
  •  Installing Windows 8 on a new or formatted system (part 3) - Installing Windows 8 with Windows To Go
  •  
    Top 10
    Free Mobile And Desktop Apps For Accessing Restricted Websites
    MASERATI QUATTROPORTE; DIESEL : Lure of Italian limos
    TOYOTA CAMRY 2; 2.5 : Camry now more comely
    KIA SORENTO 2.2CRDi : Fuel-sipping slugger
    How To Setup, Password Protect & Encrypt Wireless Internet Connection
    Emulate And Run iPad Apps On Windows, Mac OS X & Linux With iPadian
    Backup & Restore Game Progress From Any Game With SaveGameProgress
    Generate A Facebook Timeline Cover Using A Free App
    New App for Women ‘Remix’ Offers Fashion Advice & Style Tips
    SG50 Ferrari F12berlinetta : Prancing Horse for Lion City's 50th
    - Messages forwarded by Outlook rule go nowhere
    - Create and Deploy Windows 7 Image
    - How do I check to see if my exchange 2003 is an open relay? (not using a open relay tester tool online, but on the console)
    - Creating and using an unencrypted cookie in ASP.NET
    - Directories
    - Poor Performance on Sharepoint 2010 Server
    - SBS 2008 ~ The e-mail alias already exists...
    - Public to Private IP - DNS Changes
    - Send Email from Winform application
    - How to create a .mdb file from ms sql server database.......
    programming4us programming4us
    programming4us
     
     
    programming4us