Home>

An important improvement in windows serve 2008 r2 is the upgrade of powershell version to 2.0. win 2008 r2 includes a series of new server management interfaces,These are built on top of powershell 2.0. It adds 240 cmdlets command set, new powershell graphical user interface also adds development capabilities,This makes it easier for users to create their own command line.

windows powershell is a command line interface and scripting language designed for system management.Windows Powershell is built on the Microsoft .NET Framework and helps IT professionals to automatically control the Windows (R) operating system and manage applications running on Windows.

windows powershell commands (called cmdlets) allow managing computers in the enterprise from the command line.Through windows powershell provider,Data storage can be accessed as easily as file systems,Such as the registry and certificate stores.

In windows server 2008 r2, cmdlets that manage roles or functions are packaged in a provider's module,If you need to use Windows powershell 1.0 for parity,Encapsulated in the windows powershell management unit.Unlike gui,You can combine multiple modules and snap-ins in one windows powershell session,To simplify the management of multiple roles and functions.

Use Server Manager to install role or feature-based modules and snap-ins

After installing windows server 2008 r2, you can use the cmdlets associated with it. When the corresponding role or feature is installed through Server Manager,Install the cmdlets associated with the server roles or functions available in windows server 2008 r2 as part of a module or snap-in.

Launch a windows powershell session with all available windows powershell modules and snap-ins

After installing windows powershell, you must import a module or add a registered snap-in,Before you can use the cmdlet associated with the role or feature. Before importing a module or adding a snap-in to a windows powershell session,You will not be able to use or view help for cmdlets contained in specific modules or snap-ins for roles or features.

You can import multiple modules or snap-ins into a windows powershell session. To simplify management,You can automatically import all modules and add all registered snap-ins when you start a session.

To start a windows powershell session using all available windows powershell modules and snap-ins, follow these steps:

1. Click "Start", "All Programs", "Administrative Tools", and then click "Windows Powershell Module".

2. If the "User Account Control" dialog box appears, confirm that it shows what i want to do,Then click Yes.

get-module:List all modules that have been imported into a windows powershell session

After starting a windows powershell session,You may want to list all modules that have been imported into the session.For example, you might want to verify that a module has been imported into the session or look up the module name that is used as a parameter of the cmdlet.To list all imported modules,Type "get-module" at the windows powershell prompt and press enter.

get-pssnapin:List all snap-ins that have been added to a windows powershell session

To list all added snap-ins,Please type "get-pssnapin" at the windows powershell prompt and press enter.

get-command-module:List all cmdlets in a module or snap-in

After importing a module or adding a snap-in to the current windows powershell session,You can identify the management functions available to you by listing the cmdlets supported by the module or snap-in.You can use the get-command cmdlet to list cmdlets added to the current session from an imported module or registered snap-in. To list all cmdlets in the imported module, type "get-command-module modulename" at the windows powershell prompt and press enter. Where modulename refers to the name of the imported module.

get-command-module:List all cmdlets added to the registered snap-ins added to the current windows powershell session

To list all cmdlets added to the registered snap-ins added to the current windows powershell session, type "get-command-module snap-inname" at the indows powershell prompt and press enter.

Among them, snap-inname refers to the name of the registered snap-in added to the current session.For example, if you use the server manager to install the windows server backup function windows server backup and "command line tools", and you have added the windows.serverbackup snap-in to a windows powershell session, to list the windows.serverbackup snap-in For all cmdlets, type "get-command –module windows.serverbackup" at the indows powershell prompt and press enter.

get-help * ad *:cmdlet help topics listing the roles or features included in the imported module

Help topics for cmdlets that support roles or features can be listed by applying the wildcard * and noun prefixes.These commands can be used to display help for all cmdlets implemented for a specific role or function of windows server 2008 r2.

For example, the Active Directory Domain Services cmdlet uses "ad" as a noun prefix in the cmdlet name.

To list all the help topics for the active directory domain service after importing the activedirectory module,Type "get-help * ad *" at the windows powershell prompt and press enter.

get-module --listavailable:List all installed modules that can be imported into a windows powershell session

Before importing the module into a windows powershell session,You will need to know the name of the module.To list all installed modules,Type "get-module –listavailable" at the windows powershell prompt and press enter.

get-pssnapin -registered:List all registered snap-ins that can be added to a windows powershell session

Before adding a registered snap-in to a windows powershell session,You will need to know the name of the snap-in.To list all registered snap-ins,Please type "get-pssnapin –registered" at the windows powershell prompt and press enter.

import-module:import a single module into a windows powershell session

Sometimes you may want to import a module into an existing windows powershell session. For example, if you install a role or feature after starting a windows powershell session,Before importing the module into a started session,Modules associated with newly installed roles or features will not be available.To import a single module,Type "import-module modulename" at the windows powershell prompt and press enter.

Where modulename is the name of the available module.For example, if you installed the active directory domain service role,To import the activedirectory module into a windows powershell session, type "import-module activedirectory" at the windows powershell prompt and press enter.

add-pssnapin:add a registered snap-in to a windows powershell session

Roles or features can install and register windows powershell snap-ins,Instead of modules,In order to maintain compatibility with cmdlets implemented for previous versions of windows powershell.If the cmdlet i want to use is already implemented in a snap-in,You will need to add this snap-in to make the cmdlet available for the current session.To add a registered snap-in to the current windows powershell session,Type "add-pssnapin snap-inname" at the windows powershell prompt and press enter.

Where snap-inname refers to the name of the snap-in that is installed and registered.For example, if you use the server manager to install the windows server backup function:windows server backup and "command line tools", you can type "add-pssnapin windows.serverbackup" at the windows powershell prompt, and then press enter to move windows. The serverbackup snap-in is added to a windows powershell session.

  • Previous Jsp + jdbc method for connecting to a database
  • Next C ++ dynamically allocate and deallocate memory and structure types as function parameters