User onboarding across various domains

Good day,

I have a dashboard for to create a new user in AD. The problem is that it needs to be able to create users across various domains. It works perfectly fine on the domain where Universal Dashboard is installed but whenever I try to create a user on another domain I get a “The method or operation is not implemented” error.

I am not sure what I am doing wrong. It would be highly appreciated if anyone can assist. Below is the code that I am using.

Thanks in advance.

$testdomain = “Remote”

$Dashboard = New-UDDashboard -Title “Create new user” -Content {
New-UDInput -Title “Create new user” -Endpoint {
param(
[Parameter(Mandatory)]
[string]$FirstName,
[Parameter(Mandatory)]
[string]$LastName,
[Parameter(Mandatory)]
[string]$UserName,
[Parameter(Mandatory)]
[ValidateSet(“IT”, “HR”, “Accounting”, “Development”)]
[string]$Group,
[Parameter(Mandatory)]
[ValidateSet(“Local”,“Remote”)]
[string]$Domain

    )

    add-type -AssemblyName System.Web
    $password = [System.Web.Security.Membership]::GeneratePassword((Get-Random -Minimum 20 -Maximum 32), 3)
    $securePassword = ConvertTo-SecureString -String $password -AsPlainText -Force

    $NewAdUserParameters = @{
        GivenName = $FirstName
        Surname = $LastName 
        Name = $UserName 
        AccountPassword = $securePassword
    }

if ($Domain -eq “Remote”)
{

$username = “domain1.test\administrator”
$password = cat C:\test\password.txt | convertto-securestring -AsPlainText -Force
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
New-PSSession -ComputerName node01 -Credential $cred -Authentication Negotiate
#Enter-PSSession -ComputerName node01 -Credential $cred -Authentication Negotiate
Invoke-Command -ScriptBlock  {New-AdUser @NewAdUserParameters}
   
}
    
        

    New-UDInputAction -Content {
        New-UDCard -Title "Temporary Password" -Text $Password
    }
} -Validate

}

Start-UDDashboard -Dashboard $Dashboard -Port 10000 -Name “Create New User”

Hi @leon and welcome to the Ironman forums!

Are you by any chance running your dashboard in IIS?

If so, you need to configure your application pool to load userprofile.
Without this any remote-powershell execution will fail.