Review How do I reinstall Active Directory?

Thủ Thuật về How do I reinstall Active Directory? Chi Tiết

Lê Hữu Kông đang tìm kiếm từ khóa How do I reinstall Active Directory? được Cập Nhật vào lúc : 2022-10-29 22:24:02 . Với phương châm chia sẻ Thủ Thuật Hướng dẫn trong nội dung bài viết một cách Chi Tiết Mới Nhất. Nếu sau khi Read tài liệu vẫn ko hiểu thì hoàn toàn có thể lại phản hồi ở cuối bài để Ad lý giải và hướng dẫn lại nha.

This guide has been updated for the latest Windows versions Windows 11 and Windows Server 2022. You'll learn how to install the Active Directory (AD) module for PowerShell Core 6.0, PowerShell 7 and Windows PowerShell. For Windows PowerShell, the tutorial describes how to install the AD module for Windows 7, Windows 8, Windows 8.1, Windows 10, Windows 11 Windows Server 2008 R2, Windows Server 2012 R2, and Windows Server 2022, Windows Server 2010 and Windows Server 2022. You'll also learn how to work with the AD module on other systems such as macOS or Linux with the help of PowerShell remoting.

Nội dung chính Show
    Windows 7 ^Windows Server 2008 R2 ^Windows 8, Windows 8.1 ^Windows 10 ^Windows 11 ^On Windows 11 with PowerShell ^Windows Server 2012, Windows Server 2012 R2, Windows Server 2022, Windows Server 2022, Windows Server 2022 ^Install the AD module on PowerShell Core 6.x on a Windows computer ^Use the Active Directory module on Linux and macOS ^All versions: Import the ActiveDirectory module remotely ^Create an interactive remote sessionImport the AD module from a remote sessionExport the remote AD module to a local modulePowerShell Core and Windows PowerShell modules ^Conclusion ^How do I restore Active Directory?How do I reinstall Active Directory Users and Computers?How do I manually Install Active Directory?How do I fix corrupted Active Directory?

    AuthorRecent Posts

How do I reinstall Active Directory?

Michael Pietroforte is the founder and editor in chief of 4sysops. He has more than 35 years of experience in IT management and system administration.

How do I reinstall Active Directory?

Contents

Windows 7Windows Server 2008 R2Windows 8, Windows 8.1Windows 10Windows 11On Windows 11 with PowerShellWindows Server 2012, Windows Server 2012 R2, Windows Server 2022, Windows Server 2022, Windows Server 2022Install the AD module on PowerShell Core 6.x on a Windows computerUse the Active Directory module on Linux and macOSAll versions: Import the ActiveDirectory module remotelyPowerShell Core and Windows PowerShell modulesConclusion

Also read: How to install the PowerShell 7 Active Directory module.

The installation of the AD module varies significantly for the different Windows and PowerShell versions. At the time of this writing, the AD module that comes with RAST does not work with PowerShell Core 6.0. However, this guide explains how you can manage Active Directory from PowerShell Core even on macOS and Linux.

Windows 7 ^

On a Windows 7 computer, you can follow this procedure to install the Active Directory module:

Download the Remote Server Administration Tools (RSAT) for Windows 7.Open the Control Panel, start typing features, and then click Turn Windows features on or off.Scroll down to Remote Server Administration Tools and enable the Active Directory Module for Windows PowerShell in Remote Server Administration Tools > Role Administration Tools > AD DS and AD LDS Tools.Run Import-Module ActiveDirectory on a PowerShell console.

How do I reinstall Active Directory?

Active Directory Module for Windows PowerShell on Windows 7

If the Windows 7 machine only has PowerShell 2.0 installed, you have to add the Import-Module ActiveDirectory command to your profile because PowerShell doesn't load modules automatically. For instance, you can import the module in %UserProfile%My DocumentsWindowsPowerShellprofile.ps1. Makes sure you've set your execution policy to either RemoteSigned or Unrestricted: Set-ExecutionPolicy RemoteSigned.

Another option is to open the module from the Administrative Tools thư mục in the Control Panel.

How do I reinstall Active Directory?

Active Directory Module in Administrative Tools

Windows Server 2008 R2 ^

If your Windows Server 2008 R2 machine is a domain controller, the PowerShell Active Directory Module is already installed. You only have to install the module on thành viên servers. The procedure on Windows Server 2008 R2 is similar to that on Windows 7. (Note that the module is not available for Windows Server 2008.)

One difference is that you don't have to tải về RSAT because the tools are already available on Windows Server 2008 R2.

In Server Manager, click Add features, and then:Select Active Directory module for Windows PowerShell in Remote Server Administration Tools > Role Administration Tools > AD DS and AD LDS Tools.

Alternatively, you can install the module from a PowerShell console:

Import-Module ServerManagerAdd-WindowsFeature RSAT-AD-PowerShell

After copying the module to your computer, you have to import it:

