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 (215k 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
0 answers

So I need to export a list of all user's Line URI's to a CSV file. Running Adaxes 2021 Version 3.14.18804.0 (64 bit) and Teams Powershell 4.1.0 ... a Microsoft 365 account } finally { # Close the connection and release resources Disconnect-MicrosoftTeams }

asked Aug 4 by TheLexicon (180 points)
0 votes
1 answer

When running a PowerShell script as an action in a custom command, you can set the script to run as a different account and then use the RunAs property in the ... Is there another way to get the Adaxes service account's credentials from within the script?

asked Mar 31 by KelseaIT (320 points)
2,801 questions
2,535 answers
6,605 comments
61,643 users