Page 1 of 1 1
Topic Options
#161848 - 2006-05-12 01:45 AM RFC: Get name of PDC
kholm Offline
Korg Regular
*****

Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
To avoid hardcoding the PDC in your scripts you could use this:

Code:

? GetPDC()
Get $RC

Function GetPDC()
Dim $oSysInfo,$PDC

$oSysInfo = CreateObject("ADSystemInfo")
$PDC = $oSysInfo.PDCRoleOwner
$PDC = SubStr($PDC,InStr($PDC,',CN=') + 4)
$GetPDC = Split($PDC,',CN=')[0]
EndFunction


I don't know if this is usefull to anyone, maybee it is common knowledge, but the PDC didn't die when native mode was introduced whith server 2003,

So if you want to know the name of the PDC (role owner) dynamicaly, this code will help you to avoid script failure because of change of PDC name

-Erik

Top
#161849 - 2006-05-16 04:55 AM Re: RFC: Get name of PDC
ozscott75 Offline
Lurker

Registered: 2003-01-07
Posts: 3
Loc: Orange NSW Australia
If all you are doing is go to \\PDCNAME\NETLOGON you could just use the @LDRIVE
Top
#161850 - 2006-05-16 09:51 AM Re: RFC: Get name of PDC
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
@LDRIVE can also be the netlogon folder on a server that is does not act as a PDC so your example will not always work.
In AD it is not really called a PDC but some task are only performed by one server.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#161851 - 2006-05-16 10:54 AM Re: RFC: Get name of PDC
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11629
Loc: CA
Further reading on the subject if you're interested.
@LDrive will often not be the PDC role holder.

Windows 2000 Active Directory FSMO roles

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 675 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.09 seconds in which 0.075 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org