Import-Module ActiveDirectory

Or you can right-click the PowerShell icon on the taskbar and select Import system modules.

How do I reinstall Active Directory?

Import system modules

As on Windows 7, if you want to make the import permanent, you have to add the above import command to your PowerShell profile. Notice this description assumes you haven't updated PowerShell 2 on your Windows Server 2008 R2 machine (see the description about Windows 7).

Windows 8, Windows 8.1 ^

Things are a lot easier in Windows 8, Windows 8.1, and Windows 10. All you have to do is tải về and install RSAT (Windows 8, Windows 8.1, Windows 10). The installation enables all tools by default, and you also don't have to import the module. You can use the AD module right away after you install RSAT.

Windows 10 ^

Since Windows 10, the RSAT tools were shifted from being a standalone package to being a feature on demand in Windows 10. Click the menu and then search for "features" and then navigate to App and Features > Optional Features > Add a feature. Type RSAT in the search field and select the second option—RSAT: Active Directory Domain Services and Lightweight Directory Services Tools.

How do I reinstall Active Directory?

Install the AD module in Windows 10

Windows 11 ^

In Windows 11, click the Start, type "Settings" in the Search field.

How do I reinstall Active Directory?

Apps in Windows 11

Now click Apps > Optional Features > View features.

How do I reinstall Active Directory?

Optinal Features in Windows 11

How do I reinstall Active Directory?

Add an optional feature in Windows 11

Then type "RSAT" and select RSAT: Active Directory Domain Services and Lightweight Directory Services Tools and click Next and then Install.

How do I reinstall Active Directory?

Install RSAT on Windows 11

To verify that RSAT has been installed launch a PowerShell console with Administrator privileges and then type this command:

Get-WindowsCapability -Name RSAT* -Online | Select-Object -Property DisplayName, State

How do I reinstall Active Directory?

Verfiying that RSAT is installed with PowerShell

On Windows 11 with PowerShell ^

If you don't want to avoid all this clicking you can install all the RSAT tools in one go with this PowerShell command below. Make sure that you are working on an elevated PowerShell console.

Get-WindowsCapability -Name RSAT* -Online | Add-WindowsCapability -Online

How do I reinstall Active Directory?

Intstall RSAT with PowerShell

Windows Server 2012, Windows Server 2012 R2, Windows Server 2022, Windows Server 2022, Windows Server 2022 ^

As on Windows Server 2008 R2, the AD module is already installed on domain controllers on Windows Server 2012, Windows Server 2012 R2, and Windows Server 2022. On thành viên servers, you can add the module as a feature in Server Manager.

Start Server Manager.Click Manage > Add Roles and Features.Click Next until you reach Features.Enable Active Directory module for Windows PowerShell in Remote Server Administration Tools > Role Administration Tools > AD DS and AD LDS Tools.

How do I reinstall Active Directory?

Install the AD module on Windows Server 2022

Alternatively, you can install the module from a PowerShell console:

Install-WindowsFeature RSAT-AD-PowerShell

How do I reinstall Active Directory?

Installing the AD module on Windows Server 2012 with PowerShell

There's no need to import the Server Manager module first, as on Windows Server 2008 R2. You also don't have to import the AD module after the installation.

If you want to verify the successful installation of the module, you can just run the Get-ADuser cmdlet.

Install the AD module on PowerShell Core 6.x on a Windows computer ^

Install RSAT with the method matching to your operating system (see sections above).Install the WindowsCompatibility module.Install-Module -Name WindowsCompatibilityLoad the WindowsCompatibility module like usual with the Import-Module cmdletImport-Module -Name WindowsCompatibilityLoad the ActiveDirectory module with the Import-WinModule cmdletImport-WinModule -Name ActiveDirectory

Use the Active Directory module on Linux and macOS ^

On Linux and macOS you can't install Active Directory module. However, you use PowerShell remoting to connect to a Windows server with Active Directory and then work with the AD module in remoting session. Read ahead to learn how to use remoting with the AD module.

All versions: Import the ActiveDirectory module remotely ^

Create an interactive remote session

The simplest option is to create an interactive remote session to your domain controller with the Enter-PSsession cmdlet:

Enter-PSsession MyDomainConroller

You can then work right away with the AD cmdlets. This option is good if you only occasionally manage AD on a PowerShell console and if you don't have to execute local scripts.

How do I reinstall Active Directory?

Managing Active Directory on PowerShell Core in an interactive remote session

Import the AD module from a remote session

The second option uses implicit remoting and allows you to run the AD cmdlets from a local session. However, you execute the AD cmdlets remotely on a domain controller. In practice, you won't notice much of difference in locally installed cmdlets. To import the AD module on PowerShell Core 6.0, execute these commands:

$S = New-PSSession -ComputerName MyDomainConroller Import-Module -PSsession $S -Name ActiveDirectory

