Search Wiki:

About the Client Manager Module

PowerShell module to Add/Remove Windows 7 features

The module can be installed automatically by downloading the MSI package or manually by downloading a ZIP file.
The MSI package will install the module under your Documents folder (%USERPROFILE%\Documents\WindowsPowerShell\Modules\RemoteRegistry).
The ZIP file contains the module files only and you need to extract its content to one of two places:

  1. %USERPROFILE%\Documents\WindowsPowerShell\Modules
  2. %WINDIR%\System32\WindowsPowerShell\v1.0\Modules (need admin privileges)
  3. If the directory tree (of one of the above) doesn't exist then you should manually create it.


Prerequisites

Windows PowerShell 2.0 http://support.microsoft.com/kb/968929



How to use the module


Check if the module is installed correctly, from your PowerShell session type:

PS > Get-Module -Name PSClientManager -ListAvailable
 
ModuleType Name                      ExportedCommands
---------- ----                      ----------------
Manifest   PSClientManager           {}

If you don't see the above result then the module was not installed correctly. If you choose to download and install the module manually (zip file), make sure the module directory exists under "%USERPROFILE%\Documents\WindowsPowerShell\Modules"


Importing the module:
PS > Import-Module PSClientManager

NOTE An elavated PowerShell session is needed to load the module. If the session is not elevated a warning message is written to the console
and you wont be able to use any of the module’s functions.

PS > Get-Command -Module PSClientManager
 
CommandType Name                  Definition
----------- ----                  ----------
Function    Add-ClientFeature     ...
Function    Get-ClientFeature     ...
Function    Get-ClientFeatureInfo ...
Function    Remove-ClientFeature  ...


Code Examples


To get a quick look at all the the available features on your system, run the Get-ClientFeature without any parameters. One of the first features a system administrator would want to install is Telnet. Lets see how we can find and install it. We will run the Get-ClientFeature command and use a wildcard pattern for the feature name parameter.

PS > Get-ClientFeature –Name *telnet* | Format-Table -AutoSize
 
Name         State
----         ------
TelnetServer Disabled
TelnetClient Disabled 
 
The result shows that there are two Telnet features, Client and Server, and both are disabled. Lets get some more information about the client feature:
 
PS > Get-ClientFeatureInfo –Name TelnetClient
 
Name            : TelnetClient
DisplayName     : Telnet Client
RestartRequired : Possible
Properties      :
Description     : Connect to remote computers by using the Telnet protocol
State           : Disabled 

Now let’s enable it. Adding or removing features changes the system so the command asks for confirmation. To suppress confirmations use the –Force parameter or ‘-Confirm:$false’:

PS > Add-ClientFeature –Name TelnetClient
 
Confirm
Are you sure you want to perform this action?
Performing operation "Enable Feature 'TelnetClient'" on Target "PC1".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): y
 
Deployment Image Servicing and Management tool
Version: 6.1.7600.16385
 
Image Version: 6.1.7600.16385
 
Enabling feature(s)
{"[==========================100.0%==========================]"}
The operation completed successfully. 
 

We can verify that the Telnet has been enabled by running the Get-ClientFeatureInfo or Get-ClientFeature.

PS > Get-ClientFeatureInfo –Name TelnetClient
 
Name            : TelnetClient
DisplayName     : Telnet Client
RestartRequired : Possible
Properties      :
Description     : Connect to remote computers by using the Telnet protocol
State           : Enabled
 
 
PS > Get-ClientFeature Telnet* | Format-Table -AutoSize
 
Name         State
----         ------
TelnetServer Disabled
TelnetClient Enabled 
 

The functions can also pipe feature object(s) from one command to another. For example, the following command enables the Telnet client and server features on the current system (check help for a complete list of command parameters and code examples):

PS > Get-ClientFeature tel* | Add-ClientFeature 



Gotcha


Feature names are case sensitive! Make sure you write them with the proper case.
Last edited Oct 28 2010 at 4:43 PM  by ShayLevy, version 13
Updating...
Page view tracker