/build/static/layout/Breadcrumb_cap_w.png

Scripted Install PowerShell AD move

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   [ + ] Show comments

Answers (3)

Posted by: agalloway 3 years ago
White Belt
0

I am having also this issue. How do I use a PowerShell script built using the Windows Active Directory module as an Active Roles Server Script Module? I am trying this I am getting an error that "GEt-ADGroupMember" is not recognized. I think this is because it does not recognize the cmdlet without the ActiveDirectory module.

Posted by: agalloway 3 years ago
White Belt
0

I am having also this issue. How do I use a PowerShell script built using the Windows Active Directory module as an Active Roles Server Script Module? I am trying this I am getting an error that "GEt-ADGroupMember" is not recognized. I think this is because it does not recognize the cmdlet without the ActiveDirectory module.

Posted by: captain_planet 6 years ago
Black Belt
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
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