Create New User in AD using -instance and setting msRTCSIP-PrimaryUserAddress

Welcome Forums General PowerShell Q&A Create New User in AD using -instance and setting msRTCSIP-PrimaryUserAddress

This topic contains 2 replies, has 2 voices, and was last updated by

3 years, 7 months ago.

  • Author
  • #28045

    Points: 0
    Rank: Member

    Hey Guys,
    I am new to powershell but have consulted the help docs and a few forums but i am very stuck with this.
    The below script lets me set the $userinstance variable for the -instance syntax and then i have prompts for some other fields i would like overwritten. the outcome is the account is created but only with the variables that i've set, there is no department, groupings etc. set

    I am then trying to set the msRTCSIP-PrimaryUserAddress so it wil work with lync online but it fails with "'set-QADObject : The term 'set-QADObject' is not recognized as the name of a cmdlet, function, script file, or operable program.'"
    am i meant to load a new cmdlet for QADobject to work?

    $userInstance = Get-ADuser -Identity (Read-Host "Target Username")
    $firstname = Read-Host "First Name"
    $Lastname = Read-Host "Last Name"
    $Username = Read-Host "username"
    $NewName = "$lastname, $firstname "
    $NewUser = "$firstname.$"
    New-ADUser -Name $NewName -Instance $userInstance -SamAccountName $Username -GivenName $firstname -Surname $lastname -UserPrincipalName $NewUser -AccountPassword (Read-Host "New Password" -AsSecureString)

    set-QADObject -identity $Username.Alias_Name -ObjectAttribute @{"msRTCSIP-PrimaryUserAddress"=sip:$NewUser}

  • #28049

    Points: 41
    Rank: Member

    QAD suggests that you're trying to use the Quest Active Directory cmdlets and the error is given because don't have them installed. Even so, I can't see how the identity provided for the account would be correct from the example you have given.

    Try using Set-ADUser instead. The syntax will be slightly different, it will be something like this:

    #replace userA with the user's sAMAccountName
    Set-ADUser -identity userA -add @{msRTCSIP-PrimaryUserAddress="sip:$NewUser"}
  • #28127

    Points: 0
    Rank: Member

    hey, thanks for the reply.
    Your command worked but i had to slightly modify it so that the – in the msRTCSIP-PrimaryUserAddress did not get taken as a variable.

    Set-ADUser -identity $Username -add @{"msRTCSIP-PrimaryUserAddress"=$SIP}

The topic ‘Create New User in AD using -instance and setting msRTCSIP-PrimaryUserAddress’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort