Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Can I Modify ADSI with Powershell???

Closed Thread
 
Thread Tools Display Modes
Old 09-08-2007   #1 (permalink)
Dan
Guest


 

Can I Modify ADSI with Powershell???

Hello. I'm trying to script adding additional UPN suffixes using Powershell
but can't seem to find a way to do it. I've found vb scripts that show
appending data into the partition table in AD, but nothing for Powershell.

Any help would be appreciated.
Old 09-08-2007   #2 (permalink)
Hal Rottenberg
Guest


 

Re: Can I Modify ADSI with Powershell???

Dan wrote:
Quote:

> Hello. I'm trying to script adding additional UPN suffixes using Powershell
> but can't seem to find a way to do it. I've found vb scripts that show
> appending data into the partition table in AD, but nothing for Powershell.
>
> Any help would be appreciated.
Here's a good link with some general ADSI examples:
http://blogs.msdn.com/arulk/archive/...25/678137.aspx

There are others out there, as well as some discussion in this newsgroup, you
might want to try searching the archives.

--

Hal Rottenberg
blog: http://halr9000.com
powershell category:
http://halr9000.com/article/category...ng/powershell/
Old 09-08-2007   #3 (permalink)
RichS
Guest


 

RE: Can I Modify ADSI with Powershell???

Can you post a link to a VBscript example & I'll see if I can convert it
--
Richard Siddaway
Please note that all scripts are supplied "as is" and with no warranty
Blog: http://richardsiddaway.spaces.live.com/
PowerShell User Group: http://www.get-psuguk.org.uk


"Dan" wrote:
Quote:

> Hello. I'm trying to script adding additional UPN suffixes using Powershell
> but can't seem to find a way to do it. I've found vb scripts that show
> appending data into the partition table in AD, but nothing for Powershell.
>
> Any help would be appreciated.
Old 09-08-2007   #4 (permalink)
Brandon Shell
Guest


 

Re: Can I Modify ADSI with Powershell???

This should do it for you. It worked for me

function Add-USNSuffix{
Param($usn)
$root = [ADSI]"LDAP://rootDSE"
$conf = [ADSI]"LDAP://cn=partitions,$($root.configurationNamingContext)"
$conf.uPNSuffixes += $usn
$conf.psbase.commitchanges()
}

"Dan" <Dan@xxxxxx> wrote in message
news:EDF5AAD2-2373-4330-8A09-64946A4B52DB@xxxxxx
Quote:

> Hello. I'm trying to script adding additional UPN suffixes using
> Powershell
> but can't seem to find a way to do it. I've found vb scripts that show
> appending data into the partition table in AD, but nothing for Powershell.
>
> Any help would be appreciated.
Old 09-08-2007   #5 (permalink)
Dan
Guest


 

Re: Can I Modify ADSI with Powershell???

Thanks. So I just set the $usn variable in the formula below correct? Do I
need to set the rootDSE or does it find it itself?

"Brandon Shell" wrote:
Quote:

> This should do it for you. It worked for me
>
> function Add-USNSuffix{
> Param($usn)
> $root = [ADSI]"LDAP://rootDSE"
> $conf = [ADSI]"LDAP://cn=partitions,$($root.configurationNamingContext)"
> $conf.uPNSuffixes += $usn
> $conf.psbase.commitchanges()
> }
>
> "Dan" <Dan@xxxxxx> wrote in message
> news:EDF5AAD2-2373-4330-8A09-64946A4B52DB@xxxxxx
Quote:

> > Hello. I'm trying to script adding additional UPN suffixes using
> > Powershell
> > but can't seem to find a way to do it. I've found vb scripts that show
> > appending data into the partition table in AD, but nothing for Powershell.
> >
> > Any help would be appreciated.
>
>
Old 09-08-2007   #6 (permalink)
Brandon Shell
Guest


 

Re: Can I Modify ADSI with Powershell???

It should "find itself" but if it does not you can use the full path
$root = [ADSI]"LDAP://My.Domain.Name/rootDSE"

"Dan" <Dan@xxxxxx> wrote in message
news:E025C995-02BB-471C-BBD7-ECCA6DA281EF@xxxxxx
Quote:

> Thanks. So I just set the $usn variable in the formula below correct? Do
> I
> need to set the rootDSE or does it find it itself?
>
> "Brandon Shell" wrote:
>
Quote:

>> This should do it for you. It worked for me
>>
>> function Add-USNSuffix{
>> Param($usn)
>> $root = [ADSI]"LDAP://rootDSE"
>> $conf =
>> [ADSI]"LDAP://cn=partitions,$($root.configurationNamingContext)"
>> $conf.uPNSuffixes += $usn
>> $conf.psbase.commitchanges()
>> }
>>
>> "Dan" <Dan@xxxxxx> wrote in message
>> news:EDF5AAD2-2373-4330-8A09-64946A4B52DB@xxxxxx
Quote:

>> > Hello. I'm trying to script adding additional UPN suffixes using
>> > Powershell
>> > but can't seem to find a way to do it. I've found vb scripts that show
>> > appending data into the partition table in AD, but nothing for
>> > Powershell.
>> >
>> > Any help would be appreciated.
>>
>>
Old 09-08-2007   #7 (permalink)
Dan
Guest


 

Re: Can I Modify ADSI with Powershell???

I tried this, but it never updates anything. I tried a test scripts that
looks like this:

Param($usn)
$usn = "test.com"
$root = [ADSI]"LDAP://rootDSE"
$conf = [ADSI]"LDAP://cn=partitions,$($root.configurationNamingContext)"
$conf.uPNSuffixes += $usn
$conf.psbase.commitchanges()

Nothing gets modified though. Any suggestions?

"Brandon Shell" wrote:
Quote:

> It should "find itself" but if it does not you can use the full path
> $root = [ADSI]"LDAP://My.Domain.Name/rootDSE"
>
> "Dan" <Dan@xxxxxx> wrote in message
> news:E025C995-02BB-471C-BBD7-ECCA6DA281EF@xxxxxx
Quote:

> > Thanks. So I just set the $usn variable in the formula below correct? Do
> > I
> > need to set the rootDSE or does it find it itself?
> >
> > "Brandon Shell" wrote:
> >
Quote:

> >> This should do it for you. It worked for me
> >>
> >> function Add-USNSuffix{
> >> Param($usn)
> >> $root = [ADSI]"LDAP://rootDSE"
> >> $conf =
> >> [ADSI]"LDAP://cn=partitions,$($root.configurationNamingContext)"
> >> $conf.uPNSuffixes += $usn
> >> $conf.psbase.commitchanges()
> >> }
> >>
> >> "Dan" <Dan@xxxxxx> wrote in message
> >> news:EDF5AAD2-2373-4330-8A09-64946A4B52DB@xxxxxx
> >> > Hello. I'm trying to script adding additional UPN suffixes using
> >> > Powershell
> >> > but can't seem to find a way to do it. I've found vb scripts that show
> >> > appending data into the partition table in AD, but nothing for
> >> > Powershell.
> >> >
> >> > Any help would be appreciated.
> >>
> >>
>
>
Old 09-08-2007   #8 (permalink)
Dan
Guest


 

Re: Can I Modify ADSI with Powershell???

I've got it working now. I used this instead:

$usn = "test.com"
$root = [ADSI]"LDAP://rootDSE"
$conf = [ADSI]"LDAP://cn=partitions,$($root.configurationNamingContext)"
$conf.uPNSuffixes += $usn
$conf.SetInfo()

Thanks for the help!

"Dan" wrote:
Quote:

> I tried this, but it never updates anything. I tried a test scripts that
> looks like this:
>
> Param($usn)
> $usn = "test.com"
> $root = [ADSI]"LDAP://rootDSE"
> $conf = [ADSI]"LDAP://cn=partitions,$($root.configurationNamingContext)"
> $conf.uPNSuffixes += $usn
> $conf.psbase.commitchanges()
>
> Nothing gets modified though. Any suggestions?
>
> "Brandon Shell" wrote:
>
Quote:

> > It should "find itself" but if it does not you can use the full path
> > $root = [ADSI]"LDAP://My.Domain.Name/rootDSE"
> >
> > "Dan" <Dan@xxxxxx> wrote in message
> > news:E025C995-02BB-471C-BBD7-ECCA6DA281EF@xxxxxx
Quote:

> > > Thanks. So I just set the $usn variable in the formula below correct? Do
> > > I
> > > need to set the rootDSE or does it find it itself?
> > >
> > > "Brandon Shell" wrote:
> > >
> > >> This should do it for you. It worked for me
> > >>
> > >> function Add-USNSuffix{
> > >> Param($usn)
> > >> $root = [ADSI]"LDAP://rootDSE"
> > >> $conf =
> > >> [ADSI]"LDAP://cn=partitions,$($root.configurationNamingContext)"
> > >> $conf.uPNSuffixes += $usn
> > >> $conf.psbase.commitchanges()
> > >> }
> > >>
> > >> "Dan" <Dan@xxxxxx> wrote in message
> > >> news:EDF5AAD2-2373-4330-8A09-64946A4B52DB@xxxxxx
> > >> > Hello. I'm trying to script adding additional UPN suffixes using
> > >> > Powershell
> > >> > but can't seem to find a way to do it. I've found vb scripts that show
> > >> > appending data into the partition table in AD, but nothing for
> > >> > Powershell.
> > >> >
> > >> > Any help would be appreciated.
> > >>
> > >>
> >
> >
Old 09-09-2007   #9 (permalink)
/\\/\\o\\/\\/ [MVP]
Guest


 

Re: Can I Modify ADSI with Powershell???

Dan,

f.y.i.

Brandon did make it into a function for easy of use, after loading this
function one, you can just run this function with the new USN name.
e.g. in your case this would loook like :

Add-USNSuffix test.com

it's was not ment or needed to add the USN name hardcoded

h.t.h.

Greetings /\/\o\/\/


"Dan" <Dan@xxxxxx> wrote in message
news:C53D127A-669D-4525-9DB4-ACD1EF4E8850@xxxxxx
Quote:

> I've got it working now. I used this instead:
>
> $usn = "test.com"
> $root = [ADSI]"LDAP://rootDSE"
> $conf = [ADSI]"LDAP://cn=partitions,$($root.configurationNamingContext)"
> $conf.uPNSuffixes += $usn
> $conf.SetInfo()
>
> Thanks for the help!
>
> "Dan" wrote:
>
Quote:

>> I tried this, but it never updates anything. I tried a test scripts that
>> looks like this:
>>
>> Param($usn)
>> $usn = "test.com"
>> $root = [ADSI]"LDAP://rootDSE"
>> $conf = [ADSI]"LDAP://cn=partitions,$($root.configurationNamingContext)"
>> $conf.uPNSuffixes += $usn
>> $conf.psbase.commitchanges()
>>
>> Nothing gets modified though. Any suggestions?
>>
>> "Brandon Shell" wrote:
>>
Quote:

>> > It should "find itself" but if it does not you can use the full path
>> > $root = [ADSI]"LDAP://My.Domain.Name/rootDSE"
>> >
>> > "Dan" <Dan@xxxxxx> wrote in message
>> > news:E025C995-02BB-471C-BBD7-ECCA6DA281EF@xxxxxx
>> > > Thanks. So I just set the $usn variable in the formula below
>> > > correct? Do
>> > > I
>> > > need to set the rootDSE or does it find it itself?
>> > >
>> > > "Brandon Shell" wrote:
>> > >
>> > >> This should do it for you. It worked for me
>> > >>
>> > >> function Add-USNSuffix{
>> > >> Param($usn)
>> > >> $root = [ADSI]"LDAP://rootDSE"
>> > >> $conf =
>> > >> [ADSI]"LDAP://cn=partitions,$($root.configurationNamingContext)"
>> > >> $conf.uPNSuffixes += $usn
>> > >> $conf.psbase.commitchanges()
>> > >> }
>> > >>
>> > >> "Dan" <Dan@xxxxxx> wrote in message
>> > >> news:EDF5AAD2-2373-4330-8A09-64946A4B52DB@xxxxxx
>> > >> > Hello. I'm trying to script adding additional UPN suffixes using
>> > >> > Powershell
>> > >> > but can't seem to find a way to do it. I've found vb scripts that
>> > >> > show
>> > >> > appending data into the partition table in AD, but nothing for
>> > >> > Powershell.
>> > >> >
>> > >> > Any help would be appreciated.
>> > >>
>> > >>
>> >
>> >
Old 09-09-2007   #10 (permalink)
Brandon Shell
Guest


 