How do I reinstall Active Directory?

Import the AD module on PowerShell Core 6.0

The first command creates a PowerShell session (PSsession) on the domain controller (replace MyDomainController with the name of your DC) and establishes a persistent connection. Next, we import the ActiveDirectory module from this remote PSsession into our local session.

You can now use all AD module cmdlets on your local PowerShell Core console. Just keep in mind the commands always execute remotely.

If you often work with AD, you can add the above commands to your profile, for instance in DocumentsPowerShellProfile.ps1.

Export the remote AD module to a local module

Alternatively, you can export the AD cmdlets from a remote session to a local module:

$S = New-PSSession -ComputerName MyDomainController Export-PSsession -Session $S -Module ActiveDirectory -OutputModule RemoteAD Remove-PSSession -Session $S Import-Module RemoteAD

How do I reinstall Active Directory?

Exporting the Active Directory module to a local module

These commands will create a local module in your Documents thư mục under PowerShellModulesRemoteAD. However, like with the above solution, you will be working with implicit remoting, and all cmdlets will execute remotely. The local RemoteAD module only links to the cmdlets on the domain controller. If you want to use the RemoteAD module on other machines with PowerShell Core, simply copy the RemoteAD thư mục to the PowerShell Core module thư mục on the second machine.

The difference with the "import solution" is that in the "export solution," PowerShell only establishes a connection to the domain controller when you use an AD cmdlet the first time. You also don't have to add the above commands to your profile because PowerShell will load the local RemoteAD module automatically. However, the downside to this option is you might have to repeat the procedure after updating the AD module on the domain controller.

PowerShell Core and Windows PowerShell modules ^

Note that you can use Windows PowerShell together with PowerShell Core on the same machine and work with the different AD modules in both shells. If you installed RSAT, the AD module for Windows PowerShell will reside in this thư mục:

$env:windir/System32/WindowsPowerShell/v1.0/Modules/ActiveDirectory

If you used the export solution, the RemoteAD module will be in this thư mục:

$env:userprofile/Documents/PowerShell/Modules/RemoteAD

How do I reinstall Active Directory?

PowerShell Core and Windows PowerShell use different folders

PowerShell Core does not import modules in WindowsPowerShell folders, and Windows PowerShell does not load PowerShell Core modules, which are always in PowerShell folders. Thus, you don't have to worry about conflicts between the different AD modules in PowerShell Core and Windows PowerShell.

Conclusion ^

Using the Active Directory module has become simpler with each PowerShell version up to Microsoft's release of PowerShell Core 6.0. However, working with implicit remoting and remote sessions has various advantages. One advantage is that you can use disconnected remote sessions. This allows you to start a script, shut down your client computer, and retrieve the results from the remote machine later. If you often work with remote sessions, you should become familiar with the different ways you can use PowerShell remote sessions. Once you get used to working with remoting, you probably won't miss the local AD module for PowerShell Core.

How do I restore Active Directory?

1. Boot into Directory Services Restore Mode (DSRM) and perform a System State restore to restore the Active Directory (AD) database. 2. Perform a metadata cleanup of the server exhibiting the error on another domain controller (DC) if there are other domain controllers in the environment.

How do I reinstall Active Directory Users and Computers?

To install Active Directory Users and Computers go to your PC settings>Apps>Optional features>Add feature and look for RSAT: Active Directory Domain Services and Lightweight Directory services tools. Click Install and this feature will be downloaded.

How do I manually Install Active Directory?

Installing Active Directory Users and Computers for Windows 1809 and higher. Go to Start, select Settings, and then Apps.. Click on Manage Optional Features.. In the new window, click on Add feature.. Select RSAT: Active Directory Domain Services and Lightweight Directory Tools, and then click Install..

How do I fix corrupted Active Directory?

Solution:. Restart the DC in Directory Services Restore Mode (DSRM). ... . From the Windows Start button select Run and type 'cmd' to open a command prompt. ... . Next, type 'NTDSUTIL' and press Enter. ... . At the file maintenance: prompt type 'Recover' and press Enter.. Tải thêm tài liệu liên quan đến nội dung bài viết How do I reinstall Active Directory? RSAT Remote rsat

Video How do I reinstall Active Directory? ?

Bạn vừa đọc nội dung bài viết Với Một số hướng dẫn một cách rõ ràng hơn về Video How do I reinstall Active Directory? tiên tiến nhất

Chia Sẻ Link Tải How do I reinstall Active Directory? miễn phí

Heros đang tìm một số trong những ShareLink Download How do I reinstall Active Directory? miễn phí.

Hỏi đáp thắc mắc về How do I reinstall Active Directory?

Nếu sau khi đọc nội dung bài viết How do I reinstall Active Directory? vẫn chưa hiểu thì hoàn toàn có thể lại Comment ở cuối bài để Mình lý giải và hướng dẫn lại nha #reinstall #Active #Directory