How to add Powershell – Active Directory module in Windows PE

Sometimes you might want to use the Active Directory module in WinPE.

(I will post one great way to use it later)

First you need to enable powershell support in your bootimage:

If you don’t have the AD-module on your computer install RSAT.

Mount the WIM and copy the following directories to your bootimage:


%windir%\System32\WindowsPowerShell\v1.0\Modules\ActiveDirectory

%windir%\SysWOW64\WindowsPowerShell\v1.0\Modules\ActiveDirectory (x64-image only)

%windir%\Microsoft.NET\assembly\GAC_32\Microsoft.ActiveDirectory.Management

%windir%\Microsoft.NET\assembly\GAC_32\Microsoft.ActiveDirectory.Management.Resources

%windir%\Microsoft.NET\assembly\GAC_64\Microsoft.ActiveDirectory.Management (x64-image Only)

%windir%\Microsoft.NET\assembly\GAC_64\Microsoft.ActiveDirectory.Management.Resources (x64-image Only)

%windir%\WinSxS\amd64_microsoft.activedir..anagement.resources_31bf3856ad364e35_6.3.9431.0_en-us_fb186ae865900ae8 (x64-image Only)

%windir%\WinSxS\x86_microsoft.activedirectory.management_31bf3856ad364e35_6.3.9431.0_none_b85eb2e785c286ef

%windir%\WinSxS\msil_microsoft-windows-d..ivecenter.resources_31bf3856ad364e35_6.3.9431.0_en-us_38f21d039944539f


To be able to create folders in the WinSxS folder you need to take ownership of the WinSxS-folder and add rights to your user!

When it starts to ask you about all the folders inside, just press “Cancel”.

(only tested on PE4 and PE5)

I copied these files onto a Win 8(.0) Machine that does not have RSAT to try:

As you can see, I do not have RSAT:

Importing the module:

There you go!

You can now use the Active Directory module in PE-powershell!

I have collected all the files here: Files

You can extract these and paste all the folders in to %windir% (you must edit the rights for WinSxS first!)

Comments

  1. Hi,

    First, thanks for your tutorial. There is very few informations about winpe and activedirectory on the web, so I’m glad to have found your post.

    I got an error in WinPe when I try to execute import-module ActiveDirectory -verbose
    It says:
    .

    Something strange..

    First, it load AcitveDirectory.psd1
    then, it load the Assembly

    Load ‘Assembly’ from path X:Windowssystem32WindowsPowershellv1.0ModulesActiveDirectoryMicrosoft.ActiveDirectory.management’.

    then it switch to Loading ‘TypesToProcess’
    and finally it got this message:

    Loading ‘FormatsToProcess’
    X:Windowssystem32WindowsPowershellv1.0ModulesActiveDirectoryAcitveDirectory.Format.ps1xml

    Import-module: The ‘assembly ‘Microsoft.ActiveDirectory.Management’ was not loaded because no assembly with that name was found..
    Verify the assembly name and then try again ..

    Very strange because it seems to load it just before.
    Thanks for your help,
    Alex.

  2. It WORKS !!! I Simply forgot to copy the files to the WinSXS directory. You need to verify if the files are really there! This was my mistakes!

    MDT WinPe 5.0 Litetouch X86 now have PowerShell ActiveDirectory module.
    Big big thanks my friend!
    Alex.

  3. Hi there, I would like to subscribe for this
    website to get most up-to-date updates, so where can i do it please help.

  4. Are these files still available for download. I have been trying desperately to make this work (windows 10) and something always seems to be missing. Please help me out.

    1. Hi Blake
      What version of WinPE do you use?
      Could you please explain what kind of errors you see?
      The files were lost during migration to new blog.
      I have updated the files on the post.

      //Christoffer

Leave a Reply

Your email address will not be published. Required fields are marked *