#146485 - 2005-08-26 08:05 PM
Newbie Question (Write AD Object)
|
dataspike
Getting the hang of it
Registered: 2005-03-09
Posts: 89
Loc: San Diego, CA
|
Well... I hope I can fully explain what I want to do.
I am getting ready to deploy a LCS (Live Communication Server) and want to add a SIP address to all my user objects in the AD Domain.
From some previous posts, I have found how to read the objects details, specifically the SIP address of a User.
Code:
$objSystemInfo = CreateObject("ADSystemInfo") $strAuthDistinguishedName = "LDAP://" + $objSystemInfo.UserName $UserObj = GetObject($strAuthDistinguishedName)
? "LCS SIP IM Address: " + $UserObj.Get("msRTCSIP-PrimaryUserAddress") Sleep 10
However, I was wondering if it's even possible to WRITE the address if it's blank?
Any thoughts, comments would be great.
Thanks, Chris
|
Top
|
|
|
|
#146489 - 2005-08-26 09:06 PM
Re: Newbie Question (Write AD Object)
|
dataspike
Getting the hang of it
Registered: 2005-03-09
Posts: 89
Loc: San Diego, CA
|
Dude... you freaking ROCK.
Code:
$UserObj.Put ("msRTCSIP-PrimaryUserAddress","address@@here.com") $UserObj.setinfo
|
Top
|
|
|
|
#146495 - 2005-08-29 08:33 PM
Re: Newbie Question (Write AD Object)
|
dataspike
Getting the hang of it
Registered: 2005-03-09
Posts: 89
Loc: San Diego, CA
|
Thank you for the example... However it isn't working. This is the code that I am using. It'll say it changes it, but when I view it in AD, it's still blank.
Code:
$UserObj = GetObject("LDAP://ou=Employees,ou=Users,ou=Location,dc=Company,dc=com") $UserObj.Filter = Split('user')
For Each $User in $UserObj $Address = Lcase($User.sAMAccountName) + "@@mycompany.com" ? 'Current address is: ' + $User.Get("mail") $User.put("mail",$Address) $User.setinfo ? 'E-mail address is now set to: ' + $User.Get("mail") Next
Sleep 10
Do I have to run it with elevated permissions?
HELP!!!!
|
Top
|
|
|
|
#146496 - 2005-08-29 09:03 PM
Re: Newbie Question (Write AD Object)
|
NTDOC
Administrator
Registered: 2000-07-28
Posts: 11623
Loc: CA
|
Quote:
Do I have to run it with elevated permissions?
Yes, unless you've modified the AD rights (not recommended) normal users can not modify these settings.
|
Top
|
|
|
|
#146502 - 2006-02-13 09:43 PM
Re: Newbie Question (Write AD Object)
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
I love Search...
I just had to clear the logonscript value for several OUs of users...
Code:
break on
$OU = 'LDAP://domain/OU=Users, OU=aXX, DC=domain,DC=com'
For each $Item in GetObject($OU) $cn = $Item.distinguishedName $UP = GetObject("LDAP://"+$cn)
? $uP.FirstName +' '+ $uP.LastName +' '+$uP.scriptPath
if instr($uP.scriptPath,'smsls') ' changing' $up.PutEx(1, "ScriptPath", "") $up.setinfo endif $UP = 0 NEXT
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
1 registered
(Allen)
and 382 anonymous users online.
|
|
|