0 votes

Hello,

I'm attempting to automate a part of our user creation/modification process and I've created a script that works on the Adaxes server in PowerShell but when I try to use the command in the Adaxes PowerShell Script Editor I get error messages because it won't import the module.

Here's the powershell code that I'm using:

Import-Module ActiveDirectory
Import-Module Quest.AuthenticationServices

$NewUID = Get-ADUser -Filter {uidnumber -ne "$null"} -Properties uidnumber |
    sort uidnumber |
    select -last 1 -expand uidnumber
$NewUID++
Enable-QasUnixUser %username%
Set-QASUnixUser %username% -Gecos "%fullname%, %department%" -UidNumber $NewUID

When I originally ran this code I didn't have the Import-Module lines but I got an error stating that it didn't recognize Get-ADUser or any of the Quest commands. After I entered Import-Module ActiveDirectory I got this error:


Run Script

The 'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\ActiveDirectory\ActiveDirectory.psd1' module cannot be imported because its manifest contains one or more members that are not valid. The valid manifest members are ('ModuleToProcess', 'NestedModules', 'GUID', 'Author', 'CompanyName', 'Copyright', 'ModuleVersion', 'Description', 'PowerShellVersion', 'PowerShellHostName', 'PowerShellHostVersion', 'CLRVersion', 'DotNetFrameworkVersion', 'ProcessorArchitecture', 'RequiredModules', 'TypesToProcess', 'FormatsToProcess', 'ScriptsToProcess', 'PrivateData', 'RequiredAssemblies', 'ModuleList', 'FileList', 'FunctionsToExport', 'VariablesToExport', 'AliasesToExport', 'CmdletsToExport'). Remove the members that are not valid ('HelpInfoUri'), then try to import the module again.

Can you tell me if it's possible to run this command in Adaxes or if there's some modification that I need to make to get this working properly? The Quest Powershell commands are installed on the Adaxes server as well.

Thank you!

by (50 points)

1 Answer

0 votes
by (216k points)
selected by
Best answer

Hello,

The thing is that Adaxes uses PowerShell v.2.0, and the Active Directory module on the most resent Windows systems is designed for higher PowerShell versions. Currently, it is impossible to load such modules in Adaxes. As an alternative, you can use the Get-AdmUser cmdlet from Adaxes PowerShell module. It does approximately the same as the Get-ADUser cmdlet from the Active Directory module, but also allows to use Adaxes functionality.

Here's a script that does the same, but uses the Get-AdmUser cmdlet:

Import-Module Adaxes
Import-Module Quest.AuthenticationServices

$NewUID = Get-ADmUser -Filter {uidnumber -ne "$null"} -Properties uidnumber |
      sort uidnumber |
      select -last 1 -expand uidnumber
$NewUID++
Enable-QasUnixUser %username%
Set-QASUnixUser %username% -Gecos "%fullname%, %department%" -UidNumber $NewUID

To be able to use cmdlets from Adaxes PowerShell module, first, you need to install it on the computer where Adaxes service is installed. For information on how to do that, see the following SDK article: http://www.adaxes.com/sdk/?HowDoI.Insta ... odule.html.

0

That worked, thank you!

Related questions

0 votes
1 answer

We want to automate the provisioning of skype users with adaxes. Therefore we installed the Skype module onto the adaxer server. Then we tried to utilise some commands in a ... . How can the Skype module be integrated for Adaxes? Thank you for your help.

asked Apr 23, 2020 by PGstoehl (100 points)
0 votes
1 answer

I'm seeing this error when I run a user deprovision. It still executes the script but nobody likes errors! Run PowerShell Script 'DuoDeprovisionExport' For the user. The term ' ... running an export script in the first place for my Duo user info. ) Thanks.

asked Feb 19, 2020 by rainamaina (60 points)
0 votes
1 answer

I'm currently running a SQL SPROC from within powershell, getting a value, and attempting to assign that value to an AD attribute. Everything goes fine getting the value, but ... avoid calling PS from within PS to load the module and run the command. Thanks!

asked Feb 3, 2017 by gmadd13 (50 points)
0 votes
1 answer

For instance to execute a powershell script that enable MFA for all member in that group?

asked Jan 27, 2023 by samuel.anim-addo (20 points)
0 votes
1 answer

I'd like to properly debug PowerShell runspaces used in Adaxes. Is the PowerShell Debugger safe to use with Adaxes? It's use would allow PowerShell developers to ... to use everywhere PowerShell is available without causing time-outs, race conditions etc.?

asked Dec 13, 2022 by Viajaz (210 points)
3,548 questions
3,238 answers
8,232 comments
547,812 users