Author Posts

July 30, 2015 at 9:43 pm

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.$Lastname@pgi.com"
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}

July 31, 2015 at 3:22 am

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"}

August 2, 2015 at 9:04 pm

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}