/bundles/itninjaweb/img/Breadcrumb_cap_w.png
I'm trying to run a post install PowerShell script during a Scripted Installation that moves a system to a specific OU.  The script calls "Import-Module Activedirectory" and it looks like I'm getting an error saying the module is not available.  Are the ActiveDirectory modules available during the deploy?  My script runs after a 2nd reboot and the KACE menu comes up the script looks like it runs but it evidently does not complete.  When run manually it says the ActiveDirectory module cannot be found.

Ken-
0 Comments   [ - ] Hide Comments

Comments

Please log in to comment

Answer this question or Comment on this question for clarity

Answers

0
Check this for how to install the modules: https://4sysops.com/wiki/how-to-install-the-powershell-active-directory-module/

This may also help from a scripting perspective: https://blogs.technet.microsoft.com/ashleymcglone/2016/02/26/install-the-active-directory-powershell-module-on-windows-10/

And in your PowerShell code you can check if the module exists like so:

if (Get-Module -ListAvailable -Name ActiveDirectory) {
It's also worth noting that you can move AD objects like computers without the ActiveDirectory module (albeit it it's not as nice...) - see the second post here:

https://social.technet.microsoft.com/Forums/lync/en-US/37ab13a4-4ddb-460a-8a6a-0eac5887e0c0/using-adsi-and-ldap-to-move-to-an-ou?forum=ITCG
Answered 05/23/2018 by: captain_planet
Black Belt

Please log in to comment