Re: Can I Modify ADSI with Powershell???

Thanks MoW... I will make a point to clarify that next time

"/\/\o\/\/ [MVP]" <mow001@xxxxxx> wrote in message
news:OidLjvr8HHA.5160@xxxxxx
Quote:

> Dan,
>
> f.y.i.
>
> Brandon did make it into a function for easy of use, after loading this
> function one, you can just run this function with the new USN name.
> e.g. in your case this would loook like :
>
> Add-USNSuffix test.com
>
> it's was not ment or needed to add the USN name hardcoded
>
> h.t.h.
>
> Greetings /\/\o\/\/
>
>
> "Dan" <Dan@xxxxxx> wrote in message
> news:C53D127A-669D-4525-9DB4-ACD1EF4E8850@xxxxxx
Quote:

>> I've got it working now. I used this instead:
>>
>> $usn = "test.com"
>> $root = [ADSI]"LDAP://rootDSE"
>> $conf = [ADSI]"LDAP://cn=partitions,$($root.configurationNamingContext)"
>> $conf.uPNSuffixes += $usn
>> $conf.SetInfo()
>>
>> Thanks for the help!
>>
>> "Dan" wrote:
>>
Quote:

>>> I tried this, but it never updates anything. I tried a test scripts
>>> that
>>> looks like this:
>>>
>>> Param($usn)
>>> $usn = "test.com"
>>> $root = [ADSI]"LDAP://rootDSE"
>>> $conf = [ADSI]"LDAP://cn=partitions,$($root.configurationNamingContext)"
>>> $conf.uPNSuffixes += $usn
>>> $conf.psbase.commitchanges()
>>>
>>> Nothing gets modified though. Any suggestions?
>>>
>>> "Brandon Shell" wrote:
>>>
>>> > It should "find itself" but if it does not you can use the full path
>>> > $root = [ADSI]"LDAP://My.Domain.Name/rootDSE"
>>> >
>>> > "Dan" <Dan@xxxxxx> wrote in message
>>> > news:E025C995-02BB-471C-BBD7-ECCA6DA281EF@xxxxxx
>>> > > Thanks. So I just set the $usn variable in the formula below
>>> > > correct? Do
>>> > > I
>>> > > need to set the rootDSE or does it find it itself?
>>> > >
>>> > > "Brandon Shell" wrote:
>>> > >
>>> > >> This should do it for you. It worked for me
>>> > >>
>>> > >> function Add-USNSuffix{
>>> > >> Param($usn)
>>> > >> $root = [ADSI]"LDAP://rootDSE"
>>> > >> $conf =
>>> > >> [ADSI]"LDAP://cn=partitions,$($root.configurationNamingContext)"
>>> > >> $conf.uPNSuffixes += $usn
>>> > >> $conf.psbase.commitchanges()
>>> > >> }
>>> > >>
>>> > >> "Dan" <Dan@xxxxxx> wrote in message
>>> > >> news:EDF5AAD2-2373-4330-8A09-64946A4B52DB@xxxxxx
>>> > >> > Hello. I'm trying to script adding additional UPN suffixes using
>>> > >> > Powershell
>>> > >> > but can't seem to find a way to do it. I've found vb scripts
>>> > >> > that show
>>> > >> > appending data into the partition table in AD, but nothing for
>>> > >> > Powershell.
>>> > >> >
>>> > >> > Any help would be appreciated.
>>> > >>
>>> > >>
>>> >
>>> >
>
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing Exchange 5.5 hidden recipients with PowerShell ADSI Dan Roberts @ Kent State PowerShell 1 07-22-2008 02:35 PM
Modify PowerShell prompt when running as admin Marc Scheuner PowerShell 2 10-14-2007 02:41 PM
error when using adsi laurent PowerShell 2 03-20-2007 11:43 AM
Is it possible to modify keymgr.dll entires via powershell? tugay PowerShell 0 11-28-2006 03:45 PM
ADSI Documentation? Jim Holbach PowerShell 3 10-15-2006 08:01 PM








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50